List of usage examples for javax.swing.event ChangeEvent getSource
public Object getSource()
From source file:compecon.dashboard.panel.StatesPanel.java
public StatesPanel() { this.setLayout(new BorderLayout()); for (Currency currency : Currency.values()) { JPanel panelForCurrency = new StatePanelForCurrency(currency); jTabbedPaneCurrency.addTab(currency.getIso4217Code(), panelForCurrency); }/*from w w w. jav a 2 s. co m*/ jTabbedPaneCurrency.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { if (e.getSource() instanceof JTabbedPane) { JTabbedPane pane = (JTabbedPane) e.getSource(); StatePanelForCurrency selectedComponent = (StatePanelForCurrency) pane.getSelectedComponent(); selectedComponent.notifyListener(); } } }); add(jTabbedPaneCurrency, BorderLayout.CENTER); }
From source file:compecon.dashboard.panel.BanksPanel.java
public BanksPanel() { this.setLayout(new BorderLayout()); for (Currency currency : Currency.values()) { JPanel panelForCurrency = new BanksPanelForCurrency(currency); jTabbedPaneCurrency.addTab(currency.getIso4217Code(), panelForCurrency); }/*from w ww . j a v a 2s. co m*/ jTabbedPaneCurrency.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { if (e.getSource() instanceof JTabbedPane) { JTabbedPane pane = (JTabbedPane) e.getSource(); BanksPanelForCurrency selectedComponent = (BanksPanelForCurrency) pane.getSelectedComponent(); selectedComponent.notifyListener(); } } }); add(jTabbedPaneCurrency, BorderLayout.CENTER); }
From source file:House.java
public JSlider setSlider(JPanel panel, int orientation, int minimumValue, int maximumValue, int initValue, int majorTickSpacing, int minorTickSpacing) { JSlider slider = new JSlider(orientation, minimumValue, maximumValue, initValue); slider.setPaintTicks(true);/*from w w w. j a va 2 s. c o m*/ slider.setMajorTickSpacing(majorTickSpacing); slider.setMinorTickSpacing(minorTickSpacing); slider.setPaintLabels(true); slider.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { JSlider tempSlider = (JSlider) e.getSource(); if (tempSlider.equals(sliderTransX)) { transX = sliderTransX.getValue() - 150.0; canvas.repaint(); } else if (tempSlider.equals(sliderTransY)) { transY = sliderTransY.getValue() - 150.0; canvas.repaint(); } else if (tempSlider.equals(sliderRotateTheta)) { rotateTheta = sliderRotateTheta.getValue() * Math.PI / 180; canvas.repaint(); } else if (tempSlider.equals(sliderRotateX)) { rotateX = sliderRotateX.getValue(); canvas.repaint(); } else if (tempSlider.equals(sliderRotateY)) { rotateY = sliderRotateY.getValue(); canvas.repaint(); } else if (tempSlider.equals(sliderScaleX)) { if (sliderScaleX.getValue() != 0.0) { scaleX = sliderScaleX.getValue() / 100.0; canvas.repaint(); } } else if (tempSlider.equals(sliderScaleY)) { if (sliderScaleY.getValue() != 0.0) { scaleY = sliderScaleY.getValue() / 100.0; canvas.repaint(); } } } }); panel.add(slider); return slider; }
From source file:components.SliderDemo.java
/** Listen to the slider. */ public void stateChanged(ChangeEvent e) { JSlider source = (JSlider) e.getSource(); if (!source.getValueIsAdjusting()) { int fps = (int) source.getValue(); if (fps == 0) { if (!frozen) stopAnimation();/* w ww . ja va2 s.c o m*/ } else { delay = 1000 / fps; timer.setDelay(delay); timer.setInitialDelay(delay * 10); if (frozen) startAnimation(); } } }
From source file:com.github.fritaly.dualcommander.TabbedPane.java
@Override public void stateChanged(ChangeEvent e) { if (e.getSource() == getSelectedComponent()) { // Update the current tab's title this.setTitleAt(getSelectedIndex(), getActiveBrowser().getDirectory().getName()); // Propagate the event fireStateChanged();/*from w ww.j a va2 s . c om*/ } }
From source file:WeatherWizard.java
public void stateChanged(ChangeEvent e) { JSlider slider = (JSlider) e.getSource(); painter.setTemperature(slider.getValue()); }
From source file:knop.psfj.view.ImageStackRangeModel.java
/** * Gets the range slider./*from www. ja va2 s. c o m*/ * * @param e the e * @return the range slider */ public JRangeSlider getRangeSlider(ChangeEvent e) { JRangeSlider slider = (JRangeSlider) e.getSource(); return slider; }
From source file:fungus.MycoNodeFrame.java
public void stateChanged(ChangeEvent e) { if (e.getSource() == handler) { getContentPane().validate();/*from w w w . j a v a 2s . com*/ } else { refreshData(); } }
From source file:org.csml.tommo.sugar.modules.heatmap.MixedHeatmapDialog.java
private JSlider createMixParameterSlider() { JSlider slider = new JSlider(JSlider.VERTICAL, 0, 100, (int) (mixOperation.getParameter() * 100.0)); slider.setMajorTickSpacing(10);/*from w w w . j a v a2 s . c o m*/ slider.setSnapToTicks(true); slider.setPaintTicks(true); // slider.setPaintLabels(true); slider.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent event) { JSlider source = (JSlider) event.getSource(); if (!source.getValueIsAdjusting()) { double param = (double) source.getValue() / (double) 100.0; updateMixParameter(param); } } }); return slider; }
From source file:compecon.dashboard.panel.IndustriesPanel.java
public IndustriesPanel() { this.setLayout(new BorderLayout()); for (Currency currency : Currency.values()) { IndustriesPanelForCurrency panelForCurrency = new IndustriesPanelForCurrency(currency); jTabbedPaneCurrency.addTab(currency.getIso4217Code(), panelForCurrency); }/*w w w . ja va2 s . c o m*/ jTabbedPaneCurrency.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { if (e.getSource() instanceof JTabbedPane) { JTabbedPane pane = (JTabbedPane) e.getSource(); IndustriesPanelForCurrency selectedComponent = (IndustriesPanelForCurrency) pane .getSelectedComponent(); selectedComponent.notifyListener(); } } }); add(jTabbedPaneCurrency, BorderLayout.CENTER); }