Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #1645 > unrolled thread
| Started by | "Adam Sandler" <adam.sandler@THRWHITE.remove-dii-this> |
|---|---|
| First post | 2011-04-27 15:34 +0000 |
| Last post | 2011-04-27 15:34 +0000 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.java.gui
prevent JList from automa "Adam Sandler" <adam.sandler@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
Re: prevent JList from au "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
| From | "Adam Sandler" <adam.sandler@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:34 +0000 |
| Subject | prevent JList from automa |
| Message-ID | <1179410729.839583.164160@e65g2000hsc.googlegroups.com> |
To: comp.lang.java.gui
Hello,
I've looked at:
http://groups.google.com/group/comp.lang.java.gui/browse_thread/thread/8f2784a481defe49/8e5402c334e46ad7
http://groups.google.com/group/comp.lang.java.gui/browse_thread/thread/f1bdc29ee376c36/4ed497533441e301
and still have a question about JList resizing. In most of the JList
threads I found, there were issues with the items becoming hidden or
visible; that's not a problem here. I'd like to prevent a JList from
resizing itself. In the first URL above, I don't have the container
hierarchy problems they did. In the second URL above, I'm not sure
about setting the preferred size. Aren't the layout managers supposed
to take care sizing? If I set preferred size, does that conflict with
the layout manager? And what impact could setting the preferred size
have on different resolutions... especially if someone is using
something different than 4:3 or 16:9?
On my panel, there are two radio buttons. Depending on what radio
button is selected, different items are sent to the JList. There are
no default items for the JList; when the application is run for the
first time the JList takes up all of its region. When a radio button
is clicked, then the JList resizes itself (usually shrinking) to the
width of the longest item. Well, all this resizing is not very
aesthetically appealing to say the least.
Here is the code for the components and how they are placed on the
container:
private JLabel interferenceDirectoryLabel = new
JLabel("Interference Directory: ");
private JRadioButton ObjectRadioButton = new
JRadioButton("Object");
private JRadioButton VectorRadioButton = new
JRadioButton("Vector");
private ButtonGroup linkButtonGroup = new ButtonGroup();
private JList interferenceConstellationList = new JList();
private JScrollPane jsp = new
JScrollPane(interferenceConstellationList);
private JCheckBox sunRFICheckBox = new JCheckBox("Include Sun
RFI");
private JPanel jp = new JPanel(new BorderLayout());
jp.setBorder(new TitledBorder("Select interference directory"));
jp.add(interferenceDirectoryLabel, BorderLayout.NORTH);
jp.add(ObjectRadioButton, BorderLayout.WEST);
jp.add(VectorRadioButton, BorderLayout.CENTER);
jp.add(jsp, BorderLayout.EAST);
jp.add(sunRFICheckBox, BorderLayout.SOUTH);
Any suggestions on how to proceed are greatly appreciated.
Thanks!
---
* Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [next] | [standalone]
| From | "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:34 +0000 |
| Subject | Re: prevent JList from au |
| Message-ID | <7250bc7b4ef07@uwe> |
| In reply to | #1645 |
To: comp.lang.java.gui Adam Sandler wrote: .. >...I'd like to prevent a JList from >resizing itself. >... Aren't the layout managers supposed >to take care sizing? Yes - they take their strongest tip from the preferred size of components. If practical - a component is set to its preferred size. >...If I set preferred size, does that conflict with >the layout manager? No. >...And what impact could setting the preferred size >have on different resolutions... especially if someone is using >something different than 4:3 or 16:9? If we set the preferred size, it is up to the us to calculate a sensible value. This might be based on the the content (list items), screen size, other things, or combinations. >Any suggestions on how to proceed are greatly appreciated. As far as the resolution goes, see Toolkit.getScreenSize(). -- Andrew Thompson http://www.athompson.info/andrew/ Message posted via JavaKB.com http://www.javakb.com/Uwe/Forums.aspx/java-gui/200705/1 --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.gui
csiph-web