Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lists

Status
Not open for further replies.

apffal

Technical User
Apr 10, 2004
97
PT
Two questions about lists :
I cannot make visible an awt.list with list.setVisible(true).
What's wrong ?
Is it possible add two, or more, columns to an awt.list ?
If yes, how to do it ?
Thanks.
 
Code:
import java.awt.*;
class mylist2 extends Frame
      {
       List list;
       public mylist2()
              {
               super("list demo"); 
               setLayout(new BorderLayout()); 
               list = new List(5);     
 list.add("Mercury");
 list.add("Venus");
 list.add("Earth");
 list.add("JavaSoft");
 list.add("Mars");
 add(list,BorderLayout.NORTH);
 //Components are initially visible, with the exception of top level components such as Frame objects
              }
       public static void main(String args[])
              {
               mylist2 mylist2Obj = new mylist2();
               mylist2Obj.setSize(400,400);
               mylist2Obj.setVisible(true);
              }
      }
//I think you cannot add multilple columns to list, you want to diplay something in table or grid ? use JTable in Swing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top