List of usage examples for javax.swing.event ChangeEvent getSource
public Object getSource()
From source file:com.qspin.qtaste.ui.MainPanel.java
public void genUI() { try {/*from ww w .ja va 2 s. com*/ getContentPane().setLayout(new BorderLayout()); // prepare the top panel that contains the following panes: // - logo // - ConfigInfopanel // - Current Date/time JPanel topanel = new JPanel(new BorderLayout()); JPanel center = new JPanel(new GridBagLayout()); ImageIcon topLeftLogo = ResourceManager.getInstance().getImageIcon("main/qspin"); JLabel iconlabel = new JLabel(topLeftLogo); mHeaderPanel = new ConfigInfoPanel(this); mTestCasePanel = new TestCasePane(this); mTestCampaignPanel = new TestCampaignMainPanel(this); mHeaderPanel.init(); GridBagLineAdder centeradder = new GridBagLineAdder(center); JLabel sep = new JLabel(" "); sep.setFont(ResourceManager.getInstance().getSmallFont()); sep.setUI(new FillLabelUI(ResourceManager.getInstance().getLightColor())); centeradder.setWeight(1.0f, 0.0f); centeradder.add(mHeaderPanel); // prepare the right panels containg the main information: // the right pane is selected through the tabbed pane: // - Test cases: management of test cases and test suites // - Test campaign: management of test campaigns // - Interactive: ability to invoke QTaste verbs one by one mRightPanels = new JPanel(new CardLayout()); mRightPanels.add(mTestCasePanel, "Test Cases"); mRightPanels.add(mTestCampaignPanel, "Test Campaign"); final TestCaseInteractivePanel testInterractivePanel = new TestCaseInteractivePanel(); mRightPanels.add(testInterractivePanel, "Interactive"); mTreeTabsPanel = new JTabbedPane(JTabbedPane.BOTTOM); mTreeTabsPanel.setPreferredSize(new Dimension(TREE_TABS_WIDTH, HEIGHT)); TestCaseTree tct = new TestCaseTree(mTestCasePanel); JScrollPane sp2 = new JScrollPane(tct); mTreeTabsPanel.addTab("Test Cases", sp2); // add tree view for test campaign definition com.qspin.qtaste.ui.testcampaign.TestCaseTree mtct = new com.qspin.qtaste.ui.testcampaign.TestCaseTree( mTestCampaignPanel.getTreeTable()); JScrollPane sp3 = new JScrollPane(mtct); mTreeTabsPanel.addTab("Test Campaign", sp3); genMenu(tct); // add another tab contain used for Interactive mode TestAPIDocsTree jInteractive = new TestAPIDocsTree(testInterractivePanel); JScrollPane spInter = new JScrollPane(jInteractive); mTreeTabsPanel.addTab("Interactive", spInter); // init will do the link between the tree view and the pane testInterractivePanel.init(); // Define the listener to display the pane depending on the selected tab mTreeTabsPanel.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { String componentName = mTreeTabsPanel.getTitleAt(mTreeTabsPanel.getSelectedIndex()); CardLayout rcl = (CardLayout) mRightPanels.getLayout(); rcl.show(mRightPanels, componentName); } }); mTestCampaignPanel.addTestCampaignActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (e.getID() == TestCampaignMainPanel.RUN_ID) { if (e.getActionCommand().equals(TestCampaignMainPanel.STARTED_CMD)) { // open the tab test cases SwingUtilities.invokeLater(new Runnable() { public void run() { mTreeTabsPanel.setSelectedIndex(0); mTestCasePanel.setSelectedTab(TestCasePane.RESULTS_INDEX); } }); // update the buttons mTestCasePanel.setExecutingTestCampaign(true, ((TestCampaignMainPanel) e.getSource()).getExecutionThread()); mTestCasePanel.updateButtons(true); } else if (e.getActionCommand().equals(TestCampaignMainPanel.STOPPED_CMD)) { mTestCasePanel.setExecutingTestCampaign(false, null); mTestCasePanel.updateButtons(); } } } }); JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, mTreeTabsPanel, mRightPanels); splitPane.setDividerSize(4); GUIConfiguration guiConfiguration = GUIConfiguration.getInstance(); int mainHorizontalSplitDividerLocation = guiConfiguration .getInt(MAIN_HORIZONTAL_SPLIT_DIVIDER_LOCATION_PROPERTY, 285); splitPane.setDividerLocation(mainHorizontalSplitDividerLocation); splitPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("dividerLocation")) { GUIConfiguration guiConfiguration = GUIConfiguration.getInstance(); if (evt.getSource() instanceof JSplitPane) { JSplitPane splitPane = (JSplitPane) evt.getSource(); guiConfiguration.setProperty(MAIN_HORIZONTAL_SPLIT_DIVIDER_LOCATION_PROPERTY, splitPane.getDividerLocation()); try { guiConfiguration.save(); } catch (ConfigurationException ex) { logger.error("Error while saving GUI configuration: " + ex.getMessage()); } } } } }); topanel.add(iconlabel, BorderLayout.WEST); topanel.add(center); getContentPane().add(topanel, BorderLayout.NORTH); getContentPane().add(splitPane); this.pack(); this.setExtendedState(Frame.MAXIMIZED_BOTH); if (mTestSuiteDir != null) { DirectoryTestSuite testSuite = DirectoryTestSuite.createDirectoryTestSuite(mTestSuiteDir); if (testSuite != null) { testSuite.setExecutionLoops(mNumberLoops, mLoopsInHour); setTestSuite(testSuite.getName()); mTestCasePanel.runTestSuite(testSuite, false); } } setVisible(true); //treeTabs.setMinimumSize(new Dimension(100, this.HEIGHT)); } catch (Exception e) { logger.fatal(e); e.printStackTrace(); TestEngine.shutdown(); System.exit(1); } }
From source file:beproject.MainGUI.java
private void jTabbedPane2StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jTabbedPane2StateChanged ((JPanel) ((JTabbedPane) evt.getSource()).getSelectedComponent()).add(movieNamesComboBox, BorderLayout.NORTH);//from ww w . j ava2s . c o m }
From source file:musite.ui.MusiteResultPanel.java
private void specificitySliderStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_specificitySliderStateChanged if (ignoreSlideChangeEvent) return;/*ww w .j av a 2 s . co m*/ javax.swing.JSlider source = (javax.swing.JSlider) evt.getSource(); if (!lockScore) { int value = (int) source.getValue(); threshold = (maxScore - minScore) * value / maxTick + minScore; scoreCutoffTextField.setText(String.format("%.2f", threshold)); } if (!lockSpec) { if (selectedModel().getSpecEstimator() != null) { setSpecificity(threshold); specificityTextField.setText(String.format("%.2f", specificity * 100)); } } if (!source.getValueIsAdjusting()) { // does not work result.setThreshold(selectedModel(), threshold); if (phosphoCheckBox.isSelected()) { runResetProteinList(); } else { resetDisplay(); } } }
From source file:com.alvermont.terraj.planet.ui.MainFrame.java
private void lonSpinnerStateChanged(javax.swing.event.ChangeEvent evt)//GEN-FIRST:event_lonSpinnerStateChanged {//GEN-HEADEREND:event_lonSpinnerStateChanged final JSpinner source = (JSpinner) evt.getSource(); params.getProjectionParameters().setLat((Double) source.getValue()); }
From source file:com.alvermont.terraj.planet.ui.MainFrame.java
private void latSpinnerStateChanged(javax.swing.event.ChangeEvent evt)//GEN-FIRST:event_latSpinnerStateChanged {//GEN-HEADEREND:event_latSpinnerStateChanged final JSpinner source = (JSpinner) evt.getSource(); params.getProjectionParameters().setLat((Double) source.getValue()); }
From source file:com.alvermont.terraj.planet.ui.MainFrame.java
private void scaleSpinnerStateChanged(javax.swing.event.ChangeEvent evt)//GEN-FIRST:event_scaleSpinnerStateChanged {//GEN-HEADEREND:event_scaleSpinnerStateChanged final JSpinner source = (JSpinner) evt.getSource(); params.getProjectionParameters().setScale((Double) source.getValue()); }
From source file:com.alvermont.terraj.planet.ui.MainFrame.java
private void hgridSpinnerStateChanged(javax.swing.event.ChangeEvent evt)//GEN-FIRST:event_hgridSpinnerStateChanged {//GEN-HEADEREND:event_hgridSpinnerStateChanged final JSpinner source = (JSpinner) evt.getSource(); params.getProjectionParameters().setHgrid((Double) source.getValue()); }
From source file:com.alvermont.terraj.planet.ui.MainFrame.java
private void vgridSpinnerStateChanged(javax.swing.event.ChangeEvent evt)//GEN-FIRST:event_vgridSpinnerStateChanged {//GEN-HEADEREND:event_vgridSpinnerStateChanged final JSpinner source = (JSpinner) evt.getSource(); params.getProjectionParameters().setVgrid((Double) source.getValue()); }
From source file:grupob.TipoProceso.java
public TipoProceso() { initComponents();// ww w . j a va 2s. co m initInstitucional(); // listaRegiones.add(new Region(1,"Lima",15000)); // listaRegiones.add(new Region(1,"Arequipa",10000)); // listaRegiones.add(new Region(1,"Junin",12000)); TipoProcesoVotacion tipoNacional = Manager.queryProcesoById(1); TipoProcesoVotacion tipoRegional = Manager.queryProcesoById(2); TipoProcesoVotacion tipoDistrital = Manager.queryProcesoById(3); Calendar cal = Calendar.getInstance(); Date dateActual = cal.getTime(); textConfGeneral.setText(Recorte.rutaGeneral); textConfHuellas.setText(Recorte.rutaHuella); textConfFirmas.setText(Recorte.rutaFirma); /* Recorte.rutaGeneral = FramePrincipal.rutaGeneral; Recorte.rutaHuella = FramePrincipal.rutaHuella; Recorte.rutaFirma = FramePrincipal.rutaFirma;*/ if (tipoNacional != null && tipoNacional.getId() != 0) { if (!tipoNacional.getFechaInicio2().after(dateActual)) { fechai1Nacional.setDate(tipoNacional.getFechaInicio1().getTime()); fechai2Nacional.setDate(tipoNacional.getFechaInicio2().getTime()); fechaf1Nacional.setDate(tipoNacional.getFechaFin1().getTime()); fechaf2Nacional.setDate(tipoNacional.getFechaFin2().getTime()); } if ((tipoNacional.getFechaInicio1().before(dateActual)) && (cal.before(tipoNacional.getFechaFin2()))) { botonGuardarNacional.setEnabled(false); } if (tipoNacional.getFechaFin2().before(dateActual)) { botonGuardarNacional.setEnabled(true); } } if (tipoRegional != null && tipoRegional.getId() != 0) { if (!tipoRegional.getFechaInicio2().after(dateActual)) { fechai1Regiones.setDate(tipoRegional.getFechaInicio1().getTime()); fechai2Regiones.setDate(tipoRegional.getFechaInicio2().getTime()); fechaf1Regiones.setDate(tipoRegional.getFechaFin1().getTime()); fechaf2Regiones.setDate(tipoRegional.getFechaFin2().getTime()); porcentajeRegional.setText("" + tipoRegional.getPorcentajeMinimo() * 100); } if ((tipoRegional.getFechaInicio1().before(dateActual)) && (cal.before(tipoRegional.getFechaFin2()))) { botonGuardarRegional.setEnabled(false); } if (tipoRegional.getFechaFin2().before(dateActual)) { botonGuardarRegional.setEnabled(true); } } if (tipoDistrital != null && tipoDistrital.getId() != 0) { if (!tipoRegional.getFechaInicio2().after(dateActual)) { fechai1Distritos.setDate(tipoDistrital.getFechaInicio1().getTime()); fechai2Distritos.setDate(tipoDistrital.getFechaInicio2().getTime()); fechaf1Distritos.setDate(tipoDistrital.getFechaFin1().getTime()); fechaf2Distritos.setDate(tipoDistrital.getFechaFin2().getTime()); porcentajeDistrital.setText("" + tipoDistrital.getPorcentajeMinimo() * 100); } if ((tipoDistrital.getFechaInicio1().before(dateActual)) && (cal.before(tipoDistrital.getFechaFin2()))) { botonGuardarDistrital.setEnabled(false); // addRowRegional.setEnabled(false); // jTable6.setEnabled(false); } if (tipoDistrital.getFechaFin2().before(dateActual)) { botonGuardarDistrital.setEnabled(true); // addRowRegional.setEnabled(true); } } agregarDatos(); agregarDatosDistritos(); if (listaRegiones != null) { jTableRegiones.getColumn("Eliminar").setCellRenderer(new ButtonRenderer()); jTableRegiones.getColumn("Eliminar").setCellEditor(new botonEliminarRegiones()); } if (listaDistritos != null) { jTableDistritos.getColumn("Eliminar").setCellRenderer(new ButtonRenderer()); jTableDistritos.getColumn("Eliminar").setCellEditor(new botonEliminarDistritos()); } TableColumn sColumn = jTableDistritos.getColumnModel().getColumn(2); ArrayList<Region> lReg = Manager.queryAllRegion(); JComboBox comboBox = new JComboBox(); for (int i = 0; i < lReg.size(); i++) { comboBox.addItem(lReg.get(i).getNombre()); } sColumn.setCellEditor(new DefaultCellEditor(comboBox)); TableColumn instColumn = tblInstitucional.getColumnModel().getColumn(2); ArrayList<Local> lLoc = Manager.queryAllLocales(); JComboBox comboBoxLocal = new JComboBox(); for (int i = 0; i < lLoc.size(); i++) { comboBoxLocal.addItem(lLoc.get(i).getNombre()); } instColumn.setCellEditor(new DefaultCellEditor(comboBoxLocal)); ChangeListener changeListener = new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { JTabbedPane sourceTabbedPane = (JTabbedPane) e.getSource(); int index = sourceTabbedPane.getSelectedIndex(); switch (index) { case 3: cargarDatosLocal(); return; default: return; } } }; jconfiguracion.addChangeListener(changeListener); }
From source file:forms.frDados.java
/** * Atualiza o raio no controlador do mapa OSM * @param evt //from w ww. java 2s .co m */ private void sldRaioMarcStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_sldRaioMarcStateChanged if (mapOsm == null) return; JSlider source = (JSlider) evt.getSource(); mapOsm.getMapController().setRaio((float) source.getValue()); mapOsm.getMapController().refreshCandidato(); lblRaio.setText(new Integer(sldRaioMarc.getValue()).toString()); }