JScrollPane scrollPane = new JScrollPane(); JList list = new JList(); scrollPane.setViewportView(list);
JScrollPane fontScroll = new JScrollPane(); fontPanel.add(fontScroll, new GridBagConstraints(1, 1, 3, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); fontList = new JList(); fontScroll.setViewportView(fontList); fontList.setModel(fontListModel); samplePanel.setBorder(BorderFactory.createTitledBorder("Sample Text")); JScrollPane textScroll = new JScrollPane(); samplePanel.add(textScroll, new GridBagConstraints(0, 0, 4, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0)); getContentPane().add(rightSidePanel, new GridBagConstraints(1, 0, 1, 2, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); effectsPanel.setMinimumSize(new Dimension(210, 1)); effectsScroll = new JScrollPane(); effectsPanel.add(effectsScroll, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 5), 0, 0)); effectsList = new JList(); effectsScroll.setViewportView(effectsList); effectsList.setModel(effectsListModel);
private void createDebug() { frame = new JFrame("Smack Debug Window"); JList list = new JList(providers); iqProvidersPanel.add(new JScrollPane(list)); informationPanel.add(iqProvidersPanel); list = new JList(providers); extensionProvidersPanel.add(new JScrollPane(list)); informationPanel.add(extensionProvidersPanel); frame.getContentPane().add(tabbedPane);
JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.add(new TestPane()); list = new JList(); list.setDragEnabled(true); list.setTransferHandler(new ListTransferHandler());
public void showHistory() { if (historyDialog == null) { JList<PixelitorEdit> historyList = new JList<>(this); historyList.setSelectionModel(selectionModel); historyDialog = new JDialog(PixelitorWindow.getInstance(), "History", false); JPanel p = new HistoryPanel(this, historyList); historyDialog.getContentPane().add(p); historyDialog.setSize(200, 300); } if (!historyDialog.isVisible()) { GUIUtils.showDialog(historyDialog); } }
final JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); frame.setSize(500, 300); final DefaultListModel listModel = new DefaultListModel(); final JList panel = new JList(listModel); panel.setBackground(new Color(128, 0, 40)); panel.setForeground(new Color(240, 240, 240)); frame.add(panel); System.setProperty("java.net.preferIPv4Stack", "true"); final JChannel channel = new JChannel("udp.xml");
JScrollPane fontScroll = new JScrollPane(); fontPanel.add(fontScroll, new GridBagConstraints(1, 1, 3, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); fontList = new JList(); fontScroll.setViewportView(fontList); fontList.setModel(fontListModel); samplePanel.setBorder(BorderFactory.createTitledBorder("Sample Text")); JScrollPane textScroll = new JScrollPane(); samplePanel.add(textScroll, new GridBagConstraints(0, 0, 4, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0)); getContentPane().add(rightSidePanel, new GridBagConstraints(1, 0, 1, 2, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); effectsPanel.setMinimumSize(new Dimension(210, 1)); effectsScroll = new JScrollPane(); effectsPanel.add(effectsScroll, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 5), 0, 0)); effectsList = new JList(); effectsScroll.setViewportView(effectsList); effectsList.setModel(effectsListModel);
private void init() { model.addViewerModelListener(this); list = new JList(); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (list.getSelectedValue() != null) { model.selectNode((Node) list.getSelectedValue(), EvaluationResultsPanel.this); } } }); add(new JScrollPane(list), BorderLayout.CENTER); }
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setLocationRelativeTo(null); frame.setSize(800, 600); JList list = new JList(new Object[]{ "11", "22" }) { @Override public Dimension getPreferredSize() { return new Dimension(1000, 800); } }; frame.getContentPane().add(new JScrollPane(list), BorderLayout.CENTER); frame.setVisible(true); }
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new FlowLayout()); final JLabel label = new JLabel("Update"); String[] data = { "one", "two", "three", "four" }; final JList dataList = new JList(data); add(dataList); add(label); setVisible(true);
pane.add(rightPanel, BorderLayout.LINE_END); pathStates = new JList<State>(); JScrollPane stScrollPane = new JScrollPane(pathStates); stScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); rightPanelTabs.addTab("path states", stScrollPane); metadataList = new JList<String>(); metadataModel = new DefaultListModel<String>(); metadataList.setModel(metadataModel); JScrollPane mdScrollPane = new JScrollPane(metadataList); mdScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); rightPanelTabs.addTab("metadata", mdScrollPane); annotationMatches = new JList<GraphBuilderAnnotation>(); annotationMatches.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { JScrollPane amScrollPane = new JScrollPane(annotationMatches); amScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); rightPanelTabs.addTab("annotations", amScrollPane);
pane.setLayout(new GridLayout(0, 2)); firstStateData = new JList<String>(); secondStateData = new JList<String>(); firstComparePathStates = new JList<State>(); JScrollPane stScrollPane = new JScrollPane(firstComparePathStates); stScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); pane.add(stScrollPane); secondComparePathStates = new JList<State>(); stScrollPane = new JScrollPane(secondComparePathStates); stScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); pane.add(stScrollPane); stScrollPane = new JScrollPane(firstStateData); stScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); pane.add(stScrollPane);
public class ListView2 extends HobbyList { public ListView2() { super(); } public static void main(String...args) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ListView2 lv = new ListView2(); JList list = new JList(new Vector<String>(lv.hobbyArray)); frame.add(new JScrollPane(list)); frame.setSize(300, 200); frame.setVisible(true); } }
JFrame f = new JFrame("MultiLineList"); f.setResizable(true); f.setVisible(true); f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); f.getContentPane().setLayout(new BorderLayout()); model.addElement("This is an even longer text. This is an even longer text. This is an even longer text. This is an even longer text. This is an even longer text. This is an even longer text. This is an even longer text. This is an even longer text. This is an even longer text. This is an even longer text. This is an even longer text. This is an even longer text. This is an even longer text. This is an even longer text. This is an even longer text. This is an even longer text. This is an even longer text. This is an even longer text. This is an even longer text. This is an even longer text. This is an even longer text. This is an even longer text. "); final JList list = new JList(model); list.setCellRenderer(new MyCellRenderer()); f.add(list); f.pack(); IconPanel.add(l, BorderLayout.NORTH); p.add(IconPanel, BorderLayout.WEST); p.add(lt, BorderLayout.CENTER);
logText = new JTextPane(); logText.setEditable(false); JScrollPane logTextScroll = new JScrollPane(logText); logTextScroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); logPanel.setVisible(false); JScrollPane historyTableScrollPane = new JScrollPane(historyTable); historyButtonRemove = new JButton(rb.getString("remove")); historyButtonClear = new JButton(rb.getString("clear")); queuePanel.setPreferredSize(new Dimension(300, 250)); queueListModel = new DefaultListModel(); JList queueList = new JList(queueListModel); queueList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); queueList.addMouseListener(new QueueMenuMouseListener()); JScrollPane queueListScroll = new JScrollPane(queueList, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); gbc.gridy = 0; pane.add(ripPanel, gbc); gbc.gridy = 1; pane.add(statusPanel, gbc); gbc.gridy = 2; pane.add(progressPanel, gbc); gbc.gridy = 3; pane.add(optionsPanel, gbc); gbc.weighty = 1;
jp_center.setLayout(new GridLayout(1, 2)); String[] fontFamilyNames = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); jl_font = new JList<String>(fontFamilyNames); jl_font.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jl_font.addListSelectionListener(previewListner); JScrollPane jsp_font = new JScrollPane(jl_font); jsp_font.setPreferredSize(d); jp_center.add(jsp_font); String fontSizes[] = { "8", "10", "11", "12", "14", "16", "18", "20", "24", "30", "36", "40", "48", "60", "72" }; jl_fontSize = new JList<String>(fontSizes); jl_fontSize.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jl_fontSize.addListSelectionListener(previewListner); JScrollPane jsp_fontSize = new JScrollPane(jl_fontSize); jsp_fontSize.setPreferredSize(d); jp_center.add(jsp_fontSize);
public static void main(String[] args) { List<String> values = Arrays.asList("A", "B", "C"); JList list = new JList(new AbstractListModel() { public int getSize() { return values.size(); } public Object getElementAt(int index) { return index + " - " + values.get(index); } }); list.addListSelectionListener(e -> System.out.println("Clicked " + list.getSelectedValue())); JFrame frame = new JFrame("List Test"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(list); frame.pack(); frame.setVisible(true); }
String[] nameList = {"Mario", "Luigi", "Bowser", "Koopa", "Princess"}; imageMap = createImageMap(nameList); JList list = new JList(nameList); list.setCellRenderer(new MarioListRenderer()); JScrollPane scroll = new JScrollPane(list); scroll.setPreferredSize(new Dimension(300, 400)); JFrame frame = new JFrame(); frame.add(scroll); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true);
Collections.sort(ids); final FilterableListModel listModel = new FilterableListModel(ids); final JList list = new JList(listModel); JScrollPane selectGraphPane = new JScrollPane(list); selectGraphPane.setPreferredSize(new Dimension(500, 500)); contentPane.add(searchField, BorderLayout.PAGE_START); contentPane.add(selectGraphPane, BorderLayout.CENTER); contentPane.add(buttonPane, BorderLayout.PAGE_END);
final JList fileList = new JList(new Vector<>(files)); fileList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); MouseListener mouseListener = new MouseAdapter() { fileList.addMouseListener(mouseListener); final JScrollPane scroll = new JScrollPane(fileList);