Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

newbie layout manager question  RSS feed

 
Lester Tam
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, Im new to swing, I want to do a frame like this:
__________________ _______
|_JTextField_______| |JButton|
______________ _____________
|______________| |_____________|
|______________| |_____________|
|____JList ____| |_____img_____|
|______________| |_____________|
|______________| |_____________|
|______________| |_____________|
|______________| |_____________|

the JTextfield is for input/display folder path
the JButton is for open the select folder dlg
the JList is for list all *.jpg file in the folder
when click the Jlist, the selected ing will load to right side.
How should I use the layout manager to do this ?
I tried to use GridLayout(0,1) in JFrame
then add 2 JPanel one, place JTextField and Jbutton in panelA, others to panelB, but it not work good.
thanks
Lester
[ June 24, 2003: Message edited by: Lester Tam ]
[ June 24, 2003: Message edited by: Lester Tam ]
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The way I would do it is one JPanel (called top) with BorderLayout at the top level. That JPanel's NORTH region cotains another JPanel (called north). North uses regular FlowLayout and has the JTextField and JButton added to it. In the CENTER region of top I would add a JSplitPane with the JList on the left and a JLabel (or whatever you're using to show the image) in a JScrollPane on the right.
 
Lester Tam
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nathan,
It work !
Thanks for that
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!