by Dinesh Thakur Category: AWT and Applets


import java.awt.*;

import javax.swing.*;
import java.awt.event.*;
public class JavaExampleDoubleListInJApplet extends JApplet implements MouseListener
      public void init()
           Container Cntnr = getContentPane();
           String[] Itms = {"Item One", "Item Two", "Item Three", "Item Four",
                                    "Item Five", "Item Six", "Item Seven", "Item Eight",
                                    "Item Nine", "Item Ten", "Item Eleven", "Item Twelve"};
           JList Lst=new JList(Itms);
           Cntnr.setLayout(new FlowLayout());
           Cntnr.add(new JScrollPane(Lst));
         public void mouseClicked(MouseEvent e1)
             JList JLst = (JList)e1.getSource();
             int index = JLst.locationToIndex(e1.getPoint());
             String s1 = (String)JLst.getSelectedValue();
             String OutStrng = new String("Number of clicks for item " +s1 + ": " + e1.getClickCount());
             public void mouseEntered(MouseEvent e) {}
             public void mouseExited(MouseEvent e) {}
             public void mousePressed(MouseEvent e) {}
             public void mouseReleased(MouseEvent e) {}
/*<APPLET CODE=JavaExampleDoubleListInJApplet.class WIDTH=310 HEIGHT=210 >\</APPLET>*/
DoubleList Java Example

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.

Search Content

Popular Article