Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » JScrollPane problem in VE(No scrollbar appears in a JList in a JFrame VE dialog.)
icon9.gif  JScrollPane problem in VE [message #667335] Thu, 28 April 2011 08:01 Go to next message
Ulf is currently offline UlfFriend
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 16:25 Go to previous messageGo to next message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
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 17:18 Go to previous message
Ulf is currently offline UlfFriend
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 17:20]

Report message to a moderator

Previous Topic:SWT Shell -> not drawn in Helios with VE 1.5 (NullPointerException)
Next Topic:GridBagLayout problems in VE 1.4 in fedora 11 eclipse (3.4.2)
Goto Forum:
  


Current Time: Tue Mar 19 04:58:58 GMT 2024

Powered by FUDForum. Page generated in 0.06751 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top