List of usage examples for javax.swing.event ChangeListener ChangeListener
ChangeListener
From source file:canreg.client.gui.dataentry.ImportView.java
/** * Creates new form ImportView//from www.ja va2s.c o m */ public ImportView() { initComponents(); previewPanel.setVisible(false); globalToolBox = CanRegClientApp.getApplication().getGlobalToolBox(); changeTab(0); // Add a listener for changing the active tab ChangeListener tabbedPaneChangeListener = new ChangeListener() { public void stateChanged(ChangeEvent e) { initializeVariableMappingTab(); changeTab(tabbedPane.getSelectedIndex()); } }; // And add the listener to the tabbedPane tabbedPane.addChangeListener(tabbedPaneChangeListener); localSettings = CanRegClientApp.getApplication().getLocalSettings(); path = localSettings.getProperty("import_path"); if (path == null) { chooser = new JFileChooser(); } else { chooser = new JFileChooser(path); } // Group the radiobuttons ButtonGroup discrepanciesButtonGroup = new ButtonGroup(); // Add to the button group discrepanciesButtonGroup.add(rejectRadioButton); discrepanciesButtonGroup.add(updateRadioButton); discrepanciesButtonGroup.add(overwriteRadioButton); // Get the system description doc = CanRegClientApp.getApplication().getDatabseDescription(); variablesInDB = canreg.common.Tools.getVariableListElements(doc, Globals.NAMESPACE); // get the available charsets SortedMap<String, Charset> charsets = Charset.availableCharsets(); charsetsComboBox.setModel(new javax.swing.DefaultComboBoxModel(charsets.values().toArray())); // set the default mapping charsetsComboBox.setSelectedItem(globalToolBox.getStandardCharset()); // initializeVariableMappingTab(); }
From source file:jku.ss09.mir.lastfmecho.bo.visualization.MirArtistNetworkGraphVisualizer.java
public boolean init() { if (artistList.size() > similarityMatrix.length) { System.out.println(//from w w w .jav a 2 s . c o m "Error in MirArtistNetworkGraphVisualizer - The similaritymatrix is smaller than number of artists "); return false; } graph = getGraph(SIMILARITY_DEFAULT / 100.0); setVisualizationRenderer(); // create a frome to hold the graph final JFrame frame = new JFrame(); Container content = frame.getContentPane(); final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv); content.add(panel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final ModalGraphMouse gm = new DefaultModalGraphMouse<Integer, Number>(); vv.setGraphMouse(gm); final ScalingControl scaler = new CrossoverScalingControl(); JButton plus = new JButton("+"); plus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1.1f, vv.getCenter()); } }); JButton minus = new JButton("-"); minus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1 / 1.1f, vv.getCenter()); } }); JSlider slider = new JSlider(JSlider.HORIZONTAL, SIMILARITY_MIN, SIMILARITY_MAX, SIMILARITY_DEFAULT); slider.setMajorTickSpacing(10); slider.setPaintTicks(true); final JLabel sliderLabel = new JLabel("0.87"); final MirArtistNetworkGraphVisualizer thisPointer = this; slider.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent arg0) { JSlider source = (JSlider) arg0.getSource(); if (!source.getValueIsAdjusting()) { System.out.println(source.getValue() / 100.0); Graph testG = getGraph(source.getValue() / 100.0); sliderLabel.setText(Double.toString(source.getValue() / 100.0)); thisPointer.vv.setGraphLayout(new FRLayout<Integer, Number>(testG)); //thisPointer.setVisualizationRenderer(); thisPointer.vv.validate(); thisPointer.vv.repaint(); } } }); JPanel controls = new JPanel(); controls.add(plus); controls.add(minus); controls.add(((DefaultModalGraphMouse<Integer, Number>) gm).getModeComboBox()); controls.add(new JLabel("Similarity Limit: ")); controls.add(sliderLabel); controls.add(slider); content.add(controls, BorderLayout.SOUTH); frame.pack(); frame.setVisible(true); return true; }
From source file:edu.ku.brc.af.ui.forms.validation.ValSpinner.java
/** * Initializes the control.//from ww w .j a v a2s .c om */ protected void init() { setControlSize(this); if (requiredFieldColor == null) { requiredFieldColor = AppPrefsCache.getColorWrapper("ui", "formatting", "requiredfieldcolor"); } addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { isChanged = true; } }); }
From source file:de.tor.tribes.ui.views.DSWorkbenchRankFrame.java
/** Creates new form DSWorkbenchRankFrame */ DSWorkbenchRankFrame() {/*w w w.j a v a 2s . c o m*/ initComponents(); centerPanel = new GenericTestPanel(); jRankPanel.add(centerPanel, BorderLayout.CENTER); centerPanel.setChildComponent(jXRankPanel); buildMenu(); capabilityInfoPanel1.addActionListener(this); jRankTabPane.getModel().addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { RankTableTab activeTab = getActiveTab(); if (activeTab != null) { activeTab.updateTab(); } } }); jXColumnList.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { updateFilter(); } }); setGlassPane(jxSearchPane); // <editor-fold defaultstate="collapsed" desc=" Init HelpSystem "> if (!Constants.DEBUG) { GlobalOptions.getHelpBroker().enableHelpKey(getRootPane(), "pages.ranking_view", GlobalOptions.getHelpBroker().getHelpSet()); } // </editor-fold> // updateRankTable(); }
From source file:Main.java
/** * Constructs the model./*from w w w . j a v a 2 s. co m*/ * * @param w * the word to permute */ public PermutationSpinnerModel(String w) { word = w; ChangeListener lis = new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { System.out.println(e); } }; addChangeListener(lis); removeChangeListener(lis); }
From source file:Main.java
/** * Constructs the model.//from w w w.ja v a2 s.com * * @param w * the word to permute */ public PermutationSpinnerModel(String w) { word = w; ChangeListener lis = new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { System.out.println(e); } }; addChangeListener(lis); ChangeListener[] listeners = getChangeListeners(); removeChangeListener(lis); }
From source file:Main.java
/** * Constructs the model.//from w w w . ja va2s . c om * * @param w * the word to permute */ public PermutationSpinnerModel(String w) { word = w; ChangeListener lis = new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { System.out.println(e); } }; addChangeListener(lis); ChangeListener[] listeners = getListeners(ChangeListener.class); removeChangeListener(lis); }
From source file:net.sf.jhylafax.AbstractFaxDialog.java
protected void addDateControls() { dateNowRadionButton = new JRadioButton(); dateNowRadionButton.setSelected(true); dateLabel = builder.append("", dateNowRadionButton); builder.nextLine();//from www . ja v a 2 s. c om dateLaterRadionButton = new JRadioButton(); dateModel = new SpinnerDateModel(); final JSpinner dateSpinner = new JSpinner(dateModel); dateSpinner.setEnabled(false); dateLaterRadionButton.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { dateSpinner.setEnabled(dateLaterRadionButton.isSelected()); } }); builder.append("", dateLaterRadionButton, dateSpinner); builder.nextLine(); ButtonGroup buttonGroup = new ButtonGroup(); buttonGroup.add(dateNowRadionButton); buttonGroup.add(dateLaterRadionButton); }
From source file:de.atomfrede.tools.evalutation.options.ui.OptionsDialog.java
private JSpinner getSampleSpinner() { if (sampleSpinner == null) { sampleSpinner = new JSpinner(); SpinnerNumberModel numberModel = new SpinnerNumberModel(TypeAEvaluationOptions.getSampleRate(), 1.0, 10.0, 1.0);//w ww . j av a2 s.com sampleSpinner.setModel(numberModel); sampleSpinner.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { SpinnerNumberModel model = (SpinnerNumberModel) sampleSpinner.getModel(); double selectedValue = model.getNumber().doubleValue(); sampleRate = selectedValue; } }); } return sampleSpinner; }
From source file:biomine.bmvis2.pipeline.EdgeSimplificationOperation.java
public JComponent getSettingsComponent(final SettingsChangeCallback settingsChangeCallback, VisualGraph graph) { this.graph = graph; int edgeCount = SimplificationUtils.countNormalEdges(graph); if (oldEdgeCount != 0) { long newTarget = (this.target * edgeCount) / this.oldEdgeCount; if (newTarget != this.target) { this.target = Math.max(newTarget, this.target); Logging.info("simplifier", "New edge count target: " + this.target); }// w ww . j a va 2s . com } else this.target = edgeCount; this.oldEdgeCount = edgeCount; JPanel ret = new JPanel(); final JSlider sl = new JSlider(0, edgeCount, (int) Math.min(target, edgeCount)); sl.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent arg0) { if (target == sl.getValue()) return; target = sl.getValue(); if (EdgeSimplificationOperation.this.getGraph() == null) settingsChangeCallback.settingsChanged(false); else EdgeSimplificationOperation.this.hideHidables(EdgeSimplificationOperation.this.getGraph()); } }); ret.setLayout(new BoxLayout(ret, BoxLayout.Y_AXIS)); ret.add(sl); ret.add(costLabel); return ret; }