List of usage examples for javax.swing.event ChangeEvent getSource
public Object getSource()
From source file:com.sec.ose.osi.ui.frm.main.identification.JPanIdentifyMain.java
/** * This method initializes jTabbedPane * // w ww. j av a 2 s . c o m * @return javax.swing.JTabbedPane */ public JTabbedPane getJTabbedPaneFileNavigation() { if (jTabbedPaneFileNavigation == null) { jTabbedPaneFileNavigation = new JTabbedPane(); jTabbedPaneFileNavigation.addTab("Tree", null, getJScrollPaneTree(), null); jTabbedPaneFileNavigation.addTab("List", null, getJScrollPaneList(), null); jTabbedPaneFileNavigation.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); jTabbedPaneFileNavigation.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { JTabbedPane pane = (JTabbedPane) e.getSource(); int selectedTab = pane.getSelectedIndex(); log.debug("[JPanIdentifyMain.getJTabbedPaneFileNavigation()] selectedTab : " + selectedTab); SelectedFilePathInfo selectedFilePathInfo = IdentifyMediator.getInstance() .getSelectedFilePathInfo(); String selectedPath = selectedFilePathInfo.getSelectedPath(); log.debug("[JPanIdentifyMain.getJTabbedPaneFileNavigation()] selectedPath : " + selectedPath); IdentifyMediator.getInstance().setFilePointerToSelectedFile(selectedPath); actForTab(selectedTab); String projectName = IdentifyMediator.getInstance().getSelectedProjectName(); refreshChildFrameForMatchedType(projectName); } }); } return jTabbedPaneFileNavigation; }
From source file:de.unibayreuth.bayeos.goat.panels.timeseries.JPanelChart.java
public void stateChanged(ChangeEvent event) { try {// w w w.j ava 2 s .c o m Object src = event.getSource(); BoundedRangeModel scrollBarModel = this.chartScrollBar.getModel(); if (src == scrollBarModel) { int val = scrollBarModel.getValue(); int ext = scrollBarModel.getExtent(); Plot plot = this.chartPanel.getChart().getPlot(); if (plot instanceof XYPlot) { XYPlot hvp = (XYPlot) plot; ValueAxis axis = hvp.getDomainAxis(); // avoid problems this.chartPanel.getChart().removeChangeListener(this); axis.setRange(val / scrollFactor, (val + ext) / scrollFactor); // restore chart listener this.chartPanel.getChart().addChangeListener(this); } } } catch (Exception e) { MsgBox.error(e.getMessage()); } }
From source file:com.unionpay.upmp.jmeterplugin.gui.UPMPUrlConfigGui.java
@Override public void stateChanged(ChangeEvent e) { if (e.getSource() == autoRedirects) { if (autoRedirects.isSelected()) { followRedirects.setSelected(false); }//from w w w . j a v a 2 s. co m } if (e.getSource() == followRedirects) { if (followRedirects.isSelected()) { autoRedirects.setSelected(false); } } }
From source file:PolygonOffset.java
public void stateChanged(ChangeEvent e) { JSlider source = (JSlider) e.getSource(); curInt = source.getValue();// w w w. j a v a 2 s .co m curLog = curInt / scale; current = (float) exp10(curLog); valueChanged(); }
From source file:PolygonOffset.java
public void stateChanged(ChangeEvent e) { JSlider source = (JSlider) e.getSource(); // get the event type, set the corresponding value. // Sliders use integers, handle floating point values by scaling the // values by "scale" to allow settings at "resolution" intervals. // Divide by "scale" to get back to the real value. curInt = source.getValue();/* w w w.j a va 2 s . c o m*/ current = curInt / scale; valueChanged(); }
From source file:com.polivoto.vistas.Charts.java
private void crearPieChart(Pregunta pregunta) { JTabbedPane tabPanel = new JTabbedPane(); panelGrafica.add(tabPanel);/*w ww .j a v a 2 s .co m*/ //Calcular el nmero N de perfiles. Si N=1, no discriminar por pestanas. //Si son N perfiles (N>2), hacer N+1 pestanas (la ltima representa la //suma de los resultados sin segregacin. int n = pregunta.obtenerCantidadDePerfiles(); System.out.println(" n " + n); if (n > 1) { for (int i = 0; i < n; i++) { JPanel panel = hacerPiePanel(pregunta, pregunta.obtenerResultadoPorPerfil(i).getOpciones()); panel.setName(pregunta.obtenerResultadoPorPerfil(i).getPerfil()); tabPanel.addTab(panel.getName(), panel); } } JPanel panel = hacerPiePanel(pregunta, pregunta.obtenerOpciones()); panel.setName("Todos"); tabPanel.addTab(panel.getName(), panel); tabPanel.setFont(new Font("Roboto", 0, 24)); tabPanel.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { tabIndex = ((JTabbedPane) (e.getSource())).getSelectedIndex(); } }); tabPanel.setSelectedIndex(tabIndex); panelGrafica.add(tabPanel, BorderLayout.CENTER); panelGrafica.repaint(); panelGrafica.revalidate(); }
From source file:javazoom.jlgui.player.amp.playlist.ui.PlaylistUI.java
public void stateChanged(ChangeEvent e) { Object src = e.getSource(); //log.debug("State (EDT=" + SwingUtilities.isEventDispatchThread() + ")"); if (src == ui.getAcPlSlider()) { int n = playlist.getPlaylistSize(); float dx = (100 - ui.getAcPlSlider().getValue()) / 100.0f; int index = (int) (dx * (n - 1)); if (index != topIndex) { topIndex = index;/* w ww . java2 s . com*/ paintList(); } } }
From source file:net.sf.jclal.gui.view.components.chart.ExternalBasicChart.java
/** * * @param windowsTitleParam The title of the window. * @param chartTitleParam The title of the chart panel. * @param xTitleParam The X-axis label./* ww w . j av a 2s . co m*/ */ public ExternalBasicChart(String windowsTitleParam, String chartTitleParam, String xTitleParam) { reportFrecuency = 1; menubar = new JMenuBar(); menubar.add(createMenu()); max = -1; windowsTitle = windowsTitleParam; chartTitle = chartTitleParam; xTitle = xTitleParam; queryNames = new ArrayList<String>(); evaluationsCollection = new ArrayList<List<AbstractEvaluation>>(); controlCurveColor = new HashMap<String, Color>(); set = new HashSet<Integer>(); setSeries = new HashSet<String>(); colors = new ArrayList<Color>(); chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new Dimension(640, 480)); chartPanel.setFillZoomRectangle(true); chartPanel.setMouseWheelEnabled(true); slider = new JSlider(JSlider.HORIZONTAL); slider.setPaintTicks(true); slider.setPaintLabels(true); slider.setToolTipText("Changes the report frecuency"); slider.setSnapToTicks(true); slider.setMinimum(1); slider.setMinorTickSpacing(1); slider.addChangeListener(new ChangeListener() { @Override public void stateChanged(javax.swing.event.ChangeEvent evt) { reportFrecuency = ((JSlider) evt.getSource()).getValue(); slider.setToolTipText(String.valueOf(reportFrecuency)); jComboBoxItemStateChanged(); } }); comboBox = new JComboBox<String>(); comboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent evt) { jComboBoxItemStateChanged(); } }); content = new JPanel(new BorderLayout()); content.add(comboBox, BorderLayout.NORTH); content.add(chartPanel, BorderLayout.CENTER); content.add(slider, BorderLayout.SOUTH); setJMenuBar(menubar); setTitle(windowsTitle); setContentPane(this.content); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); }
From source file:econtroller.gui.ControllerGUI.java
private void createSenseSlider() { Box hbox = Box.createHorizontalBox(); senseLabel = new JLabel("Sense every ", JLabel.CENTER); senseValueLabel = new JLabel(String.valueOf(SENSE_INIT), JLabel.CENTER); senseSecondLabel = new JLabel(" (s)", JLabel.CENTER); senseSlider = new JSlider(JSlider.HORIZONTAL, SENSE_MIN, SENSE_MAX, SENSE_INIT); senseSlider.setMajorTickSpacing(20); senseSlider.setMinorTickSpacing(5);//from w ww . j a v a 2s . c o m senseSlider.setPaintLabels(true); senseSlider.setPaintTicks(true); senseSlider.setPaintTrack(true); senseSlider.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent changeEvent) { JSlider source = (JSlider) changeEvent.getSource(); int value = source.getValue(); senseValueLabel.setText(String.valueOf(value)); } }); hbox.add(senseLabel); hbox.add(senseValueLabel); hbox.add(senseSecondLabel); controllerDesignPanel.add(hbox); controllerDesignPanel.add(senseSlider); }
From source file:econtroller.gui.ControllerGUI.java
private void createActSlider() { Box hbox = Box.createHorizontalBox(); actLabel = new JLabel("Act every ", JLabel.CENTER); actValueLabel = new JLabel(String.valueOf(ACT_INIT), JLabel.CENTER); actSecondLabel = new JLabel(" (s)", JLabel.CENTER); actSlider = new JSlider(); actSlider = new JSlider(JSlider.HORIZONTAL, ACT_MIN, ACT_MAX, ACT_INIT); actSlider.setMajorTickSpacing(20);//ww w. ja v a2 s . c o m actSlider.setMinorTickSpacing(5); actSlider.setPaintLabels(true); actSlider.setPaintTicks(true); actSlider.setPaintTrack(true); actSlider.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent changeEvent) { JSlider source = (JSlider) changeEvent.getSource(); int value = source.getValue(); actValueLabel.setText(String.valueOf(value)); } }); hbox.add(actLabel); hbox.add(actValueLabel); hbox.add(actSecondLabel); controllerDesignPanel.add(hbox); controllerDesignPanel.add(actSlider); }