by Dinesh Thakur Category: Swing


import java.awt.*;

import javax.swing.*;
import javax.swing.event.*;
public class JavaExampleListMultipleInJApplet extends JApplet implements ListSelectionListener
    JList Lst;
    public void init()
        Container Cntnr = getContentPane();
        String[] Itms = new String[12];
        for(int loop_indx = 0; loop_indx <= 11; loop_indx++)
                Itms[loop_indx] = "ITEM : " + loop_indx;
                Lst = new JList(Itms);
                JScrollPane ScrlPn = new JScrollPane(Lst);
                Cntnr.setLayout(new FlowLayout());
            public void valueChanged(ListSelectionEvent e1)
                int[] Indxs = Lst.getSelectedIndices();
                String OutStrng = "You Select:";
                for(int loop_indx = 0; loop_indx < Indxs.length; loop_indx++)
                      OutStrng += " ITEM " + Indxs[loop_indx];
/*<APPLET CODE=JavaExampleListMultipleInJApplet.class WIDTH=310 HEIGHT=210> </APPLET>*/

ListMultiple in Java Swing Example

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.C.A, 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.

Related Articles