List of usage examples for javax.swing.event ListSelectionEvent getValueIsAdjusting
public boolean getValueIsAdjusting()
From source file:org.jimcat.gui.perspective.detail.DetailSideBar.java
/** * reacts on table-selection changes/*from w w w. j a v a 2 s. co m*/ * * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent) */ public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { // change current image ListSelectionModel model = (ListSelectionModel) e.getSource(); lastSelected = Math.max(model.getMinSelectionIndex(), 0); dirty = true; updateImage(); } }
From source file:org.kontalk.view.ThreadListView.java
ThreadListView(final View view, ThreadList threadList) { mView = view;// w ww . j a v a 2s .c o m mThreadList = threadList; this.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // right click popup menu mPopupMenu = new WebPopupMenu(); WebMenuItem editMenuItem = new WebMenuItem(Tr.tr("Edit Thread")); editMenuItem.setToolTipText(Tr.tr("Edit this thread")); editMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { ThreadItem t = ThreadListView.this.getSelectedItem(); JDialog editUserDialog = new EditThreadDialog(t); editUserDialog.setVisible(true); } }); mPopupMenu.add(editMenuItem); WebMenuItem deleteMenuItem = new WebMenuItem(Tr.tr("Delete Thread")); deleteMenuItem.setToolTipText(Tr.tr("Delete this thread")); deleteMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { String warningText = Tr.tr("Permanently delete all messages in this thread?"); int selectedOption = WebOptionPane.showConfirmDialog(ThreadListView.this, warningText, Tr.tr("Please Confirm"), WebOptionPane.OK_CANCEL_OPTION, WebOptionPane.WARNING_MESSAGE); if (selectedOption == WebOptionPane.OK_OPTION) { ThreadItem threadItem = ThreadListView.this.getSelectedItem(); mThreadList.delete(threadItem.mValue.getID()); } } }); mPopupMenu.add(deleteMenuItem); // actions triggered by selection this.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting()) return; mView.selectedThreadChanged(ThreadListView.this.getSelectedValue()); } }); // actions triggered by mouse events this.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { check(e); } @Override public void mouseReleased(MouseEvent e) { check(e); } private void check(MouseEvent e) { if (e.isPopupTrigger()) { int row = ThreadListView.this.rowAtPoint(e.getPoint()); ThreadListView.this.setSelectedItem(row); ThreadListView.this.showPopupMenu(e); } } }); this.updateOnEDT(null); }
From source file:org.monkeys.gui.matcher.MatcherPanel.java
private void wireEvents() { this.modifyPanel.addModifyMatchesListener(new ModifyMatchesListener() { @Override/* w w w. ja va 2 s .c o m*/ public void searchAndReplace(final Pattern search, final String replace) { searchAndReplaceSelected(search, replace); } @Override public void appendSuffix(final String text) { appendSuffixSelected(text); } @Override public void preappendPrefix(final String text) { preappendPrefixSelected(text); } }); this.matchingList.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(final ListSelectionEvent event) { if (!event.getValueIsAdjusting()) { matchingListSelected(event); } } }); this.matchingList.getModel().addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent e) { matchingListTableChanged(e); } }); }
From source file:org.nebulaframework.ui.swing.node.NodeMainUI.java
/** * Setup Job History Tab Pane/*w ww .j av a 2 s.c om*/ * * @return JPanel for History tab */ private JPanel setupHistory() { JPanel historyPanel = new JPanel(); historyPanel.setLayout(new BorderLayout(10, 10)); /* -- Job List -- */ JPanel jobListPanel = new JPanel(); historyPanel.add(jobListPanel, BorderLayout.CENTER); jobListPanel.setLayout(new BorderLayout(10, 10)); jobListPanel.setBorder(BorderFactory.createTitledBorder("Grid Jobs")); final JList jobList = new JList(historyList); JScrollPane jobListScroll = new JScrollPane(jobList); jobListPanel.add(jobListScroll, BorderLayout.CENTER); jobListScroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); jobListScroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); addUIElement("history.joblist", jobList); jobList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jobList.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { // Ignore intermediate events if (e.getValueIsAdjusting()) return; displayJobInfo(jobList.getSelectedValue()); } }); JPanel jobInfoPanel = new JPanel(); historyPanel.add(jobInfoPanel, BorderLayout.SOUTH); jobInfoPanel.setLayout(new BorderLayout(10, 10)); jobInfoPanel.setBorder(BorderFactory.createTitledBorder("Job Information")); JPanel centerPanel = new JPanel(); jobInfoPanel.add(centerPanel, BorderLayout.CENTER); centerPanel.setLayout(new GridLayout(0, 4, 10, 10)); JLabel jobIdLabel = new JLabel("GridJob ID :"); centerPanel.add(jobIdLabel); JLabel jobId = new JLabel("N/A"); centerPanel.add(jobId); addUIElement("history.jobid", jobId); // Add to components map JLabel jobNameLabel = new JLabel("GridJob Name :"); centerPanel.add(jobNameLabel); JLabel jobName = new JLabel("N/A"); centerPanel.add(jobName); addUIElement("history.jobname", jobName); // Add to components map JLabel startTimeLabel = new JLabel("Start Time :"); centerPanel.add(startTimeLabel); JLabel startTime = new JLabel("N/A"); centerPanel.add(startTime); addUIElement("history.starttime", startTime); // Add to components map JLabel durationLabel = new JLabel("Duration :"); centerPanel.add(durationLabel); JLabel duration = new JLabel("N/A"); centerPanel.add(duration); addUIElement("history.duration", duration); // Add to components map JLabel tasksLabel = new JLabel("Tasks Executed :"); centerPanel.add(tasksLabel); JLabel tasks = new JLabel("N/A"); centerPanel.add(tasks); addUIElement("history.tasks", tasks); // Add to components map JLabel failuresLabel = new JLabel("Failures :"); centerPanel.add(failuresLabel); JLabel failures = new JLabel("N/A"); centerPanel.add(failures); addUIElement("history.failures", failures); // Add to components map // Place Holders centerPanel.add(new JLabel()); centerPanel.add(new JLabel()); return historyPanel; }
From source file:org.nuclos.client.ui.collect.result.ResultController.java
private ListSelectionListener newListSelectionListener(final JTable tblResult) { return new ListSelectionListener() { @Override/*from w w w . j ava 2 s.co m*/ public void valueChanged(ListSelectionEvent ev) { try { final ListSelectionModel lsm = (ListSelectionModel) ev.getSource(); final CollectStateModel<?> clctstatemodel = clctctl.getCollectStateModel(); if (clctstatemodel.getOuterState() == CollectState.OUTERSTATE_RESULT) { final int iResultMode = CollectStateModel.getResultModeFromSelectionModel(lsm); if (iResultMode != clctctl.getCollectStateModel().getResultMode()) { clctctl.setCollectState(CollectState.OUTERSTATE_RESULT, iResultMode); } } if (!ev.getValueIsAdjusting()) { // Autoscroll selection. It's okay to do that here rather than in the CollectStateListener. if (!lsm.isSelectionEmpty() && tblResult.getAutoscrolls()) { // ensure that the last selected row is visible: final int iRowIndex = lsm.getLeadSelectionIndex(); final int iColIndex = tblResult.getSelectedColumn(); final Rectangle rectCell = tblResult.getCellRect(iRowIndex, iColIndex != -1 ? iColIndex : 0, true); if (rectCell != null) { tblResult.scrollRectToVisible(rectCell); } } } } catch (CommonBusinessException ex) { Errors.getInstance().showExceptionDialog(clctctl.getTab(), ex); } } // valueChanged }; }
From source file:org.omegat.gui.scripting.ScriptingWindow.java
private void initWindowLayout() { // set default size and position frame.setBounds(50, 80, 1150, 650);/* w w w .j av a 2 s. c om*/ StaticUIUtils.persistGeometry(frame, Preferences.SCRIPTWINDOW_GEOMETRY_PREFIX); frame.getContentPane().setLayout(new BorderLayout(0, 0)); m_scriptList = new JList<>(); JScrollPane scrollPaneList = new JScrollPane(m_scriptList); m_scriptList.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent evt) { if (!evt.getValueIsAdjusting()) { onListSelectionChanged(); } } }); m_scriptList.addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseMoved(MouseEvent e) { ListModel<ScriptItem> lm = m_scriptList.getModel(); int index = m_scriptList.locationToIndex(e.getPoint()); if (index > -1) { m_scriptList.setToolTipText(lm.getElementAt(index).getFile().getName()); } } }); m_txtResult = new JEditorPane(); JScrollPane scrollPaneResults = new JScrollPane(m_txtResult); //m_txtScriptEditor = new StandardScriptEditor(); m_txtScriptEditor = getScriptEditor(); m_txtScriptEditor.initLayout(this); JSplitPane splitPane1 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, m_txtScriptEditor.getPanel(), scrollPaneResults); splitPane1.setOneTouchExpandable(true); splitPane1.setDividerLocation(430); Dimension minimumSize1 = new Dimension(100, 50); //scrollPaneEditor.setMinimumSize(minimumSize1); scrollPaneResults.setMinimumSize(minimumSize1); JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scrollPaneList, splitPane1); splitPane.setOneTouchExpandable(true); splitPane.setDividerLocation(250); Dimension minimumSize = new Dimension(100, 50); scrollPaneList.setMinimumSize(minimumSize); scrollPaneResults.setMinimumSize(minimumSize); frame.getContentPane().add(splitPane, BorderLayout.CENTER); JPanel panelSouth = new JPanel(); FlowLayout fl_panelSouth = (FlowLayout) panelSouth.getLayout(); fl_panelSouth.setAlignment(FlowLayout.LEFT); frame.getContentPane().add(panelSouth, BorderLayout.SOUTH); setupRunButtons(panelSouth); frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); frame.setJMenuBar(createMenuBar()); }
From source file:org.ow2.aspirerfid.demos.warehouse.management.UI.WarehouseManagement.java
/** * Initialize the contents of the frame/* w ww . j a v a 2 s . c o m*/ */ private void initialize() { final JTabbedPane tabbedPane; final JPanel deliveryPanel; final JLabel entryDateLabel; final JLabel entryDateLabel_1; final JLabel entryDateLabel_2; final JLabel entryDateLabel_3; final JLabel entryDateLabel_3_1; final JLabel entryDateLabel_3_2; final JPanel shipmentPanel; final JLabel entryDateLabel_3_1_1; final JLabel entryDateLabel_3_1_2; final JScrollPane scrollPane; final JButton printReportButton; final JButton saveReportButton; final JButton activateDoorButton; final JButton deactivateDoorButton; final JButton clearReportButton; final JPanel panel; final JLabel entryDateLabel_3_3; final JLabel entryDateLabel_2_1; frame = new JFrame(); frame.getContentPane().setLayout(new BorderLayout()); frame.setTitle("Warehouse Management"); frame.setBounds(100, 100, 1011, 625); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); tabbedPane = new JTabbedPane(); frame.getContentPane().add(tabbedPane); deliveryPanel = new JPanel(); deliveryPanel.setLayout(null); tabbedPane.addTab("Delivery Counter", null, deliveryPanel, null); entryDateLabel = new JLabel(); entryDateLabel.setText("Entry Date ........."); entryDateLabel.setBounds(533, 23, 117, 16); deliveryPanel.add(entryDateLabel); entryDateLabel_1 = new JLabel(); entryDateLabel_1.setText("User ID ................"); entryDateLabel_1.setBounds(10, 94, 117, 16); deliveryPanel.add(entryDateLabel_1); entryDateLabel_2 = new JLabel(); entryDateLabel_2.setText("Invoice ID ............"); entryDateLabel_2.setBounds(10, 23, 117, 16); deliveryPanel.add(entryDateLabel_2); entryDateLabel_3 = new JLabel(); entryDateLabel_3.setText("Warehouse ID...."); entryDateLabel_3.setBounds(10, 45, 117, 16); deliveryPanel.add(entryDateLabel_3); entryDateLabel_3_1 = new JLabel(); entryDateLabel_3_1.setText("Zone ID ................"); entryDateLabel_3_1.setBounds(10, 67, 117, 16); deliveryPanel.add(entryDateLabel_3_1); entryDateLabel_3_2 = new JLabel(); entryDateLabel_3_2.setText("Entry Hour ........."); entryDateLabel_3_2.setBounds(533, 45, 117, 16); deliveryPanel.add(entryDateLabel_3_2); entryDateLabel_3_1_1 = new JLabel(); entryDateLabel_3_1_1.setText("Offering Date ...."); entryDateLabel_3_1_1.setBounds(533, 70, 117, 16); deliveryPanel.add(entryDateLabel_3_1_1); entryDateLabel_3_1_2 = new JLabel(); entryDateLabel_3_1_2.setText("Offering Hour ...."); entryDateLabel_3_1_2.setBounds(533, 94, 117, 16); deliveryPanel.add(entryDateLabel_3_1_2); invoiceIDTextField = new JTextField(); invoiceIDTextField.setBounds(105, 19, 365, 20); deliveryPanel.add(invoiceIDTextField); warehouseIDTextField = new JTextField(); warehouseIDTextField.setBounds(105, 43, 365, 20); deliveryPanel.add(warehouseIDTextField); zoneIDTextField = new JTextField(); zoneIDTextField.setBounds(105, 66, 365, 20); deliveryPanel.add(zoneIDTextField); userIDTextField = new JTextField(); userIDTextField.setBounds(105, 90, 365, 20); deliveryPanel.add(userIDTextField); entryDateTextField = new JTextField(); entryDateTextField.setBounds(623, 19, 365, 20); deliveryPanel.add(entryDateTextField); entryHourTextField = new JTextField(); entryHourTextField.setBounds(623, 41, 365, 20); deliveryPanel.add(entryHourTextField); offeringDateTextField = new JTextField(); offeringDateTextField.setBounds(623, 66, 365, 20); deliveryPanel.add(offeringDateTextField); offeringHourTextField = new JTextField(); offeringHourTextField.setBounds(623, 90, 365, 20); deliveryPanel.add(offeringHourTextField); scrollPane = new JScrollPane(); scrollPane.setBounds(10, 129, 978, 355); deliveryPanel.add(scrollPane); deliveryTableModel = new DefaultTableModel();// All Clients Items deliveryTableModel.addColumn("Company"); deliveryTableModel.addColumn("Item Code"); deliveryTableModel.addColumn("Description"); deliveryTableModel.addColumn("Quantity Delivered"); deliveryTableModel.addColumn("Expected Quantity"); deliveryTableModel.addColumn("Quantity Remain"); deliveryTableModel.addColumn("Delivery Date"); deliveryTableModel.addColumn("Measurement ID"); deliveryTableModel.addColumn("Quantity"); deliveryTable = new JTable(deliveryTableModel); deliveryTable.setFont(new Font("Arial Narrow", Font.PLAIN, 10)); deliveryTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); scrollPane.setViewportView(deliveryTable); ListSelectionModel rowSM = deliveryTable.getSelectionModel(); printReportButton = new JButton(); printReportButton.setText("Print Report"); printReportButton.setBounds(860, 520, 117, 26); deliveryPanel.add(printReportButton); saveReportButton = new JButton(); saveReportButton.setText("Save Report"); saveReportButton.setBounds(614, 520, 117, 26); deliveryPanel.add(saveReportButton); activateDoorButton = new JButton(); activateDoorButton.addMouseListener(new ActivateDoorButtonMouseListener()); activateDoorButton.setText("Activate Door"); activateDoorButton.setBounds(50, 520, 117, 26); deliveryPanel.add(activateDoorButton); deactivateDoorButton = new JButton(); deactivateDoorButton.addMouseListener(new DeactivateDoorButtonMouseListener()); deactivateDoorButton.setText("Dectivate Door"); deactivateDoorButton.setBounds(173, 520, 117, 26); deliveryPanel.add(deactivateDoorButton); clearReportButton = new JButton(); clearReportButton.addMouseListener(new ClearReportButtonMouseListener()); clearReportButton.setText("Clear Report"); clearReportButton.setBounds(737, 520, 117, 26); deliveryPanel.add(clearReportButton); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { // Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel) e.getSource(); if (lsm.isSelectionEmpty()) { // no rows are selected } else { selectedRow = lsm.getMinSelectionIndex(); System.out.println("selectedRow = " + selectedRow); } } }); shipmentPanel = new JPanel(); tabbedPane.addTab("Shipment", null, shipmentPanel, null); panel = new JPanel(); panel.setLayout(null); tabbedPane.addTab("Door Config", null, panel, null); aleListeningPortTextField = new JTextField(); aleListeningPortTextField.setText("9999"); aleListeningPortTextField.setBounds(172, 41, 330, 20); panel.add(aleListeningPortTextField); epcisRepositoryURLTextField = new JTextField(); epcisRepositoryURLTextField.setText("http://localhost:8080/aspire0.3.0EpcisRepository/capture"); epcisRepositoryURLTextField.setBounds(172, 65, 330, 20); panel.add(epcisRepositoryURLTextField); entryDateLabel_3_3 = new JLabel(); entryDateLabel_3_3.setText("EPCIS Rep. URL ........."); entryDateLabel_3_3.setBounds(51, 67, 117, 16); panel.add(entryDateLabel_3_3); entryDateLabel_2_1 = new JLabel(); entryDateLabel_2_1.setText("ALE Listening Port ...."); entryDateLabel_2_1.setBounds(51, 43, 117, 16); panel.add(entryDateLabel_2_1); }
From source file:org.owasp.jbrofuzz.payloads.PayloadsRowListener.java
/** * <p>//from www . jav a 2s. c om * Implemented for each row selected in the payloads table. * </p> * * @param event * ListSelectionEvent */ public void valueChanged(final ListSelectionEvent event) { if (event.getValueIsAdjusting()) { return; } String payload; final int d = payloadsPanel.payloadsTable.getSelectedRow(); try { payload = (String) payloadsPanel.payloadsTableModel.getValueAt(d, 0); } catch (final IndexOutOfBoundsException e) { return; } payloadsPanel.payloadInfoTextArea.setText("\nPayload Length: " + payload.length() + "\n\n" + "Is Numeric? " + StringUtils.isNumeric(payload) + "\n\n" + "Is Alpha? " + StringUtils.isAlpha(payload) + "\n\n" + "Has whitespaces? " + StringUtils.isWhitespace(payload) + "\n\n"); payloadsPanel.payloadInfoTextArea.setCaretPosition(0); }
From source file:org.panbox.desktop.common.gui.PanboxClientGUI.java
private void usersListValueChanged(javax.swing.event.ListSelectionEvent evt) {// GEN-FIRST:event_usersListValueChanged if (!evt.getValueIsAdjusting()) { // Object selection = usersList.getSelectedValue(); // TODO: Removing devices or contacts is not supported for now removeDeviceContactShareButton.setEnabled(false); // removeDeviceContactShareButton // .setEnabled((selection instanceof DeviceShareParticipant) // || (selection instanceof ContactShareParticipant // && shareList.getSelectedValue() != null && ((PanboxShare) // shareList // .getSelectedValue()).isOwner())); }// w ww.jav a 2s.c om }
From source file:org.pentaho.ui.xul.swing.tags.SwingListbox.java
public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting() == true || suppressEvents) { return;/*from w w w.ja va2 s .c om*/ } if (onselect != null && initialized) { invoke(onselect); } fireSetSelectedIndices(listBox.getSelectedIndices()); }