JScrollPane problem in VE [message #667335] |
Thu, 28 April 2011 04:01  |
Ulf Messages: 2 Registered: April 2011 |
Junior Member |
|
|
Hi,
I have a JFrame VE dialog with a JList.
I need to fill the list after in has been initialized so I create
the JList with a DefaultListModel object in the constructor.
Then i add elements to the DefaultListModel object.
The elements are displayed in the list, BUT no vertical scrollbar appears
so the lowest part of the elements are invisible.
I have tried lots of settings in the methods of the JList and JScrollPane classes
but the damn scrollbar refuses to appear!
Here is my current code in the method that initializes the JList:
/**
* This method initializes itemList
*
* @return javax.swing.JList
*/
private JList getItemList()
{
listModel = new DefaultListModel();
if (itemList == null)
{
itemList = new JList(listModel);
itemList.setBounds(new Rectangle(27, 83, 274, 242));
itemList.setLayoutOrientation(JList.VERTICAL);
itemList.setVisibleRowCount(-1);
listScroller = new JScrollPane();
listScroller.setViewportView(itemList);
listScroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL _SCROLLBAR_ALWAYS);
listScroller.setBounds(new Rectangle(27, 83, 274, 242));
// TEMP TEST:
listModel.addElement("foo bar foo bar 1");
listModel.addElement("foo bar foo bar 2");
listModel.addElement("foo bar foo bar 3");
.
.
listModel.addElement("foo bar foo bar 50");
itemList.revalidate();
}
return itemList;
}
If anybody could tell how to get the vertical scrollbar in the JList
then I would be very grateful and happy!
Thanks in advance!
SilentMajority
|
|
|
| Re: JScrollPane problem in VE [message #668080 is a reply to message #667335] |
Tue, 03 May 2011 12:25   |
Yves YANG Messages: 686 Registered: July 2009 |
Senior Member |
|
|
Hi,
I'd like you know VE is in maintenance stage since 2008. Insight of a new
coming WindowBuilder, this project will be archived. I recommand you to
switch on WindowsBuilder if it is possible. If you insists on the support of
VE, please contact me directly.
Best regards
Yves YANG
"Ulf" <het_post_punkt_com@hotmail.com> wrote in message
news:ipb6e3$lju$1@news.eclipse.org...
> Hi,
>
> I have a JFrame VE dialog with a JList.
> I need to fill the list after in has been initialized so I create the
> JList with a DefaultListModel object in the constructor.
> Then i add elements to the DefaultListModel object. The elements are
> displayed in the list, BUT no vertical scrollbar appears so the lowest
> part of the elements are invisible.
>
> I have tried lots of settings in the methods of the JList and JScrollPane
> classes
> but the damn scrollbar refuses to appear!
>
> Here is my current code in the method that initializes the JList:
>
> /**
> * This method initializes itemList * * @return javax.swing.JList */
> private JList getItemList() {
> listModel = new DefaultListModel();
> if (itemList == null) {
> itemList = new JList(listModel);
> itemList.setBounds(new Rectangle(27, 83, 274, 242));
> itemList.setLayoutOrientation(JList.VERTICAL);
> itemList.setVisibleRowCount(-1);
> listScroller = new JScrollPane();
> listScroller.setViewportView(itemList);
> listScroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL
> _SCROLLBAR_ALWAYS);
> listScroller.setBounds(new Rectangle(27, 83, 274, 242));
>
> // TEMP TEST:
> listModel.addElement("foo bar foo bar 1");
> listModel.addElement("foo bar foo bar 2");
> listModel.addElement("foo bar foo bar 3");
> .
> .
> listModel.addElement("foo bar foo bar 50"); itemList.revalidate();
> }
> return itemList;
> }
>
> If anybody could tell how to get the vertical scrollbar in the JList
> then I would be very grateful and happy!
>
> Thanks in advance!
> --
> SilentMajority
|
|
|
| Re: JScrollPane problem in VE [message #668087 is a reply to message #668080] |
Tue, 03 May 2011 13:18  |
Ulf Messages: 2 Registered: April 2011 |
Junior Member |
|
|
Hi Yves!
Thank you for the tip about WindowsBuilder. I am checking it out and it seems really cool!
However, if there is an easy solution to my scrollbar problem in VE I would be very glad to know about it, since I would need to deliver my GUI soon. I also have the same problem with missing scrollbars in a JTextArea.
If you know anyting about how to solve this in VE I would be very grateful.
You said I could contact you directly, but how do I find your mail address? I could not see it in your profile.
If you have time you could contact me on:
het_post_punkt_com@hotmail.com
(het_post_punkt_com *at* hotmail.com)
Thanks in advance!
Ulf
SilentMajority
[Updated on: Tue, 03 May 2011 13:20] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.01559 seconds