List of usage examples for javax.swing JList JList
public JList()
JList
with an empty, read-only, model. From source file:Main.java
public static void main(String[] argv) throws Exception { JList list = new JList(); JScrollPane scrollableList = new JScrollPane(list); }
From source file:Main.java
public static void main(String[] argv) throws Exception { JList list = new JList(); // Register a list data listener DefaultListModel model = (DefaultListModel) list.getModel(); model.addListDataListener(new MyListDataListener()); }
From source file:Main.java
public static void main(final String args[]) { String labels[] = { "A", "B", "C", "D", "E" }; JFrame frame = new JFrame("Sizing Samples"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JList jlist1 = new JList(); jlist1.setListData(labels);/*from w w w. jav a 2s .c o m*/ jlist1.setVisibleRowCount(4); JScrollPane scrollPane1 = new JScrollPane(jlist1); frame.add(scrollPane1, BorderLayout.NORTH); Object o = jlist1.getPrototypeCellValue(); frame.setSize(300, 350); frame.setVisible(true); }
From source file:Main.java
public static void main(final String args[]) { String labels[] = { "A", "B", "C", "D", "E" }; JFrame frame = new JFrame("Sizing Samples"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JList jlist1 = new JList(); jlist1.setListData(labels);/* ww w . j a v a 2 s . c om*/ jlist1.setVisibleRowCount(4); JScrollPane scrollPane1 = new JScrollPane(jlist1); frame.add(scrollPane1, BorderLayout.NORTH); int mode = jlist1.getSelectionMode(); frame.setSize(300, 350); frame.setVisible(true); }
From source file:Main.java
public static void main(final String args[]) { String labels[] = { "A", "B", "C", "D", "E" }; JFrame frame = new JFrame("Sizing Samples"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JList jlist1 = new JList(); jlist1.setListData(labels);//from w w w . j ava2s . com jlist1.setVisibleRowCount(4); JScrollPane scrollPane1 = new JScrollPane(jlist1); frame.add(scrollPane1, BorderLayout.NORTH); int i = jlist1.getAnchorSelectionIndex(); frame.setSize(300, 350); frame.setVisible(true); }
From source file:Main.java
public static void main(final String args[]) { String labels[] = { "A", "B", "C", "D", "E" }; JFrame frame = new JFrame("Sizing Samples"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JList jlist1 = new JList(); jlist1.setListData(labels);//from ww w. j a va 2s . c o m jlist1.setVisibleRowCount(4); JScrollPane scrollPane1 = new JScrollPane(jlist1); frame.add(scrollPane1, BorderLayout.NORTH); jlist1.getLeadSelectionIndex(); frame.setSize(300, 350); frame.setVisible(true); }
From source file:Main.java
public static void main(final String args[]) { String labels[] = { "A", "B", "C", "D", "E" }; JFrame frame = new JFrame("Sizing Samples"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JList jlist1 = new JList(); jlist1.setListData(labels);/*from ww w . j a v a 2 s . c om*/ jlist1.setVisibleRowCount(4); JScrollPane scrollPane1 = new JScrollPane(jlist1); frame.add(scrollPane1, BorderLayout.NORTH); jlist1.setSelectedIndices(new int[] { 1, 2 }); frame.setSize(300, 350); frame.setVisible(true); }
From source file:Main.java
public static void main(final String args[]) { String labels[] = { "A", "B", "C", "D", "E" }; JFrame frame = new JFrame("Sizing Samples"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JList jlist1 = new JList(); jlist1.setListData(labels);/*from w w w . j a va2 s. co m*/ jlist1.setVisibleRowCount(4); JScrollPane scrollPane1 = new JScrollPane(jlist1); frame.add(scrollPane1, BorderLayout.NORTH); Dimension m = jlist1.getPreferredScrollableViewportSize(); frame.setSize(300, 350); frame.setVisible(true); }
From source file:Main.java
public static void main(final String args[]) { String labels[] = { "A", "B", "C", "D", "E" }; JFrame frame = new JFrame("Sizing Samples"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JList jlist1 = new JList(); jlist1.setListData(labels);/*from www. j a v a 2s . c o m*/ jlist1.setVisibleRowCount(4); JScrollPane scrollPane1 = new JScrollPane(jlist1); frame.add(scrollPane1, BorderLayout.NORTH); Rectangle r = jlist1.getCellBounds(0, 1); frame.setSize(300, 350); frame.setVisible(true); }
From source file:Main.java
public static void main(final String args[]) { String labels[] = { "A", "B", "C", "D", "E" }; JFrame frame = new JFrame("Sizing Samples"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JList jlist1 = new JList(); jlist1.setListData(labels);/*from ww w . j av a 2 s . c o m*/ jlist1.setVisibleRowCount(4); JScrollPane scrollPane1 = new JScrollPane(jlist1); frame.add(scrollPane1, BorderLayout.NORTH); ListModel m = jlist1.getModel(); frame.setSize(300, 350); frame.setVisible(true); }