Refine search
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); fontList.setVisibleRowCount(6); fontList.setSelectedIndex(0); fontScroll.setMinimumSize(new Dimension(220, fontList.getPreferredScrollableViewportSize().height)); 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)); effectsList = new JList(); effectsScroll.setViewportView(effectsList); effectsList.setModel(effectsListModel); effectsList.setVisibleRowCount(7); effectsScroll.setMinimumSize(effectsList.getPreferredScrollableViewportSize());
nearbyVertices = new JList<DisplayVertex>(); nearbyVertices.setVisibleRowCount(4); JScrollPane nvScrollPane = new JScrollPane(nearbyVertices); vertexDataPanel.add(nvScrollPane); nearbyVertices.addListSelectionListener(new ListSelectionListener() { outgoingEdges = new JList<Edge>(); outgoingEdges.setVisibleRowCount(4); JScrollPane ogeScrollPane = new JScrollPane(outgoingEdges); vertexDataPanel.add(ogeScrollPane); outgoingEdges.addListSelectionListener(edgeChanged); incomingEdges = new JList<Edge>(); JScrollPane iceScrollPane = new JScrollPane(incomingEdges); vertexDataPanel.add(iceScrollPane); incomingEdges.addListSelectionListener(edgeChanged);
constraints.anchor = GridBagConstraints.WEST; constraints.insets = new Insets(12, 12, 2, 12); p.add(l, constraints); control.setVisibleRowCount(15); control.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); constraints.weighty = 1.0; constraints.insets = new Insets(0, 12, 11, 11); p.add(new JScrollPane(control), constraints); constraints.gridy = 1; constraints.fill = GridBagConstraints.VERTICAL; p.add(bb, constraints);
JList list = new JList(); list.setVisibleRowCount(3);
public ListInput(String title, int numCols) { setLayout(null); setBorder(new EmptyBorder(5, 5, 5, 5)); label = new ListInputLabel(title, JLabel.LEFT); add(label); textfield = new ListInputText(numCols); textfield.addActionListener(this); label.setLabelFor(textfield); // NEW add(textfield); list = new ListInputList(); list.setVisibleRowCount(4); list.addListSelectionListener(this); scrollPane = new JScrollPane(list); add(scrollPane); }
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); fontList.setVisibleRowCount(6); fontList.setSelectedIndex(0); fontScroll.setMinimumSize(new Dimension(220, fontList.getPreferredScrollableViewportSize().height)); 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)); effectsList = new JList(); effectsScroll.setViewportView(effectsList); effectsList.setModel(effectsListModel); effectsList.setVisibleRowCount(7); effectsScroll.setMinimumSize(effectsList.getPreferredScrollableViewportSize());
list = new JList<String>(classesList); list.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); list.setLayoutOrientation(JList.VERTICAL_WRAP); list.setVisibleRowCount(-1); list.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { JScrollPane listScroller = new JScrollPane(list, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
private JList makeList(DefaultListModel listModel) { JList list = new JList(listModel); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.setVisibleRowCount(25); list.addListSelectionListener(this); return list; }
list = new JList(model); list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); list.setLayoutOrientation(JList.VERTICAL); list.setVisibleRowCount(-1); list.addMouseListener( new MouseAdapter() { JScrollPane listScroller = new JScrollPane(list); listScroller.setPreferredSize(new Dimension(400, 280)); JPanel listPane = new JPanel(); contentPane.add(listPane, BorderLayout.CENTER); contentPane.add(buttonPane, BorderLayout.PAGE_END);
feedbackSettingsList = new JList(listModel); //data has type Object[] feedbackSettingsList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); feedbackSettingsList.setLayoutOrientation(JList.VERTICAL); feedbackSettingsList.setVisibleRowCount(-1); feedbackSettingsList.setSelectedIndex(0); JScrollPane feedbackSettingsScroller = new JScrollPane(feedbackSettingsList); feedbackSettingsScroller.setMaximumSize(new Dimension(windowWidth, 180));
private JList makeList(DefaultListModel listModel) { JList list = new JList(listModel); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.setVisibleRowCount(25); list.addListSelectionListener(this); return list; }
frame.setLocationByPlatform(true); JList imageList = createImageList(); frame.getContentPane().add(new JScrollPane(imageList)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); JList imageList = new JList(createModel()); imageList.setCellRenderer(new ImageCellRenderer()); imageList.setLayoutOrientation(JList.HORIZONTAL_WRAP); imageList.setVisibleRowCount(-1); imageList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); imageList.setFixedCellWidth(240); imageLabel.setBorder(emptyBorder); descriptionLabel.setBorder(emptyBorder); add(imageLabel, BorderLayout.CENTER); add(descriptionLabel, BorderLayout.SOUTH);
private JComponent createPredictorVarListbox() { predictorVarListbox = new JList(new DefaultListModel()); predictorVarListbox.setVisibleRowCount(4); predictorVarListbox.setFixedCellWidth(100); predictorVarListbox.setSelectionMode( ListSelectionModel.SINGLE_SELECTION); predictorVarListbox.setSelectedIndex(0); return new JScrollPane(predictorVarListbox); }
JList list = new JList(...); list.setVisibleRowCount(5); JScrollPane scrollPane = new JScrollPane( list );
m.addElement(new Thumbnail(s)); JList<Thumbnail> list = new JList<>(m); list.getSelectionModel().setSelectionMode( ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); list.setVisibleRowCount(0); list.setFixedCellWidth(80); list.setFixedCellHeight(80); label.setForeground(isSelected? list.getSelectionForeground() : list.getForeground()); p.add(icon); p.add(label, BorderLayout.SOUTH); p.setBackground(isSelected? list.getSelectionBackground() : list.getBackground()); return new JScrollPane(list); JFrame f = new JFrame(); f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); f.getContentPane().add(new DragAndDropTest().makeUI()); f.setSize(320, 240); f.setLocationRelativeTo(null);
private JComponent createPredictorVarListbox() { predictorVarListbox = new JList(new DefaultListModel()); predictorVarListbox.setVisibleRowCount(4); predictorVarListbox.setFixedCellWidth(100); predictorVarListbox.setSelectionMode( ListSelectionModel.SINGLE_SELECTION); predictorVarListbox.setSelectedIndex(0); //JLabel listboxTitle = new JLabel(" Variables"); //scrollPane.setColumnHeaderView(listboxTitle); //listboxTitle.setBackground(Color.DARK_GRAY); return new JScrollPane(predictorVarListbox); }
public class NewGUIStuff { private JList list = new JList(); // Member of outer class so in scope from handlesListListeners public static void main(String args[]) { NewGUIStuff gui = new NewGUIStuff(); gui.go(); } class handlesListListeners implements ListSelectionListener { public void valueChanged(ListSelectionEvent lse) { list.setVisibleRowCount(4); } } }
import javax.swing.*; public class TestJLIst { public static void main(String[] args) { JList<String> list = new JList<>(new String[] {"A", "B", "C"}); list.setVisibleRowCount(5); JScrollPane scrollPane = new JScrollPane(list); JPanel panel = new JPanel(); panel.add(scrollPane); JOptionPane.showMessageDialog(null, panel); } }
private JScrollPane getRiskScroller() { if (riskScroller == null) { riskList = new JList<>(Alert.MSG_RISK); riskList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); riskList.setLayoutOrientation(JList.VERTICAL); riskList.setVisibleRowCount(Alert.MSG_RISK.length); riskScroller = new JScrollPane(riskList); } return riskScroller; }
public static void main(String[] args) { String[] ar = {"one", "two", "three"}; JList data = new JList(ar); data.setVisible(true); data.setVisibleRowCount(5); data.setPreferredSize(new Dimension(400,400)); data.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JScrollPane scroll = new JScrollPane(data); JFrame frame = new JFrame("StackOverflow Test"); frame.add(scroll); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setLocationRelativeTo(null); // to center frame.setVisible(true); }