Java Code Examples for javax.swing.event.ChangeEvent#getSource()
The following examples show how to use
javax.swing.event.ChangeEvent#getSource() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MemberListModel.java From stendhal with GNU General Public License v2.0 | 6 votes |
@Override public void stateChanged(ChangeEvent e) { final Object source = e.getSource(); if (source instanceof Member) { /* * HP changes can come from the game loop. Resizes also result * in ratio changes, and they come from EDT, but we can ignore * those as they result in redraws anyway. */ if (!SwingUtilities.isEventDispatchThread()) { memberChanged((Member) source); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { memberChanged((Member) source); } }); } } }
Example 2
Source File: NodeFactorySupport.java From netbeans with Apache License 2.0 | 6 votes |
public void stateChanged(final ChangeEvent e) { final Runnable action = new Runnable() { public void run() { NodeList list = (NodeList) e.getSource(); List objects = list.keys(); synchronized (keys) { removeKeys(list); addKeys(list, objects); } final Collection<NodeListKeyWrapper> ks = createKeys(); NodeFactorySupport.createWaitNode(); EventQueue.invokeLater(new RunnableImpl(DelegateChildren.this, ks)); } }; if (ProjectManager.mutex().isReadAccess() || ProjectManager.mutex().isWriteAccess()) { //having lock (non blocking) action.run(); } else { //may block for > 10s when waiting on project save RP.post(action); } }
Example 3
Source File: JavaFileFilterListener.java From netbeans with Apache License 2.0 | 6 votes |
@Override public void stateChanged(final ChangeEvent event) { Map.Entry<URL,JavaFileFilterImplementation>[] entries; synchronized (this.listensOn) { entries = listensOn.entrySet().toArray(new Map.Entry[listensOn.size()]); } final Object source = event.getSource(); for (Map.Entry<URL,JavaFileFilterImplementation> entry : entries) { if (entry.getValue().equals(source)) { final URL root = entry.getKey(); try { verify(root); } catch (IOException ioe) { Exceptions.printStackTrace(ioe); } catch (URISyntaxException use) { Exceptions.printStackTrace(use); } finally { IndexingManager.getDefault().refreshIndex(root, null, true); } } } }
Example 4
Source File: SimmToOpenSimOptionsJPanel.java From opensim-gui with Apache License 2.0 | 6 votes |
public void stateChanged(ChangeEvent e) { // Listen to jnt file name change Object obj = e.getSource(); if (obj instanceof FileTextFieldAndChooser){ if (obj.equals(jntfileTextFieldAndChooser)){ // If a non empty string is available in the jOpenSimFilenameTextField try to use it, otherwsie makeup one. String jntFilename= getJointFilename(); if (jntFilename==null || !jntfileTextFieldAndChooser.getFileIsValid()) return; // Here we have a real jnt file, make up a name for the .osim file if none specified File f = new File(jntFilename); String candidateName = getUniqueOsimFilenameForJntFile(f); // Here we know we have a valid name, show the name as default jOpenSimFilenameTextField.setText(candidateName); } } }
Example 5
Source File: ServerRegistryTest.java From netbeans with Apache License 2.0 | 6 votes |
public void stateChanged(ChangeEvent e) { final ServerRegistry registry = (ServerRegistry) e.getSource(); List<ServerInstance> current = new ArrayList<ServerInstance>(); for (ServerInstanceProvider provider : registry.getProviders()) { current.addAll(provider.getInstances()); } List<ServerInstance> expected = steps.get(stepIndex++); assertEquals(expected.size(), current.size()); for (ServerInstance instance : expected) { current.remove(instance); } assertTrue(current.isEmpty()); }
Example 6
Source File: SymbolRipper.java From libreveris with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void stateChanged (ChangeEvent e) { JSpinner s = (JSpinner) e.getSource(); if (s == fontName.getSpinner()) { // New font name defineFont(); } else { if (s == fontBase) { // New font base changeCode(); } else if (s == fontSize.getSpinner()) { // New font size defineFont(); } else if (s == pointCode.getSpinner()) { // New point code changeCode(); } else if (s == hexaCode.getSpinner()) { // New hexa point code changeHexaCode(); } else if ((s == xOffset.getSpinner()) || (s == yOffset.getSpinner())) { // New drawing offset } else if ((s == width.getSpinner()) || (s == height.getSpinner())) { // New drawing dimension resizeDrawing(); } } // For all image = buildImage(); frame.repaint(); }
Example 7
Source File: SwingSet2.java From Darcula with Apache License 2.0 | 5 votes |
public void stateChanged(ChangeEvent e) { SingleSelectionModel model = (SingleSelectionModel) e.getSource(); boolean srcSelected = model.getSelectedIndex() == 1; if(currentTabDemo != currentDemo && demoSrcPane != null && srcSelected) { demoSrcPane.setText(getString("SourceCode.loading")); repaint(); } if(currentTabDemo != currentDemo && srcSelected) { currentTabDemo = currentDemo; setSourceCode(currentDemo); } }
Example 8
Source File: MethodBreakpoint.java From netbeans with Apache License 2.0 | 5 votes |
public void stateChanged(ChangeEvent chev) { Object source = chev.getSource(); if (source instanceof Breakpoint.VALIDITY) { setValidity((Breakpoint.VALIDITY) source, chev.toString()); } else { throw new UnsupportedOperationException(chev.toString()); } }
Example 9
Source File: AndroidEditorViewer.java From DroidUIBuilder with Apache License 2.0 | 5 votes |
public void stateChanged(ChangeEvent ev) { if (ev.getSource() instanceof Layout) { repaint(); } }
Example 10
Source File: SampleAnalysisWorkflowManagerIDTIMS.java From ET_Redux with Apache License 2.0 | 5 votes |
public void stateChanged(ChangeEvent e) { AbstractButton abstractButton = (AbstractButton) e.getSource(); boolean isZircon = abstractButton.getModel().isSelected(); fractionPbBlankMassText.get(row).setEnabled(!isZircon); // added aug 2010 if (isZircon) { // fires itemlistener fractionInitialPbChoice.get(row).setSelectedIndex(0); } fractionInitialPbChoice.get(row).setEnabled(!isZircon); updateInitialPbModelChooserForRow(fraction, isZircon, row); }
Example 11
Source File: MatchingObject.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void stateChanged(ChangeEvent e) { if (enabled) { TextDetail td = (TextDetail) e.getSource(); int origMatchesSelected = selectedMatchesCount; selectedMatchesCount += td.isSelected() ? 1 : -1; changeSupport.firePropertyChange(PROP_MATCHES_SELECTED, origMatchesSelected, selectedMatchesCount); if (selected && selectedMatchesCount == 0) { setSelected(false); } else if (!selected && selectedMatchesCount > 0) { setSelected(true); } } }
Example 12
Source File: SliderWithTextBox.java From opensim-gui with Apache License 2.0 | 5 votes |
/** * Slider change */ public void stateChanged(ChangeEvent e) { JSlider source = (JSlider) e.getSource(); if (source != jXSlider) return; double theValue = jXSlider.getValue()*step+min; setTheValue(theValue, true, false, true, (source.getValueIsAdjusting())); }
Example 13
Source File: ComponentPeer.java From netbeans with Apache License 2.0 | 5 votes |
public void stateChanged(ChangeEvent e) { if (e.getSource() == tokenList) { reschedule(); } else { doUpdateCurrentVisibleSpan(); } }
Example 14
Source File: VCSCommitPanel.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void stateChanged(ChangeEvent e) { if (e.getSource() == tabbedPane && tabbedPane.getSelectedComponent() == basePanel) { if(diffProvider != null) { commitTable.setModifiedFiles(diffProvider.getModifiedFiles()); } } else if(e.getSource() == parameters || e.getSource() == commitTable) { valuesChanged(); } }
Example 15
Source File: Sepia.java From marvinproject with GNU Lesser General Public License v3.0 | 4 votes |
public void stateChanged(ChangeEvent e) { JSlider barra = (JSlider) (e.getSource()); JTextField lbl = (JTextField)(attributesPanel.getComponent("txtValue").getComponent()); lbl.setText(""+barra.getValue()); }
Example 16
Source File: CommitPanel.java From netbeans with Apache License 2.0 | 4 votes |
@Override public void stateChanged(ChangeEvent e) { if (e.getSource() == tabbedPane && tabbedPane.getSelectedComponent() == basePanel) { commitTable.setModifiedFiles(new HashSet<File>(getModifiedFiles().keySet())); } }
Example 17
Source File: Gui5250Frame.java From tn5250j with GNU General Public License v2.0 | 4 votes |
@Override public void stateChanged(ChangeEvent e) { JTabbedPane p = (JTabbedPane)e.getSource(); setSessionTitle((SessionPanel)p.getSelectedComponent()); }
Example 18
Source File: RenamePanel.java From netbeans with Apache License 2.0 | 4 votes |
@Override public void stateChanged(ChangeEvent e) { JCheckBox source = (JCheckBox) e.getSource(); lowerCaseFileNameCheckBox.setEnabled(source.isVisible() && source.isSelected()); RenamePanel.this.parent.stateChanged(null); }
Example 19
Source File: CellEditor.java From jaamsim with Apache License 2.0 | 4 votes |
@Override public void editingStopped(ChangeEvent evt) { CellEditor editor = (CellEditor)evt.getSource(); Input<?> in = (Input<?>)editor.getCellEditorValue(); Entity ent = editor.getTable().getEntity(); final String newValue = editor.getValue(); // The value has not changed if (in.getValueString().equals(newValue) && in.isValid()) { editor.propTable.setPresentCellEditor(null); return; } // Adjust the user's entry to standardise the syntax String str = newValue.trim(); if (!str.isEmpty()) str = in.applyConditioning(str); try { // Parse the keyword inputs KeywordIndex kw = InputAgent.formatInput(in.getKeyword(), str); InputAgent.storeAndExecute(new KeywordCommand(ent, kw)); in.setValid(true); } catch (InputErrorException exep) { boolean entityChanged = (EditBox.getInstance().getCurrentEntity() != ent); // Reset the Input Editor to the original tab final EditTable table = editor.getTable(); if (!entityChanged) { EditBox.getInstance().setTab(table.getTab()); } if (editor.canRetry() && !entityChanged) { boolean editSelected = GUIFrame.showErrorEditDialog("Input Error", exep.source, exep.position, "Input error:", exep.getMessage(), "Do you want to continue editing, or reset the input?"); if (editSelected) { // Any editor that supports retry should implement the following final int row = editor.getRow(); final int col = editor.getCol(); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { table.setRetry(newValue, row, col); table.editCellAt(row, col); } }); } else { GUIFrame.updateUI(); } return; } GUIFrame.showErrorDialog("Input Error", exep.source, exep.position, "Input error:", exep.getMessage(), "Value will be cleared."); GUIFrame.updateUI(); return; } finally { editor.propTable.setPresentCellEditor(null); } }
Example 20
Source File: BasicOutlookBarUI.java From CodenameOne with GNU General Public License v2.0 | 4 votes |
public void stateChanged(ChangeEvent e) { JTabbedPane tabPane = (JTabbedPane)e.getSource(); tabPane.revalidate(); tabPane.repaint(); }