aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Layout assistance please Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Layout assistance please" Watch "Layout assistance please" New topic
Author

Layout assistance please

Tempora Telora
Ranch Hand

Joined: Jun 20, 2005
Posts: 83
Hello all,

Here is psuedo for what I am doing

JDialog dialog = new JDialog

JPanel text = new JPanel
text.setLayout(flowlayout());
new label
new inputtextfield
text.add(label)
text.add(inputtextfield)

JPanel boxes
boxes.setLayout(new Boxlayout(boxes))
jlabel
boxes


container = dialgog.getcontentpane()
*****boxlayout******
add(text)
add(boxes)

Now I want to add these to a container.setLayout(boxlayout())
but I am unsure of what I can pass to the boxlayout.
Also how do you give the input field and an elipse or ... so they can browse directories and return only the path directory not a file?

Does this seem to be good practice for the gui adding all the jpanels? Is there a better way of doing this?

Thanks,
Lammy
[ May 10, 2007: Message edited by: Randy Tatham ]
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> ... so they can browse directories and return only the path directory not a file?

JFileChooser set to 'directories only' might suit
Tempora Telora
Ranch Hand

Joined: Jun 20, 2005
Posts: 83
Yea I am using the DIRECTORIES_ONLY constant. The problem is that on my contentpane I am using a flowlayout and hsould be using a boxlayout but, I cannot figure what to pass the boxlayout because I have 4 different JPanels.

Also my jfilechooser is showing up in the window versus just a button. Should I just do a jlabel jtextfield jbutton[to browse files]? Can I direct the answer of hte browser to the jtextfield?


Thanks,
Lammy
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> I cannot figure what to pass the boxlayout because I have 4 different JPanels.

you would add the 4 panels to the boxlayoutPanel, X or Y axis.

JPanel boxlayoutPanel = new JPanel();
boxlayoutPanel.setLayout(new BoxLayout(boxlayoutPanel,BoxLayout.Y_AXIS));
boxlayoutPanel.add(panel1);
boxlayoutPanel.add(panel2);
etc

> Can I direct the answer of hte browser to the jtextfield?

your button opens the JFileChooser (which is modal), so in your button's actionPerformed()

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Layout assistance please