Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #697 > unrolled thread

JPanel will not show ( a

Started byprintdude1968@gmail.com.remove-dii-this
First post2011-04-27 15:29 +0000
Last post2011-04-27 15:29 +0000
Articles 10 — 4 participants

Back to article view | Back to comp.lang.java.gui


Contents

  JPanel will not show  ( a printdude1968@gmail.com.remove-dii-this - 2011-04-27 15:29 +0000
    Re: JPanel will not show "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> - 2011-04-27 15:29 +0000
      Re: JPanel will not show printdude1968@gmail.com.remove-dii-this - 2011-04-27 15:29 +0000
        Re: JPanel will not show "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> - 2011-04-27 15:29 +0000
          Re: JPanel will not show "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:29 +0000
            One final question before printdude1968@gmail.com.remove-dii-this - 2011-04-27 15:29 +0000
              Re: One final question be "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:29 +0000
                Re: One final question be printdude1968@gmail.com.remove-dii-this - 2011-04-27 15:29 +0000
              Re: One final question be "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:29 +0000
      Re: JPanel will not show "Ian Wilson" <ian.wilson@THRWHITE.remove-dii-this> - 2011-04-27 15:29 +0000

#697 — JPanel will not show ( a

Fromprintdude1968@gmail.com.remove-dii-this
Date2011-04-27 15:29 +0000
SubjectJPanel will not show ( a
Message-ID<1168994757.563328.324640@11g2000cwr.googlegroups.com>
  To: comp.lang.java.gui
So you can see my program in contxt

public class MainPanel extends JPanel implements ActionListener {

	JFrame parent;
//    JFrame addPrinterFrame, deletePrinterFrame, changePrinterFrame;
	JButton addButton, changeButton, delButton;
	JTextArea jtarea;
	JScrollPane scrollPane;
	JPanel buttonPanel, scrollPanePanel;

	// View
	MainPanel(JFrame parent) throws IOException {
		Toolkit kit = Toolkit.getDefaultToolkit();
		Dimension screenSize = kit.getScreenSize();
		int screenHeight = screenSize.height;
		int screenWidth = screenSize.width;
		setSize(screenWidth / 2, screenHeight / 2);
		setLocation(screenWidth / 4, screenHeight / 4);
// snipping a bunch of stuff
// Here is my action

public void actionPerformed(ActionEvent e) {
		String command = e.getActionCommand();
		if (command.equals("Add Printer")) {
			JPanel addPanel = createAddPanel();
			addPanel.setVisible(true);
			addPanel.setEnabled(true);
			} else if (command.equals("Change Printer")) {
		//	JPanel addPanel = createChangePanel();
		} else if (command.equals("Delete Printer")) {
			//JPanel addPanel = createDeletePanel();
		}
	}
// more snipped stuff
// Here is the method it calls

	private JPanel createAddPanel()
	{
	    JPanel box = new JPanel();
	    JButton testButton = new JButton("test");
        box.setLayout(new BoxLayout(box, BoxLayout.PAGE_AXIS));
        JPanel pane = new JPanel(new BorderLayout());
        pane.add(box, BorderLayout.NORTH);
        pane.add(testButton, BorderLayout.SOUTH);
// I see this line in my eclipse console so I know that the code is
getting here!!
        System.out.println("returning pane");
        return pane;
	}
// snipped stuff at the end
}


How do I make my panel appear?  Do I need to add it to the main JFrame,
or is there a way to use the JPanel and have it a distinct window that
can be moved around and resized independantly of the main window....
ideas where I can look to figure this out?  Will I find the answer in
the sun java swing tutorial or is there somewhere else I should be
looking?

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [next] | [standalone]


#698 — Re: JPanel will not show

From"Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this>
Date2011-04-27 15:29 +0000
SubjectRe: JPanel will not show
Message-ID<DTfrh.1882$cv2.1419@newsfe13.lga>
In reply to#697
  To: comp.lang.java.gui
printdude1968@gmail.com wrote:
> So you can see my program in contxt
> 
> public class MainPanel extends JPanel implements ActionListener {
> 
> 	JFrame parent;
> //    JFrame addPrinterFrame, deletePrinterFrame, changePrinterFrame;
> 	JButton addButton, changeButton, delButton;
> 	JTextArea jtarea;
> 	JScrollPane scrollPane;
> 	JPanel buttonPanel, scrollPanePanel;
> 
> 	// View
> 	MainPanel(JFrame parent) throws IOException {
> 		Toolkit kit = Toolkit.getDefaultToolkit();
> 		Dimension screenSize = kit.getScreenSize();
> 		int screenHeight = screenSize.height;
> 		int screenWidth = screenSize.width;
> 		setSize(screenWidth / 2, screenHeight / 2);
> 		setLocation(screenWidth / 4, screenHeight / 4);
> // snipping a bunch of stuff
> // Here is my action
> 
> public void actionPerformed(ActionEvent e) {
> 		String command = e.getActionCommand();
> 		if (command.equals("Add Printer")) {
> 			JPanel addPanel = createAddPanel();
> 			addPanel.setVisible(true);
> 			addPanel.setEnabled(true);
> 			} else if (command.equals("Change Printer")) {
> 		//	JPanel addPanel = createChangePanel();
> 		} else if (command.equals("Delete Printer")) {
> 			//JPanel addPanel = createDeletePanel();
> 		}
> 	}
> // more snipped stuff
> // Here is the method it calls
> 
> 	private JPanel createAddPanel()
> 	{
> 	    JPanel box = new JPanel();
> 	    JButton testButton = new JButton("test");
>         box.setLayout(new BoxLayout(box, BoxLayout.PAGE_AXIS));
>         JPanel pane = new JPanel(new BorderLayout());
>         pane.add(box, BorderLayout.NORTH);
>         pane.add(testButton, BorderLayout.SOUTH);
> // I see this line in my eclipse console so I know that the code is
> getting here!!
>         System.out.println("returning pane");
>         return pane;
> 	}
> // snipped stuff at the end
> }
> 
> 
> How do I make my panel appear?  Do I need to add it to the main JFrame,
> or is there a way to use the JPanel and have it a distinct window that
> can be moved around and resized independantly of the main window....
> ideas where I can look to figure this out?  Will I find the answer in
> the sun java swing tutorial or is there somewhere else I should be
> looking?
> 

You make your panel appear by adding it to a top level container and 
then showing the container.  A top level container is a Frame/JFrame or 
Window/JWindow.

The biggest problem you are going to face is layout managers.  Either 
you use one or you don't but you can't mix and match.  If you want to 
lay out your container manually then set it's layout manager to null. 
Then every component you add will have to have a size and a location set 
or it will not show up.  I guarantee you that your life will be much 
better if you don't do that and use an appropriate layout manager instead.

Since all of your code is not there it is difficult to tell exactly what 
you want to do.  And since you didn't really tell us we just have to 
guess.  It looks like you want to display a different panel depending on 
a button selection.  Here is a simple example of how to do that.

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class test extends JFrame implements ActionListener {
     JPanel panel;
     JPanel redPanel,greenPanel,bluePanel;

     public test() {
         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

         redPanel = new JPanel();
         redPanel.setBackground(Color.RED);
         redPanel.setPreferredSize(new Dimension(400,300));

         greenPanel = new JPanel();
         greenPanel.setBackground(Color.GREEN);
         greenPanel.setPreferredSize(new Dimension(400,300));

         bluePanel = new JPanel();
         bluePanel.setBackground(Color.BLUE);
         bluePanel.setPreferredSize(new Dimension(400,300));

         panel = redPanel;
         add(panel,BorderLayout.CENTER);

         JPanel buttonPanel = new JPanel();

         JButton red = new JButton("Red");
         red.addActionListener(this);
         buttonPanel.add(red);

         JButton green = new JButton("Green");
         green.addActionListener(this);
         buttonPanel.add(green);

         JButton blue = new JButton("Blue");
         blue.addActionListener(this);
         buttonPanel.add(blue);

         add(buttonPanel,BorderLayout.SOUTH);

         pack();
         setVisible(true);
     }

     public void actionPerformed(ActionEvent ae) {
         String ac = ae.getActionCommand();
         if (ac.equals("Red")) {
            remove(panel);
            panel = redPanel;
            add(panel,BorderLayout.CENTER);
            validate();
            repaint();
         } else if (ac.equals("Green")) {
            remove(panel);
            panel = greenPanel;
            add(panel,BorderLayout.CENTER);
            validate();
            repaint();
         } else if (ac.equals("Blue")) {
            remove(panel);
            panel = bluePanel;
            add(panel,BorderLayout.CENTER);
            validate();
            repaint();
         }
     }

     public static void main(String[] args) {
         Runnable r = new Runnable() {
             public void run() {
                 new test();
             }
         };
         EventQueue.invokeLater(r);
     }
}

-- 

Knute Johnson
email s/nospam/knute/

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#700 — Re: JPanel will not show

Fromprintdude1968@gmail.com.remove-dii-this
Date2011-04-27 15:29 +0000
SubjectRe: JPanel will not show
Message-ID<1169001753.854331.284540@a75g2000cwd.googlegroups.com>
In reply to#698
  To: comp.lang.java.gui

Knute Johnson wrote:
> printdude1968@gmail.com wrote:
> > So you can see my program in contxt
> >
> > public class MainPanel extends JPanel implements ActionListener {
> >
> > 	JFrame parent;
> > //    JFrame addPrinterFrame, deletePrinterFrame, changePrinterFrame;
> > 	JButton addButton, changeButton, delButton;
> > 	JTextArea jtarea;
> > 	JScrollPane scrollPane;
> > 	JPanel buttonPanel, scrollPanePanel;
> >
> > 	// View
> > 	MainPanel(JFrame parent) throws IOException {
> > 		Toolkit kit = Toolkit.getDefaultToolkit();
> > 		Dimension screenSize = kit.getScreenSize();
> > 		int screenHeight = screenSize.height;
> > 		int screenWidth = screenSize.width;
> > 		setSize(screenWidth / 2, screenHeight / 2);
> > 		setLocation(screenWidth / 4, screenHeight / 4);
> > // snipping a bunch of stuff
> > // Here is my action
> >
> > public void actionPerformed(ActionEvent e) {
> > 		String command = e.getActionCommand();
> > 		if (command.equals("Add Printer")) {
> > 			JPanel addPanel = createAddPanel();
> > 			addPanel.setVisible(true);
> > 			addPanel.setEnabled(true);
> > 			} else if (command.equals("Change Printer")) {
> > 		//	JPanel addPanel = createChangePanel();
> > 		} else if (command.equals("Delete Printer")) {
> > 			//JPanel addPanel = createDeletePanel();
> > 		}
> > 	}
> > // more snipped stuff
> > // Here is the method it calls
> >
> > 	private JPanel createAddPanel()
> > 	{
> > 	    JPanel box = new JPanel();
> > 	    JButton testButton = new JButton("test");
> >         box.setLayout(new BoxLayout(box, BoxLayout.PAGE_AXIS));
> >         JPanel pane = new JPanel(new BorderLayout());
> >         pane.add(box, BorderLayout.NORTH);
> >         pane.add(testButton, BorderLayout.SOUTH);
> > // I see this line in my eclipse console so I know that the code is
> > getting here!!
> >         System.out.println("returning pane");
> >         return pane;
> > 	}
> > // snipped stuff at the end
> > }
> >
> >
> > How do I make my panel appear?  Do I need to add it to the main JFrame,
> > or is there a way to use the JPanel and have it a distinct window that
> > can be moved around and resized independantly of the main window....
> > ideas where I can look to figure this out?  Will I find the answer in
> > the sun java swing tutorial or is there somewhere else I should be
> > looking?
> >
>
> You make your panel appear by adding it to a top level container and
> then showing the container.  A top level container is a Frame/JFrame or
> Window/JWindow.
>
> The biggest problem you are going to face is layout managers.  Either
> you use one or you don't but you can't mix and match.  If you want to
> lay out your container manually then set it's layout manager to null.
> Then every component you add will have to have a size and a location set
> or it will not show up.  I guarantee you that your life will be much
> better if you don't do that and use an appropriate layout manager instead.
>
> Since all of your code is not there it is difficult to tell exactly what
> you want to do.  And since you didn't really tell us we just have to
> guess.  It looks like you want to display a different panel depending on
> a button selection.  Here is a simple example of how to do that.
>
> import java.awt.*;
> import java.awt.event.*;
> import javax.swing.*;
>
> public class test extends JFrame implements ActionListener {
>      JPanel panel;
>      JPanel redPanel,greenPanel,bluePanel;
>
>      public test() {
>          setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
>
>          redPanel = new JPanel();
>          redPanel.setBackground(Color.RED);
>          redPanel.setPreferredSize(new Dimension(400,300));
>
>          greenPanel = new JPanel();
>          greenPanel.setBackground(Color.GREEN);
>          greenPanel.setPreferredSize(new Dimension(400,300));
>
>          bluePanel = new JPanel();
>          bluePanel.setBackground(Color.BLUE);
>          bluePanel.setPreferredSize(new Dimension(400,300));
>
>          panel = redPanel;
>          add(panel,BorderLayout.CENTER);
>
>          JPanel buttonPanel = new JPanel();
>
>          JButton red = new JButton("Red");
>          red.addActionListener(this);
>          buttonPanel.add(red);
>
>          JButton green = new JButton("Green");
>          green.addActionListener(this);
>          buttonPanel.add(green);
>
>          JButton blue = new JButton("Blue");
>          blue.addActionListener(this);
>          buttonPanel.add(blue);
>
>          add(buttonPanel,BorderLayout.SOUTH);
>
>          pack();
>          setVisible(true);
>      }
>
>      public void actionPerformed(ActionEvent ae) {
>          String ac = ae.getActionCommand();
>          if (ac.equals("Red")) {
>             remove(panel);
>             panel = redPanel;
>             add(panel,BorderLayout.CENTER);
>             validate();
>             repaint();
>          } else if (ac.equals("Green")) {
>             remove(panel);
>             panel = greenPanel;
>             add(panel,BorderLayout.CENTER);
>             validate();
>             repaint();
>          } else if (ac.equals("Blue")) {
>             remove(panel);
>             panel = bluePanel;
>             add(panel,BorderLayout.CENTER);
>             validate();
>             repaint();
>          }
>      }
>
>      public static void main(String[] args) {
>          Runnable r = new Runnable() {
>              public void run() {
>                  new test();
>              }
>          };
>          EventQueue.invokeLater(r);
>      }
> }
>
> --
>
> Knute Johnson
> email s/nospam/knute/

Ok... that's what I thought.  I need to add the panel to the top level
container.  Thanks for your help.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#702 — Re: JPanel will not show

From"Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this>
Date2011-04-27 15:29 +0000
SubjectRe: JPanel will not show
Message-ID<EWirh.133211$Pv5.44566@newsfe17.lga>
In reply to#700
  To: comp.lang.java.gui
printdude1968@gmail.com wrote:
> Knute Johnson wrote:
>> printdude1968@gmail.com wrote:
>>> So you can see my program in contxt
>>>
>>> public class MainPanel extends JPanel implements ActionListener {
>>>
>>> 	JFrame parent;
>>> //    JFrame addPrinterFrame, deletePrinterFrame, changePrinterFrame;
>>> 	JButton addButton, changeButton, delButton;
>>> 	JTextArea jtarea;
>>> 	JScrollPane scrollPane;
>>> 	JPanel buttonPanel, scrollPanePanel;
>>>
>>> 	// View
>>> 	MainPanel(JFrame parent) throws IOException {
>>> 		Toolkit kit = Toolkit.getDefaultToolkit();
>>> 		Dimension screenSize = kit.getScreenSize();
>>> 		int screenHeight = screenSize.height;
>>> 		int screenWidth = screenSize.width;
>>> 		setSize(screenWidth / 2, screenHeight / 2);
>>> 		setLocation(screenWidth / 4, screenHeight / 4);
>>> // snipping a bunch of stuff
>>> // Here is my action
>>>
>>> public void actionPerformed(ActionEvent e) {
>>> 		String command = e.getActionCommand();
>>> 		if (command.equals("Add Printer")) {
>>> 			JPanel addPanel = createAddPanel();
>>> 			addPanel.setVisible(true);
>>> 			addPanel.setEnabled(true);
>>> 			} else if (command.equals("Change Printer")) {
>>> 		//	JPanel addPanel = createChangePanel();
>>> 		} else if (command.equals("Delete Printer")) {
>>> 			//JPanel addPanel = createDeletePanel();
>>> 		}
>>> 	}
>>> // more snipped stuff
>>> // Here is the method it calls
>>>
>>> 	private JPanel createAddPanel()
>>> 	{
>>> 	    JPanel box = new JPanel();
>>> 	    JButton testButton = new JButton("test");
>>>         box.setLayout(new BoxLayout(box, BoxLayout.PAGE_AXIS));
>>>         JPanel pane = new JPanel(new BorderLayout());
>>>         pane.add(box, BorderLayout.NORTH);
>>>         pane.add(testButton, BorderLayout.SOUTH);
>>> // I see this line in my eclipse console so I know that the code is
>>> getting here!!
>>>         System.out.println("returning pane");
>>>         return pane;
>>> 	}
>>> // snipped stuff at the end
>>> }
>>>
>>>
>>> How do I make my panel appear?  Do I need to add it to the main JFrame,
>>> or is there a way to use the JPanel and have it a distinct window that
>>> can be moved around and resized independantly of the main window....
>>> ideas where I can look to figure this out?  Will I find the answer in
>>> the sun java swing tutorial or is there somewhere else I should be
>>> looking?
>>>
>> You make your panel appear by adding it to a top level container and
>> then showing the container.  A top level container is a Frame/JFrame or
>> Window/JWindow.
>>
>> The biggest problem you are going to face is layout managers.  Either
>> you use one or you don't but you can't mix and match.  If you want to
>> lay out your container manually then set it's layout manager to null.
>> Then every component you add will have to have a size and a location set
>> or it will not show up.  I guarantee you that your life will be much
>> better if you don't do that and use an appropriate layout manager instead.
>>
>> Since all of your code is not there it is difficult to tell exactly what
>> you want to do.  And since you didn't really tell us we just have to
>> guess.  It looks like you want to display a different panel depending on
>> a button selection.  Here is a simple example of how to do that.
>>
>> import java.awt.*;
>> import java.awt.event.*;
>> import javax.swing.*;
>>
>> public class test extends JFrame implements ActionListener {
>>      JPanel panel;
>>      JPanel redPanel,greenPanel,bluePanel;
>>
>>      public test() {
>>          setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
>>
>>          redPanel = new JPanel();
>>          redPanel.setBackground(Color.RED);
>>          redPanel.setPreferredSize(new Dimension(400,300));
>>
>>          greenPanel = new JPanel();
>>          greenPanel.setBackground(Color.GREEN);
>>          greenPanel.setPreferredSize(new Dimension(400,300));
>>
>>          bluePanel = new JPanel();
>>          bluePanel.setBackground(Color.BLUE);
>>          bluePanel.setPreferredSize(new Dimension(400,300));
>>
>>          panel = redPanel;
>>          add(panel,BorderLayout.CENTER);
>>
>>          JPanel buttonPanel = new JPanel();
>>
>>          JButton red = new JButton("Red");
>>          red.addActionListener(this);
>>          buttonPanel.add(red);
>>
>>          JButton green = new JButton("Green");
>>          green.addActionListener(this);
>>          buttonPanel.add(green);
>>
>>          JButton blue = new JButton("Blue");
>>          blue.addActionListener(this);
>>          buttonPanel.add(blue);
>>
>>          add(buttonPanel,BorderLayout.SOUTH);
>>
>>          pack();
>>          setVisible(true);
>>      }
>>
>>      public void actionPerformed(ActionEvent ae) {
>>          String ac = ae.getActionCommand();
>>          if (ac.equals("Red")) {
>>             remove(panel);
>>             panel = redPanel;
>>             add(panel,BorderLayout.CENTER);
>>             validate();
>>             repaint();
>>          } else if (ac.equals("Green")) {
>>             remove(panel);
>>             panel = greenPanel;
>>             add(panel,BorderLayout.CENTER);
>>             validate();
>>             repaint();
>>          } else if (ac.equals("Blue")) {
>>             remove(panel);
>>             panel = bluePanel;
>>             add(panel,BorderLayout.CENTER);
>>             validate();
>>             repaint();
>>          }
>>      }
>>
>>      public static void main(String[] args) {
>>          Runnable r = new Runnable() {
>>              public void run() {
>>                  new test();
>>              }
>>          };
>>          EventQueue.invokeLater(r);
>>      }
>> }
>>
>> --
>>
>> Knute Johnson
>> email s/nospam/knute/
> 
> Ok... that's what I thought.  I need to add the panel to the top level
> container.  Thanks for your help.
> 

Or to another container, it doesn't matter which.

-- 

Knute Johnson
email s/nospam/knute/

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#704 — Re: JPanel will not show

From"Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this>
Date2011-04-27 15:29 +0000
SubjectRe: JPanel will not show
Message-ID<1169015200.445602.10850@a75g2000cwd.googlegroups.com>
In reply to#702
  To: comp.lang.java.gui
Knute Johnson wrote:
> printdude1968@gmail.com wrote:
> > Knute Johnson wrote:
> >> printdude1968@gmail.com wrote:
> >>> So you can see my program in contxt
> >>>
> >>> public class MainPanel extends JPanel implements ActionListener {
..
> >>> How do I make my panel appear?
...
> >> You make your panel appear by adding it to a top level container
..
> >> The biggest problem you are going to face is layout managers.
..
> >> .. Here is a simple example of how to do that.
> >>
> >> import java.awt.*;
..
> > Ok... that's what I thought.  I need to add the panel to the top level
> > container.  Thanks for your help.
..
> Or to another container, it doesn't matter which.

Since the OP seems to have now made the (excellent,
I feel) choice to not top-post, I am guessing they are
open to 'usenaut' like tips.  So I will suggest another one.

'trim' text when replying.  Note that I gave a basic
'context' for the earlier conversation in just 22 lines.
Since it was not really necessary to repeat the detail,
I saved a lot of bytes.

Oh, and note that I felt the point had already been
made re. no more t-p, and I was sick of seeing it
in the title (so I changed the title - to reflect that!).
Apologies if I break the threading of this in
anyone's news-client.

Andrew T.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#710 — One final question before

Fromprintdude1968@gmail.com.remove-dii-this
Date2011-04-27 15:29 +0000
SubjectOne final question before
Message-ID<1169078796.224243.314390@38g2000cwa.googlegroups.com>
In reply to#704
  To: comp.lang.java.gui
<respectful snippage>
Rather than continue to post questions about something I am not
experienced enough to complete without further education, I will submit
one final question:

What are the recommendations of the c.l.j.g posters with regards to web
sites that can provide me, coming from a procedural and scripting
language background, with enough information to help me transition into
the world of creating Java GUI's.

PS - The FAQ is very useful.  I appreciate the amount of time that goes
into maintaining.

Oh..and sorry about the subject change.  I know that it is not a
generally approved practice and I hope this post doesn't show up twice
becauase gg just did a 505 error on me.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#712 — Re: One final question be

From"Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this>
Date2011-04-27 15:29 +0000
SubjectRe: One final question be
Message-ID<1169081552.917102.252030@51g2000cwl.googlegroups.com>
In reply to#710
  To: comp.lang.java.gui
printdude1968@gmail.com wrote:

Sub: One final question before I head off to learn this stuff better

I forgot to comment on the sub.

But ..'head off'?  Where, why?

Note that even while you are 'off learning stuff',
it can pay to occasionally take a break from
the active learning, and 'lurk about the group'
reading other posts of interest.

You might be surprised, when doing that,
how often you see things come up in threads
where it makes you think "I know that!".

Or sometimes, in my case at least,
"I *thought* I knew that - but their way of
doing it, shows exactly why it should *not*
be done the way I thought!".  ;-)

Andrew T.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#714 — Re: One final question be

Fromprintdude1968@gmail.com.remove-dii-this
Date2011-04-27 15:29 +0000
SubjectRe: One final question be
Message-ID<1169085517.999982.288050@v45g2000cwv.googlegroups.com>
In reply to#712
  To: comp.lang.java.gui

> But ..'head off'?  Where, why?

Just off to try to learn more... I'll still lurk in cljg and cljp
though...there's lots of really interesting things here although most
of it is beyond me right now.
>
> Note that even while you are 'off learning stuff',
> it can pay to occasionally take a break from
> the active learning, and 'lurk about the group'
> reading other posts of interest.
>
Even though I am doing a project in Java for my work (thats where the
GUI is going to be used), I consider Java (and Ruby, and XML and
Groovy, and Oracle and Linux and (X)(D)HTML etc.) to be hobbies....
Java appears to be my favorite.


> You might be surprised, when doing that,
> how often you see things come up in threads
> where it makes you think "I know that!".
>
Yes I agree, but before I can have a thought like that , I have to be
wondering about it?

> Or sometimes, in my case at least,
> "I *thought* I knew that - but their way of
> doing it, shows exactly why it should *not*
> be done the way I thought!".  ;-)
>
I can't make statements like that until I have my own stuff (??) to
compare with.

> Andrew T.

JT

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#716 — Re: One final question be

From"Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this>
Date2011-04-27 15:29 +0000
SubjectRe: One final question be
Message-ID<1169080967.545562.104290@38g2000cwa.googlegroups.com>
In reply to#710
  To: comp.lang.java.gui

printdude1968@gmail.com wrote:
> <respectful snippage>

That's the ticket.  ;-)
...
> What are the recommendations of the c.l.j.g posters with regards to web
> sites that can provide me, coming from a procedural and scripting
> language background, with enough information to help me transition into
> the world of creating Java GUI's.

Interesting question.  I came to Java via (BASIC,
FORTRAN, C) Pascal and COBOL, and was still
'writing COBOL in Java' two years later.

Some of the OO Gurus might argue that I am
*still* writing COBOL in Java, so I will simply
add that Bruce Eckel's "Thinking in Java" is
*reputedly* a great way to get a good taste
of OO itself.

(I mention it, though you were after 'sites', because
it is freely downloadable.  As good as a web site,
but you can read it when off-line.)

Are you also interested in (on paper, pay money 
for) books?

Andrew T.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#703 — Re: JPanel will not show

From"Ian Wilson" <ian.wilson@THRWHITE.remove-dii-this>
Date2011-04-27 15:29 +0000
SubjectRe: JPanel will not show
Message-ID<rpidnTKne4VqdjDYnZ2dnUVZ8tSdnZ2d@bt.com>
In reply to#698
  To: comp.lang.java.gui
Knute Johnson wrote:
> printdude1968@gmail.com wrote:
> 
>> How do I make my panel appear?  Do I need to add it to the main JFrame,
>
> You make your panel appear by adding it to a top level container and 
> then showing the container.  A top level container is a Frame/JFrame or 
> Window/JWindow.

or a Dialog/JDialog including derivatives such as JOptionPane.showXXX().

> 
> The biggest problem you are going to face is layout managers.  Either 
> you use one or you don't but you can't mix and match.  If you want to 
> lay out your container manually then set it's layout manager to null. 
> Then every component you add will have to have a size and a location set 
> or it will not show up.  I guarantee you that your life will be much 
> better if you don't do that and use an appropriate layout manager instead.

Too many people ignore this. Layout managers are one of the best 
features of Java and make laying out resizable panels so much easier. 
Anyone new to layout managers could start with Sun's online tutorials. 
Anyone struggling with GridBagLayout could look at 3rd party layout 
managers like MigLayout (my favourite) and JGoodies FormLayout.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.gui


csiph-web