-
Help with Scrollable JList
Hi All,
I know this is probably a non-standard implementation, but for some reason
I cannot get my scrollpane to take effect. I just get a JList with no scrolling
capability. Thanks for your help!
public class IwovSQLForm extends JFrame implements ActionListener//implements
ListSelectionListener
{
private IwovSQLClass sqlClass;
private JList sqlList;
private JScrollPane pane;
/** Use this constructor when calling as Callout */
public IwovSQLForm(IwovSQLClass sqlClass){
this.sqlClass = sqlClass;
this.setTitle("TeamSite SQL Form");
this.setResizable(false);
//this.setDefaultCloseOperation(javax.swing.JFrame.DO_NOTHING_ON_CLOSE);
this.getContentPane().setLayout(new BorderLayout(0,0));
this.setSize(497,321);
this.init();
this.show();
}
/** Set the Frame Title
*/
public IwovSQLForm(String sTitle)
{
this();
setTitle(sTitle);
}
// default constructor
public IwovSQLForm(){}
private void init(){
JPanel p = new JPanel();
JLabel grayBar = new JLabel();
JLabel calloutFieldTitle = new JLabel();
JLabel calloutFieldLabel = new JLabel();
//JLabel iwovIcon = new JLabel("hello", new ImageIcon("http://jsantorolns/iw-icons/newtslogo.gif"),
JLabel.CENTER);
// JLabel iwovIcon = new JLabel("Label", new ImageIcon("newtslogo.gif"),
JLabel.CENTER);
p.setLayout(null);
p.setBackground(java.awt.Color.white);
p.setBounds(0,0,497,321);
calloutFieldTitle.setText("Callout Field:");
calloutFieldTitle.setOpaque(true);
p.add(calloutFieldTitle, BorderLayout.NORTH);
calloutFieldTitle.setForeground(java.awt.Color.black);
calloutFieldTitle.setBackground(java.awt.Color.lightGray);
calloutFieldTitle.setFont(new Font("Dialog", Font.BOLD, 11));
calloutFieldTitle.setBounds(8,25,72,16);
calloutFieldLabel.setText(this.sqlClass.getThisLeafName());
calloutFieldLabel.setOpaque(true);
p.add(calloutFieldLabel);
calloutFieldLabel.setForeground(java.awt.Color.black);
calloutFieldLabel.setBackground(java.awt.Color.lightGray);
calloutFieldLabel.setFont(new Font("Dialog", Font.PLAIN, 11));
calloutFieldLabel.setBounds(84,25,300,16);
try
{
URL tslogo = new URL("http://64.19.155.189/iw-icons/newtslogo.gif");
JLabel iwovIcon = new JLabel("", new ImageIcon(tslogo), JLabel.CENTER);
iwovIcon.setOpaque(true);
p.add(iwovIcon);
iwovIcon.setForeground(java.awt.Color.black);
iwovIcon.setBackground(java.awt.Color.lightGray);
iwovIcon.setBounds(400,4,88,60);
}
catch (MalformedURLException e)
{
//nothing
}
grayBar.setOpaque(true);
p.add(grayBar, BorderLayout.NORTH);
grayBar.setBackground(java.awt.Color.lightGray);
grayBar.setBounds(0,0,497,68);
this.sqlList = new JList(fillDropDownList());
sqlList.setSelectedIndex(0);
sqlList.setBounds(144,75,192,150);
sqlList.setAlignmentX(200);
sqlList.setAlignmentY(70);
sqlList.setOpaque(true);
sqlList.setBackground(java.awt.Color.lightGray);
sqlList.setBorder(BorderFactory.createLoweredBevelBorder());
this.pane = new JScrollPane(sqlList);
JButton JButtonCallBack = new JButton();
p.add(this.sqlList);
p.add(this.pane);
//sqlList.setSelectionMode(MULTIPLE_INTERVAL_SELECTION);
JButtonCallBack.setText("OK");
p.add(JButtonCallBack);
JButtonCallBack.setBounds(176,230,132,41);
JButtonCallBack.addActionListener(this);
this.getContentPane().add(p);
//this.getContentPane().add(BorderLayout.CENTER, p);
}
-
Re: Help with Scrollable JList
Here's your problem:
p.add(this.sqlList);
p.add(this.pane);
Remove the first of these two lines. Your "pane" component already contains
"sqlList" and will be responsible for displaying it.
PC2
Jason <jc_flyfish@yahoo.com> wrote in message
news:3a92c2b3$1@news.devx.com...
>
> Hi All,
>
> I know this is probably a non-standard implementation, but for some reason
> I cannot get my scrollpane to take effect. I just get a JList with no
scrolling
> capability. Thanks for your help!
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks