public DFAPanel() { super(); setLayout(new BorderLayout()); JPanel leftPanel = new JPanel(); nodeList = new JList(nodes); nodeList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); nodeList.setFixedCellWidth(150); nodeList.setBorder(BorderFactory.createLineBorder(Color.black)); nodeList.addListSelectionListener(this); leftPanel.add(nodeList); add(leftPanel, BorderLayout.WEST); dfaCanvas = new DFACanvas(); dfaCanvas.setBackground(Color.WHITE); dfaCanvas.setPreferredSize(new Dimension(900, 1400)); JScrollPane scrollPane = new JScrollPane(dfaCanvas); add(scrollPane, BorderLayout.CENTER); }
@Override public void valueChanged(ListSelectionEvent ev) { PathPrinter pp = ((PathPrinter) pathsList.getSelectedValue()); if(pp==null){ return; } GraphPath path = pp.gp; DefaultListModel<State> pathModel = new DefaultListModel<State>(); for( State st : path.states ){ pathModel.addElement( st ); } pathStates.setModel( pathModel ); showGraph.highlightGraphPath(path); }
public void selectNextMatch() { int idx = Math.min(list.getModel().getSize() - 1, list.getSelectedIndex() + 1); list.setSelectedIndex(idx); }
private static void scrollToSelection(JList list) { int selectedRow = list.getSelectedIndex(); if (selectedRow >= 0) { list.scrollRectToVisible(list.getCellBounds(selectedRow, 0)); } }
public void selectPreviousMatch() { int idx = Math.max(0, list.getSelectedIndex() - 1); list.setSelectedIndex(idx); }
JPanel fontPanel = new JPanel(); JScrollPane fontScroll = new JScrollPane(); fontList = new JList(); fontScroll.setViewportView(fontList); fontList.setModel(fontListModel); fontList.setVisibleRowCount(6); fontList.setSelectedIndex(0); fontScroll.setMinimumSize(new Dimension(220, fontList.getPreferredScrollableViewportSize().height)); browseButton = new JButton("..."); browseButton.setMargin(new Insets(0, 0, 0, 0)); sampleNeheButton = new JButton(); 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)); effectsList = new JList(); effectsScroll.setViewportView(effectsList); effectsList.setModel(effectsListModel); effectsList.setVisibleRowCount(7); effectsScroll.setMinimumSize(effectsList.getPreferredScrollableViewportSize());
private void initializeComponent() { JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); getRootPane().setLayout(new BorderLayout()); getRootPane().add(panel, BorderLayout.CENTER); workItemsList = new JList(); workItemsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); workItemsList.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { workItemsList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { selectButton.setEnabled(getSelectedWorkItem() != null); c.fill = GridBagConstraints.BOTH; c.insets = new Insets(5, 5, 5, 5); panel.add(workItemsList, c); selectButton = new JButton("Select"); selectButton.setEnabled(false); selectButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { select();
JPanel ripPanel = new JPanel(new GridBagLayout()); ripPanel.setBorder(emptyBorder); gbc.gridx = 0; ripPanel.add(new JLabel("URL:", JLabel.RIGHT), gbc); gbc.weightx = 1; gbc.weighty = 1; logText = new JTextPane(); logText.setEditable(false); JScrollPane logTextScroll = new JScrollPane(logText); logTextScroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); JScrollPane historyTableScrollPane = new JScrollPane(historyTable); queueListModel = new DefaultListModel(); JList queueList = new JList(queueListModel); queueList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); queueList.addMouseListener(new QueueMenuMouseListener()); JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); for (String item : Utils.getConfigList("queue")) { queueListModel.addElement(item); gbc.gridy = 0; pane.add(ripPanel, gbc); gbc.gridy = 1; pane.add(statusPanel, gbc); gbc.gridy = 2; pane.add(progressPanel, gbc);
JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(this); final JButton setButton = new JButton("Select"); setButton.setActionCommand("Select"); setButton.addActionListener(this); getRootPane().setDefaultButton(setButton); model = new DefaultListModel(); list = new JList(model); list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); list.setLayoutOrientation(JList.VERTICAL); list.setVisibleRowCount(-1); list.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { contentPane.add(listPane, BorderLayout.CENTER); contentPane.add(buttonPane, BorderLayout.PAGE_END);
private void createDebug() { frame = new JFrame("Smack Debug Window"); frame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent evt) { JPanel informationPanel = new JPanel(); informationPanel.setLayout(new BoxLayout(informationPanel, BoxLayout.Y_AXIS)); JPanel versionPanel = new JPanel(); versionPanel.setLayout(new BoxLayout(versionPanel, BoxLayout.X_AXIS)); versionPanel.setMaximumSize(new Dimension(2000, 31)); 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); frame.setSize(650, 400);
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)); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { @Override JPanel buttonPane = new JPanel(); buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS)); buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10)); buttonPane.add(Box.createHorizontalGlue()); buttonPane.add(apply); contentPane.add(searchField, BorderLayout.PAGE_START); contentPane.add(selectGraphPane, BorderLayout.CENTER); contentPane.add(buttonPane, BorderLayout.PAGE_END);
DefaultListModel searchResultListModel = new DefaultListModel(); DefaultListSelectionModel searchResultSelectionModel = new DefaultListSelectionModel(); searchResultSelectionModel Container contentPane = mainFrame.getContentPane(); JPanel searchInputPanel = new JPanel(); searchInputPanel.setLayout(new BorderLayout()); searchInputPanel.add(searchField, BorderLayout.CENTER); searchField.addActionListener(searchPersonAction); searchInputPanel.add(searchButton, BorderLayout.EAST); JList searchResultList = new JList(); searchResultList.setModel(searchResultListModel); searchResultList.setSelectionModel(searchResultSelectionModel); JPanel searchResultPanel = new JPanel(); JPanel selectionOptionsPanel = new JPanel(); JButton showPersonDetailsButton = new JButton(personDetailsAction); selectionOptionsPanel.add(showPersonDetailsButton); mainFrame.setVisible(true);
private Container makeDiffTab() { JPanel pane = new JPanel(); 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); firstComparePathStates.addListSelectionListener(new ComparePathStatesClickListener(firstStateData)); secondComparePathStates = new JList<State>(); stScrollPane = new JScrollPane(secondComparePathStates); stScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); pane.add(stScrollPane); secondComparePathStates.addListSelectionListener(new ComparePathStatesClickListener(secondStateData)); JButton dominateButton = new JButton(); dominateButton.setText("dominates"); dominateButton.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e) {
public OptionsFontPanel(){ JPanel jp = this; jp.setLayout(new BorderLayout()); JPanel jp_north = new JPanel(); jp_north.setLayout(new FlowLayout(FlowLayout.LEFT)); JLabel jl = new JLabel("Font for Request Body & Response Body"); jp_north.add(jl); jb_default.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { 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);
javax.swing.JPanel jPanel3 = new javax.swing.JPanel(); newKeywordField = new javax.swing.JTextField(); addButton = new javax.swing.JButton(); javax.swing.JPanel jPanel1 = new javax.swing.JPanel(); connectionStatusLabel = new javax.swing.JLabel(); startStopButton = new javax.swing.JButton(); javax.swing.JScrollPane jScrollPane2 = new javax.swing.JScrollPane(); messagesArea = new javax.swing.JTextArea(); javax.swing.JPanel jPanel2 = new javax.swing.JPanel(); javax.swing.JScrollPane jScrollPane1 = new javax.swing.JScrollPane(); keywordList = new javax.swing.JList(); jPanel4 = new javax.swing.JPanel(); twitterCheckbox = new javax.swing.JCheckBox(); addButton.setText("Add"); addButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { messagesArea.setWrapStyleWord(true); messagesArea.setFocusable(false); jScrollPane2.setViewportView(messagesArea); jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder()); keywordList.setModel(keywordListModel); jScrollPane1.setViewportView(keywordList);
private void initRightPanel(Container pane) { rightPanel.add(rightPanelTabs, BorderLayout.LINE_END); pathStates = new JList<State>(); JScrollPane stScrollPane = new JScrollPane(pathStates); stScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); rightPanelTabs.addTab("path states", stScrollPane); pathStates.addListSelectionListener(new ListSelectionListener(){ @Override public void valueChanged(ListSelectionEvent e) { 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) { @SuppressWarnings("unchecked") annotationMatchesModel = new DefaultListModel<GraphBuilderAnnotation>(); annotationMatches.setModel(annotationMatchesModel); JScrollPane amScrollPane = new JScrollPane(annotationMatches); amScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
public static void main(String[] args) { DefaultListModel m = new DefaultListModel(); for (int i = 0; i < 5000; i++) { m.addElement("X" + i); } CheckList list = new CheckList(new JList(m)); JFrame f = new JFrame(); f.getContentPane().setLayout(new BorderLayout()); f.getContentPane().add(new JScrollPane(list)); f.setVisible(true); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } }
JPanel contentPanel = getContentPanel(); JPanel buttonsPanel = new JPanel(new GridLayout(3, 1)); contentPanel.add(buttonsPanel, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); JButton addButton = new JButton("Add"); buttonsPanel.add(addButton); addButton.addActionListener(new ActionListener() { public void actionPerformed (ActionEvent event) { FileDialog dialog = new FileDialog(editor, "Open Image", FileDialog.LOAD); JButton defaultButton = new JButton("Default"); buttonsPanel.add(defaultButton); defaultButton.addActionListener(new ActionListener() { contentPanel.add(imagesPanel, new GridBagConstraints(2, 0, 1, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); imageListModel = new DefaultListModel<String>(); imageList = new JList<String>(imageListModel); imageList.setFixedCellWidth(250); imageList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); imagesPanel.add(imageList, new GridBagConstraints(0, 0, 1, 3, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
JList<Thumbnail> list = new JList<>(m); list.getSelectionModel().setSelectionMode( ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); list.setTransferHandler(new ListItemTransferHandler()); list.setDropMode(DropMode.INSERT); list.setDragEnabled(true); list.setLayoutOrientation(JList.HORIZONTAL_WRAP); list.setVisibleRowCount(0); list.setFixedCellWidth(80); list.setFixedCellHeight(80); list.setBorder(BorderFactory.createEmptyBorder(10,10,10,10)); list.setCellRenderer(new ListCellRenderer<Thumbnail>() { private final JPanel p = new JPanel(new BorderLayout()); private final JLabel icon = new JLabel((Icon)null, JLabel.CENTER); private final JLabel label = new JLabel("", JLabel.CENTER); icon.setIcon(value.icon); label.setText(value.name); label.setForeground(isSelected? list.getSelectionForeground() : list.getForeground()); p.add(icon); p.add(label, BorderLayout.SOUTH); p.setBackground(isSelected? list.getSelectionBackground() : list.getBackground()); return p; @Override protected Transferable createTransferable(JComponent c) {
scrollPane = new JScrollPane(jList1); scrollPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); final JPanel south = new JPanel(new BorderLayout()); final JLabel labelFileExtensions = new JLabel("File extensions: "); extensions.setText(getExtensions()); BorderFactory.createEtchedBorder()); border = BorderFactory.createCompoundBorder(border, BorderFactory.createEmptyBorder(5, 5, 5, 5)); south.setBorder(border); south.add(labelFileExtensions, BorderLayout.WEST); south.add(extensions, BorderLayout.CENTER); south.add(changeDirButton, BorderLayout.SOUTH); getContentPane().add(south, BorderLayout.SOUTH); getContentPane().add(scrollPane, BorderLayout.CENTER); jList1.addMouseListener(mouseListener); changeDirButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.err.println("Opening Directory Window"); jList1.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) {