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 ]
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
posted
0
> 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()