List display in java AWT:This simple tutorial code is used to create the list of elements in a sequence method. This operation can be done using the various java layouts and AWT event class. Engineering students can use this program for their lab manual. An example source code is given below.
LIST DISPLAY IN JAVA
List display in java, for example take a fruit list demo first. We can enter the variety of fruit names and press add button to add the entered list. It is useful for displaying the available fruits list in a super market for panel board. If particular fruit is not in the stock means, it is easy to remove that fruit from list with the use of list display. Like vise this program will perform the operations.
[Useful: C Program Tutorials] & [IT Companies Details]
Java AWT list example:
//Import statements import java.awt.*; import java.awt.event.*; //Class definition class FruitsDemo extends Frame implements ActionListener { //Variable declaration Label la1; Button bu1; TextField te1; List l; public FruitsDemo() { setTitle("Fruits Demo"); la1=new Label("Enter a fruit: "); te1=new TextField(10); bu1=new Button("Add"); l=new List(6); b1.addActionListener(this); setLayout(new FlowLayout()); add(la1); add(te1); add(t); add(bu1); setSize(200,200); setLocation(200,200); setVisible(true); } public void actionPerformed(ActionEvent e) { t.add(te1.getText()); te1.setText(" "); te1.requestFocus(); } public static void main(String args[]) { new FruitsDemo(); } }
SEE: All Examination Results & News