wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes JList Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JList" Watch "JList" New topic
Author

JList

Vu Pham
Ranch Hand

Joined: May 28, 2005
Posts: 100
Here is the image .

http://s6.yousendit.com/d.aspx?id=031LTMCYSMRHB3KJYCY9O8TGUU

Then , I maximized the window . Here is the image .

http://s13.yousendit.com/d.aspx?id=32EFQ8U3AMJP72VXD4FKBQJFCN

I dont want that JList changed like that . Please help me . I want JList's size isn't changed .
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
if you want the JList to be left half of the frame, set the frame as a
gridlayout 1 row 2 colums, and add the scrollpane(containing the JList)
directly to the frame. it will then occupy the left half of whatever size
the frame is.

something like this

Pat Hays
Ranch Hand

Joined: Aug 20, 2004
Posts: 138
Hi Anh Vu

You only need to add one code, please see below:

-------------
jScrollPane1.setPreferredSize(new Dimension(150, 20)); //Note: The jScrollPane1 is the perent of the JList. Set its preferred width to be 150, or whatever you prefer.


Download Java GUI Builder, <a href="http://www.mars3000.com" target="_blank" rel="nofollow">http://www.mars3000.com</a>
Vu Pham
Ranch Hand

Joined: May 28, 2005
Posts: 100
I have tried many layouts and I have set "setPreferedSize()" to many components which are parent of JList . But now I still cant solve my problem .
Here is the image before

http://s36.yousendit.com/d.aspx?id=3104DKKVJZ5WS1GMEYYMCYPFBT

and then

http://s36.yousendit.com/d.aspx?id=1IFQPH405MWQ80KB3TYRZKDA9M
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
perhaps you should post your code, just the GUI shell - enough to
demonstrate the problem.
Vu Pham
Ranch Hand

Joined: May 28, 2005
Posts: 100
Ok, I have solved my problem . Just "setPreferedSize()" . Thanks all .
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JList