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
posted
0
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
posted
0
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.
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