List of usage examples for java.awt.event ItemEvent getStateChange
public int getStateChange()
From source file:org.uncommons.watchmaker.swing.evolutionmonitor.PopulationFitnessView.java
/** * Creates the GUI controls for toggling graph display options. * @return A component that can be added to the main panel. *///from w ww. j a v a 2 s. c om private JComponent createControls(boolean islands) { JPanel controls = new JPanel(new FlowLayout(FlowLayout.RIGHT)); allDataButton.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent ev) { updateDomainAxisRange(); } }); String text = "Last " + SHOW_FIXED_GENERATIONS + (islands ? " Epochs" : " Generations"); JRadioButton recentDataButton = new JRadioButton(text, true); ButtonGroup buttonGroup = new ButtonGroup(); buttonGroup.add(allDataButton); buttonGroup.add(recentDataButton); controls.add(allDataButton); controls.add(recentDataButton); final JCheckBox meanCheckBox = new JCheckBox("Show Mean", true); meanCheckBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent itemEvent) { if (itemEvent.getStateChange() == ItemEvent.SELECTED) { dataSet.addSeries(meanSeries); } else { dataSet.removeSeries(meanSeries); } } }); controls.add(meanCheckBox); invertCheckBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent itemEvent) { rangeAxis.setInverted(invertCheckBox.isSelected()); } }); controls.add(invertCheckBox); return controls; }
From source file:com.unionpay.upmp.jmeterplugin.gui.UPMPDefaultsGui.java
public void itemStateChanged(final ItemEvent event) { if (event.getStateChange() == ItemEvent.SELECTED) { enableConcurrentDwn(true);/*from ww w .j a va 2 s. co m*/ } else { enableConcurrentDwn(false); } }
From source file:de.fhbingen.wbs.wpOverview.tabs.AvailabilityGraphAction.java
/** * ActionListener.//from ww w . ja v a 2 s .c o m * @param buttonId The id of the button. */ private void addButtonListener(final int buttonId) { gui.buttons[buttonId].addItemListener(new ItemListener() { @Override public void itemStateChanged(final ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { deselectOthers(buttonId); gui.function.changeView(buttonId); } } }); }
From source file:be.ugent.maf.cellmissy.gui.controller.analysis.doseresponse.area.AreaDRInitialController.java
/** * Initialize view./*www . j a va 2s. c o m*/ */ @Override protected void initDRInitialPanel() { dRInitialPlotPanel = new DRInitialPlotPanel(); //init chart panel initialChartPanel = new ChartPanel(null); initialChartPanel.setOpaque(false); /** * Action listeners for buttons */ /** * If selected, text field to enter value for parameter constraining * will be taken into account on plotting. */ dRInitialPlotPanel.getBottomCheckBox().addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { bottomConstrainValue = 0.0; } else { bottomConstrainValue = null; } } }); dRInitialPlotPanel.getTopCheckBox().addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { topConstrainValue = 0.0; } else { topConstrainValue = null; } } }); /** * Perform fitting and plot new dose-response graph, taking into account * any choices made by the user. */ dRInitialPlotPanel.getPlotGraphButton().addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (bottomConstrainValue != null) { bottomConstrainValue = Double.parseDouble(dRInitialPlotPanel.getBottomTextField().getText()); } if (topConstrainValue != null) { topConstrainValue = Double.parseDouble(dRInitialPlotPanel.getTopTextField().getText()); } doseResponseController .performFitting( dataToFit, doseResponseController.getdRAnalysisGroup() .getDoseResponseAnalysisResults().getFittingResults(false), bottomConstrainValue, topConstrainValue); //Plot fitted data in dose-response curve, along with R annotation doseResponseController.plotDoseResponse(initialChartPanel, dRInitialPlotPanel.getDoseResponseChartParentPanel(), dataToFit, doseResponseController.getdRAnalysisGroup(), false); //Calculate new statistics doseResponseController.calculateStatistics(); } }); }
From source file:de.mpg.mpi_inf.bioinf.netanalyzer.ui.IntHistogramVisualizer.java
@Override protected JComponent addSettingsPanels(JTabbedPane aPanel) { addTab(aPanel, Messages.DI_GENERAL, new SettingsPanel(general), Messages.TT_GENSETTINGS); addTab(aPanel, Messages.DI_AXES, new SettingsPanel(settings.axes), Messages.TT_AXESSETTINGS); addTab(aPanel, Messages.DI_GRID, new SettingsPanel(settings.grid), Messages.TT_GRIDSETTINGS); boolean useScatter = settings.useScatter(); final Box histPanel = Box.createVerticalBox(); final JComboBox choiceCombo = addChoice(histPanel, useScatter ? 1 : 0); final CardLayout innerLayout = new CardLayout(); final JPanel innerPanel = new JPanel(innerLayout); histPanel.add(innerPanel);//from w w w. j a v a 2 s . c om aPanel.addTab(Messages.DI_HISTOGRAM, null, histPanel, Messages.TT_HISTSETTINGS); ItemListener listener = new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { innerLayout.next(innerPanel); } } }; choiceCombo.addItemListener(listener); innerPanel.add(new SettingsPanel(settings.bars), "0"); innerPanel.add(new SettingsPanel(settings.scatter), "1"); if (useScatter) { innerLayout.next(innerPanel); } return choiceCombo; }
From source file:org.yccheok.jstock.gui.portfolio.AutoDividendRowJPanel.java
private void jCheckBox1ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jCheckBox1ItemStateChanged final boolean enabled = evt.getStateChange() == ItemEvent.SELECTED; jFormattedTextField2.setEnabled(enabled); jPanel1.setEnabled(enabled);// w w w . j a v a2 s . c o m autoDividendJPanel.updateJCheckBoxColor(); autoDividendJPanel.updateTotalLabel(); }
From source file:com.unionpay.upmp.jmeterplugin.gui.UPMPDefaultsGui.java
private void init() { setLayout(new BorderLayout(0, 5)); setBorder(makeBorder());//from ww w . ja v a 2 s . c o m add(makeTitlePanel(), BorderLayout.NORTH); urlConfig = new UPMPUrlConfigGui(false, true, false); add(urlConfig, BorderLayout.CENTER); // OPTIONAL TASKS final JPanel optionalTasksPanel = new VerticalPanel(); optionalTasksPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), JMeterUtils.getResString("optional_tasks"))); // $NON-NLS-1$ final JPanel checkBoxPanel = new HorizontalPanel(); imageParser = new JCheckBox(JMeterUtils.getResString("web_testing_retrieve_images")); // $NON-NLS-1$ checkBoxPanel.add(imageParser); imageParser.addItemListener(new ItemListener() { @Override public void itemStateChanged(final ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { enableConcurrentDwn(true); } else { enableConcurrentDwn(false); } } }); // Concurrent resources download concurrentDwn = new JCheckBox(JMeterUtils.getResString("web_testing_concurrent_download")); // $NON-NLS-1$ concurrentDwn.addItemListener(new ItemListener() { @Override public void itemStateChanged(final ItemEvent e) { if (imageParser.isSelected() && e.getStateChange() == ItemEvent.SELECTED) { concurrentPool.setEnabled(true); } else { concurrentPool.setEnabled(false); } } }); concurrentPool = new JTextField(2); // 2 columns size concurrentPool.setMaximumSize(new Dimension(30, 20)); checkBoxPanel.add(concurrentDwn); checkBoxPanel.add(concurrentPool); optionalTasksPanel.add(checkBoxPanel); // Embedded URL match regex embeddedRE = new JLabeledTextField(JMeterUtils.getResString("web_testing_embedded_url_pattern"), 30); // $NON-NLS-1$ optionalTasksPanel.add(embeddedRE); add(optionalTasksPanel, BorderLayout.SOUTH); }
From source file:org.zaproxy.zap.extension.reveal.ExtensionReveal.java
private JToggleButton getRevealButton() { if (revealButton == null) { revealButton = new ZapToggleButton(); revealButton.setIcon(new ImageIcon(ExtensionReveal.class.getResource("resources/icons/044.png"))); // 'light off' icon revealButton.setToolTipText(Constant.messages.getString("reveal.button.enable")); revealButton/* ww w . j a v a2s .c om*/ .setSelectedIcon(new ImageIcon(ExtensionReveal.class.getResource("resources/icons/043.png"))); // 'light on' icon revealButton.setSelectedToolTipText(Constant.messages.getString("reveal.button.disable")); revealButton.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { setReveal(ItemEvent.SELECTED == e.getStateChange()); } }); } return revealButton; }
From source file:misc.ActionDemo.java
public void itemStateChanged(ItemEvent e) { JCheckBoxMenuItem mi = (JCheckBoxMenuItem) (e.getSource()); boolean selected = (e.getStateChange() == ItemEvent.SELECTED); //Set the enabled state of the appropriate Action. if (mi == cbmi[0]) { leftAction.setEnabled(selected); } else if (mi == cbmi[1]) { middleAction.setEnabled(selected); } else if (mi == cbmi[2]) { rightAction.setEnabled(selected); }//from ww w . j a va 2s. c o m }
From source file:org.uncommons.watchmaker.swing.evolutionmonitor.IslandsView.java
/** * Creates the GUI controls for toggling graph display options. * @return A component that can be added to the main panel. *///from w w w . java 2s.c o m private JComponent createControls() { JPanel controls = new JPanel(new FlowLayout(FlowLayout.RIGHT)); final JCheckBox meanCheckBox = new JCheckBox("Show Mean and Standard Deviation", false); meanCheckBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent itemEvent) { chart.setNotify(false); CategoryPlot plot = (CategoryPlot) chart.getPlot(); if (itemEvent.getStateChange() == ItemEvent.SELECTED) { plot.setDataset(1, meanDataSet); plot.setRenderer(1, meanRenderer); } else { plot.setDataset(1, null); plot.setRenderer(1, null); } chart.setNotify(true); } }); controls.add(meanCheckBox); return controls; }