|
| hi gurus
I have a JList and i am adding JList to JScrollPane. But there are no
scroll bars for JList when i display the Jlist in the JFrame. I am able
access all the Jlist items moving arrow keys but i am not able to see
them. I dont know why srcoll bars are not being added to JList.
Vector tables_database = new Vector();
public JList tableList = new JList(tables_database);
public JScrollPane tableListScroll = new JScrollPane(tableList);
GridBagConstraints gbc = new GridBagConstraints();
setLayout(new GridBagLayout());
gbc = new GridBagConstraints();
tableList.setPreferredSize(new java.awt.Dimension(250, 100));
gbc.gridx = 0;
gbc.gridy = 1;
gbc.gridwidth = 3;
gbc.ipadx = 350;
gbc.ipady = 125;
gbc.anchor = gbc.NORTHWEST;
gbc.insets = new java.awt.Insets(0, 100, 0, 90 );
//tableListScroll.getViewport().add(tableList);
add(tableListScroll, gbc);
tableList.addListSelectionListener(new ListSelectionListener()
{
public void valueChanged(ListSelectionEvent lsEvent)
{
tableListValueChanged(lsEvent);
}
});
please help me with your suggestions
|
|