List of usage examples for java.awt.event ActionEvent getSource
public Object getSource()
From source file:org.gridchem.client.gui.panels.myccg.resource.HPCChartPanel.java
private JPanel createSelectionBar() { ActionListener chartNavigationAL = new ActionListener() { public void actionPerformed(ActionEvent event) { // change the chart display via a circular scrolling // list of chart types. if (event.getSource() == nextButton) { CURRENT_CHARTTYPE = CURRENT_CHARTTYPE.next(); chartTypeComboBox.setSelectedItem(CURRENT_CHARTTYPE); } else if (event.getSource() == previousButton) { CURRENT_CHARTTYPE = CURRENT_CHARTTYPE.previous(); chartTypeComboBox.setSelectedItem(CURRENT_CHARTTYPE); } else if (event.getSource() == reloadButton) { // TODO:call GMS.getUserVO and refresh the user's vo // before refreshing this screen GETHARDWARECommand command = new GETHARDWARECommand(statusListener); command.getArguments().put("project.id", GridChem.project.getId()); statusListener.statusChanged(new StatusEvent(command, Status.START)); }//from w w w . j a v a 2 s.com } }; // create buttons with left and right icons to scroll through // the possible chart types, changing the chart display with // each click nextButton = new JButton(new ImageIcon(Env.getImagesDir() + "/navigation/forward.jpg")); nextButton.addActionListener(chartNavigationAL); previousButton = new JButton(new ImageIcon(Env.getImagesDir() + "/navigation/back.jpg")); previousButton.addActionListener(chartNavigationAL); reloadButton = new JButton(new ImageIcon(Env.getImagesDir() + "/navigation/reload.jpg")); reloadButton.addActionListener(chartNavigationAL); reloadButton.setPreferredSize(new Dimension(35, 35)); // create chart type selection combo box JLabel chartTypeLabel = new JLabel("Chart Type"); chartTypeLabel.setLabelFor(chartTypeComboBox); chartTypeComboBox = new JComboBox(ChartType.values()); chartTypeComboBox.setEditable(false); chartTypeComboBox.addActionListener(new ActionListener() { // change the charts depending on the selection of the chart type public void actionPerformed(ActionEvent e) { setChartDisplayType((ChartType) ((JComboBox) e.getSource()).getSelectedItem()); } }); // create chart type selection combo box JLabel loadTypeLabel = new JLabel("Load Type"); loadTypeLabel.setLabelFor(loadTypeComboBox); loadTypeComboBox = new JComboBox(LoadType.values()); loadTypeComboBox.setEditable(false); loadTypeComboBox.addActionListener(new ActionListener() { // change the charts depending on the selection of the chart type public void actionPerformed(ActionEvent e) { setChartDisplayType((LoadType) ((JComboBox) e.getSource()).getSelectedItem()); } }); JPanel buttonPanel = new JPanel(); buttonPanel.add(previousButton, BorderLayout.LINE_END); buttonPanel.add(reloadButton, BorderLayout.LINE_END); buttonPanel.add(nextButton, BorderLayout.LINE_END); buttonPanel.add(loadTypeLabel, BorderLayout.LINE_END); buttonPanel.add(loadTypeComboBox, BorderLayout.LINE_END); buttonPanel.add(chartTypeLabel, BorderLayout.LINE_END); buttonPanel.add(chartTypeComboBox, BorderLayout.LINE_END); return buttonPanel; }
From source file:sanger.team16.gui.genevar.eqtl.snp.CisEQTLSNPPane.java
private void cisSNPPaneActionPerformed(ActionEvent ae) { int studyIndex = cbStudy.getSelectedIndex(); int statisticIndex = cbStatistic.getSelectedIndex(); //SelectedIndex selectedIndex = new SelectedIndex(studyIndex, this.getStudyReferenceIndex(studyIndex), statisticIndex, taSNP.getText()); //CHANGE 07/12/11 dun know? only do it if ae.getSource() == cbStudy //int referenceIndex = cbReference.getSelectedIndex(); //TODO merge into SelectedIndex //int referenceId = ((Reference) cbReference.getSelectedItem()).getId(); //TODO if (ae.getSource() == cbStudy) { if (studyIndex == 0) this.refresh(new SelectedIndex()); else { //TODO //List<MatchedFeature> matchedFeatures = this.getMatchedFeatures(study.getId()); //this.matchedFeatureTable = new MatchedFeatureTableModel(matchedFeatures).getTable(); statisticIndex = 0; //ADD 02/12/10 this.refresh(new SelectedIndex(studyIndex, this.getStudyReferenceIndex(studyIndex), statisticIndex, taSNP.getText()));/*from www. jav a 2 s .co m*/ this.setSubmitButton(); } isDefault = true; //ADD 02/12/10 } else if (ae.getSource() == cbReference) { this.setSubmitButton(); // ADD 18/06/10 } else if (ae.getSource() == cbStatistic) { this.refresh(new SelectedIndex(studyIndex, this.getStudyReferenceIndex(studyIndex), statisticIndex, taSNP.getText())); this.setSubmitButton(); } else if (ae.getSource() == bReset) { this.refresh(new SelectedIndex()); } else if (ae.getSource() == bSNPFile) { this.ui.addChoosableFileFilter(Message.TXT); if (this.ui.showFileChooserOpenDialog(this.ui, null)) tfSNPFile.setText(this.ui.getFileChooserSelectedFile().getAbsolutePath()); } else if (ae.getSource() == bSubmit) { int distance = new Integer(((String) cbDistance.getSelectedItem()).replaceAll(",", "")); if (distance > 1000000) JOptionPane.showMessageDialog(ui, "No greater than 1 Mb", "Distance to SNP", JOptionPane.WARNING_MESSAGE); else new CisSNPPaneProgressBar().execute(); //bSubmit.setEnabled(false); } }
From source file:sanger.team16.gui.genevar.mqtl.snp.CisMQTLSNPPane.java
private void cisSNPPaneActionPerformed(ActionEvent ae) { int studyIndex = cbStudy.getSelectedIndex(); int statisticIndex = cbStatistic.getSelectedIndex(); //SelectedIndex selectedIndex = new SelectedIndex(studyIndex, this.getStudyReferenceIndex(studyIndex), statisticIndex, taSNP.getText()); //CHANGE 07/12/11 dun know? only do it if ae.getSource() == cbStudy //int referenceIndex = cbReference.getSelectedIndex(); //TODO merge into SelectedIndex //int referenceId = ((Reference) cbReference.getSelectedItem()).getId(); //TODO if (ae.getSource() == cbStudy) { if (studyIndex == 0) this.refresh(new SelectedIndex()); else { //TODO //List<MatchedFeature> matchedFeatures = this.getMatchedFeatures(study.getId()); //this.matchedFeatureTable = new MatchedFeatureTableModel(matchedFeatures).getTable(); statisticIndex = 0; //ADD 02/12/10 this.refresh(new SelectedIndex(studyIndex, this.getStudyReferenceIndex(studyIndex), statisticIndex, taSNP.getText()));//ww w . j a v a 2s . c o m this.setSubmitButton(); } isDefault = true; //ADD 02/12/10 } else if (ae.getSource() == cbReference) { this.setSubmitButton(); // ADD 18/06/10 } else if (ae.getSource() == cbStatistic) { this.refresh(new SelectedIndex(studyIndex, this.getStudyReferenceIndex(studyIndex), statisticIndex, taSNP.getText())); this.setSubmitButton(); } else if (ae.getSource() == bReset) { this.refresh(new SelectedIndex()); } else if (ae.getSource() == bSNPFile) { this.ui.addChoosableFileFilter(Message.TXT); if (this.ui.showFileChooserOpenDialog(this.ui, null)) tfSNPFile.setText(this.ui.getFileChooserSelectedFile().getAbsolutePath()); } else if (ae.getSource() == bSubmit) { int distance = new Integer(((String) cbDistance.getSelectedItem()).replaceAll(",", "")); if (distance > 100000) JOptionPane.showMessageDialog(ui, "No greater than 100 kb", "Distance to SNP", JOptionPane.WARNING_MESSAGE); else new CisSNPPaneProgressBar().execute(); //bSubmit.setEnabled(false); } }
From source file:com.entertailion.java.fling.FlingFrame.java
/** * Event handler for device dropdown list selection * //from w w w . java 2s.c om * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ public void actionPerformed(ActionEvent e) { JComboBox cb = (JComboBox) e.getSource(); int pos = cb.getSelectedIndex(); // when device is selected, attempt to connect if (servers != null && pos > 0) { selectedDialServer = (DialServer) cb.getSelectedItem(); } }
From source file:cpsViews.ParamsForm.java
private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed JComboBox cb = (JComboBox) evt.getSource(); String signalNames = (String) cb.getSelectedItem(); if (null != signalNames) switch (signalNames) { case "Sygnal_S1": typSygnalu = 1;//from w w w. j a v a 2 s . c o m signalName.setText("SZUM O ROZK?ADZIE JEDNOSTAJNYM"); break; case "Sygnal_S2": typSygnalu = 2; signalName.setText("SZUM GAUSSOWSKI"); break; case "Sygnal_S3": typSygnalu = 3; signalName.setText("SYGNA? SINUSOIDALNY"); break; case "Sygnal_S4": typSygnalu = 4; signalName.setText("SYGNA? SINUSOIDALNY WYPROSTOWANY JEDNOPO?WKOWO"); break; case "Sygnal_S5": typSygnalu = 5; signalName.setText("SYGNA? SINUSOIDALNY WYPROSTOWANY DWUPO?WKOWO"); break; case "Sygnal_S6": typSygnalu = 6; signalName.setText("SYGNA? PROSTOKTNY"); break; case "Sygnal_S7": typSygnalu = 7; signalName.setText("SYGNA? PROSTOKTNY SYMETRYCZNY"); break; case "Sygnal_S8": typSygnalu = 8; signalName.setText("SYGNA? TRJKTNY (PI?OKSZTA?TNY)"); break; case "Sygnal_S9": typSygnalu = 9; signalName.setText("SKOK JEDNOSTKOWY"); break; case "Sygnal_S10": typSygnalu = 10; signalName.setText("IMPULS JEDNOSTKOWY"); break; case "Sygnal_S11": typSygnalu = 11; signalName.setText("SZUM IMPULSOWY"); break; } }
From source file:gui.DownloadManagerGUI.java
private JMenuBar initMenuBar() { JMenuBar menuBar = new JMenuBar(); ///////////////////////////////////////////////////////////////////////// JMenu fileMenu = new JMenu(messagesBundle.getString("downloadManagerGUI.fileMenu.name")); exportDataItem = new JMenuItem("Export Data..."); importDataItem = new JMenuItem("Import Data..."); exitItem = new JMenuItem(messagesBundle.getString("downloadManagerGUI.exitItem.name")); exitItem.setIcon(new javax.swing.ImageIcon( getClass().getResource(messagesBundle.getString("downloadManagerGUI.exitItem.iconPath")))); // NOI18N exportDataItem.setEnabled(false);//from ww w .j a v a 2s . c o m importDataItem.setEnabled(false); // fileMenu.add(exportDataItem); // fileMenu.add(importDataItem); fileMenu.addSeparator(); fileMenu.add(exitItem); ///////////////////////////////////////////////////////////////////////// JMenu windowMenu = new JMenu(messagesBundle.getString("downloadManagerGUI.windowMenu.name")); JMenu showMenu = new JMenu(messagesBundle.getString("downloadManagerGUI.showMenu.name")); prefsItem = new JMenuItem(messagesBundle.getString("downloadManagerGUI.prefsItem.name")); prefsItem.setIcon(new javax.swing.ImageIcon( getClass().getResource(messagesBundle.getString("downloadManagerGUI.prefsItem.iconPath")))); JCheckBoxMenuItem showFormItem = new JCheckBoxMenuItem( messagesBundle.getString("downloadManagerGUI.showFormItem.name")); showFormItem.setSelected(true); showMenu.add(showFormItem); windowMenu.add(showMenu); windowMenu.add(prefsItem); exportDataItem.addActionListener(this); importDataItem.addActionListener(this); exitItem.addActionListener(this); prefsItem.addActionListener(this); ///////////////////////////////////////////////////////////////////////// JMenu downloadsMenu = new JMenu(messagesBundle.getString("downloadManagerGUI.downloadsMenu.name")); newDownloadItem = new JMenuItem(messagesBundle.getString("downloadManagerGUI.newDownloadItem.name")); newDownloadItem.setIcon(new javax.swing.ImageIcon( getClass().getResource(messagesBundle.getString("downloadManagerGUI.newDownloadItem.iconPath")))); openItem = new JMenuItem(messagesBundle.getString("downloadManagerGUI.openItem.name")); openFolderItem = new JMenuItem(messagesBundle.getString("downloadManagerGUI.openFolderItem.name")); resumeItem = new JMenuItem(messagesBundle.getString("downloadManagerGUI.resumeItem.name")); resumeItem.setIcon(new javax.swing.ImageIcon( getClass().getResource(messagesBundle.getString("downloadManagerGUI.resumeItem.iconPath")))); pauseItem = new JMenuItem(messagesBundle.getString("downloadManagerGUI.pauseItem.name")); pauseItem.setIcon(new javax.swing.ImageIcon( getClass().getResource(messagesBundle.getString("downloadManagerGUI.pauseItem.iconPath")))); pauseAllItem = new JMenuItem(messagesBundle.getString("downloadManagerGUI.pauseAllItem.name")); pauseAllItem.setIcon(new javax.swing.ImageIcon( getClass().getResource(messagesBundle.getString("downloadManagerGUI.pauseAllItem.iconPath")))); clearItem = new JMenuItem(messagesBundle.getString("downloadManagerGUI.clearItem.name")); clearItem.setIcon(new javax.swing.ImageIcon( getClass().getResource(messagesBundle.getString("downloadManagerGUI.clearItem.iconPath")))); clearAllCompletedItem = new JMenuItem( messagesBundle.getString("downloadManagerGUI.clearAllCompletedItem.name")); clearAllCompletedItem.setIcon(new javax.swing.ImageIcon(getClass() .getResource(messagesBundle.getString("downloadManagerGUI.clearAllCompletedItem.iconPath")))); reJoinItem = new JMenuItem(messagesBundle.getString("downloadManagerGUI.reJoinItem.name")); reJoinItem.setIcon(new javax.swing.ImageIcon( getClass().getResource(messagesBundle.getString("downloadManagerGUI.reJoinItem.iconPath")))); reDownloadItem = new JMenuItem(messagesBundle.getString("downloadManagerGUI.reDownloadItem.name")); reDownloadItem.setIcon(new javax.swing.ImageIcon( getClass().getResource(messagesBundle.getString("downloadManagerGUI.reDownloadItem.iconPath")))); moveToQueueItem = new JMenuItem(messagesBundle.getString("downloadManagerGUI.moveToQueueItem.name")); removeFromQueueItem = new JMenuItem( messagesBundle.getString("downloadManagerGUI.removeFromQueueItem.name")); propertiesItem = new JMenuItem(messagesBundle.getString("downloadManagerGUI.propertiesItem.name")); propertiesItem.setIcon(new javax.swing.ImageIcon( getClass().getResource(messagesBundle.getString("downloadManagerGUI.propertiesItem.iconPath")))); downloadsMenu.add(newDownloadItem); downloadsMenu.add(new JSeparator()); downloadsMenu.add(openItem); downloadsMenu.add(openFolderItem); downloadsMenu.add(new JSeparator()); downloadsMenu.add(resumeItem); downloadsMenu.add(pauseItem); downloadsMenu.add(pauseAllItem); downloadsMenu.add(new JSeparator()); downloadsMenu.add(clearItem); downloadsMenu.add(clearAllCompletedItem); downloadsMenu.add(new JSeparator()); downloadsMenu.add(reJoinItem); downloadsMenu.add(reDownloadItem); downloadsMenu.add(new JSeparator()); downloadsMenu.add(moveToQueueItem); downloadsMenu.add(removeFromQueueItem); downloadsMenu.add(new JSeparator()); downloadsMenu.add(propertiesItem); newDownloadItem.addActionListener(this); openItem.addActionListener(this); openFolderItem.addActionListener(this); resumeItem.addActionListener(this); pauseItem.addActionListener(this); pauseAllItem.addActionListener(this); clearItem.addActionListener(this); clearAllCompletedItem.addActionListener(this); reDownloadItem.addActionListener(this); moveToQueueItem.addActionListener(this); removeFromQueueItem.addActionListener(this); propertiesItem.addActionListener(this); setStateOfMenuItems(); ///////////////////////////////////////////////////////////////////////// JMenu helpMenu = new JMenu(messagesBundle.getString("downloadManagerGUI.helpMenu.name")); aboutItem = new JMenuItem(messagesBundle.getString("downloadManagerGUI.aboutItem.name")); aboutItem.setIcon(new javax.swing.ImageIcon( getClass().getResource(messagesBundle.getString("downloadManagerGUI.aboutItem.iconPath")))); helpMenu.add(aboutItem); aboutItem.addActionListener(this); menuBar.add(fileMenu); menuBar.add(windowMenu); menuBar.add(downloadsMenu); menuBar.add(helpMenu); showFormItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) ev.getSource(); if (menuItem.isSelected()) { mainSplitPane.setDividerLocation((int) categoryPanel.getMinimumSize().getWidth()); } categoryPanel.setVisible(menuItem.isSelected()); } }); fileMenu.setMnemonic(KeyEvent.VK_F); exitItem.setMnemonic(KeyEvent.VK_X); prefsItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, ActionEvent.CTRL_MASK)); exitItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.CTRL_MASK)); importDataItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_I, ActionEvent.CTRL_MASK)); return menuBar; }
From source file:com.vgi.mafscaling.OpenLoop.java
@Override public void actionPerformed(ActionEvent e) { if (checkActionPerformed(e)) return;/*from w ww. j a va2 s .c o m*/ if ("mafrpm".equals(e.getActionCommand())) { JCheckBox checkBox = (JCheckBox) e.getSource(); if (checkBox.isSelected()) { clearNotRunDataCheckboxes(); if (!plotMafVRpmData()) checkBox.setSelected(false); } else runData.clear(); setRanges(); } else if ("rdata".equals(e.getActionCommand())) { JCheckBox checkBox = (JCheckBox) e.getSource(); if (checkBox.isSelected()) { if (checkBoxMafRpmData.isSelected()) { checkBoxMafRpmData.setSelected(false); runData.clear(); } if (!plotRunData()) checkBox.setSelected(false); } else runData.clear(); setRanges(); } else if ("current".equals(e.getActionCommand())) { JCheckBox checkBox = (JCheckBox) e.getSource(); if (checkBox.isSelected()) { if (checkBoxMafRpmData.isSelected()) { checkBoxMafRpmData.setSelected(false); runData.clear(); } if (!plotCurrentMafData()) checkBox.setSelected(false); } else currMafData.clear(); setRanges(); } else if ("corrected".equals(e.getActionCommand())) { JCheckBox checkBox = (JCheckBox) e.getSource(); if (checkBox.isSelected()) { if (checkBoxMafRpmData.isSelected()) { checkBoxMafRpmData.setSelected(false); runData.clear(); } if (!setCorrectedMafData()) checkBox.setSelected(false); } else corrMafData.clear(); setRanges(); } else if ("smoothed".equals(e.getActionCommand())) { JCheckBox checkBox = (JCheckBox) e.getSource(); if (checkBox.isSelected()) { if (checkBoxMafRpmData.isSelected()) { checkBoxMafRpmData.setSelected(false); runData.clear(); } if (!setSmoothedMafData()) checkBox.setSelected(false); } else smoothMafData.clear(); setRanges(); } else if ("smoothing".equals(e.getActionCommand())) { JCheckBox checkBox = (JCheckBox) e.getSource(); if (checkBox.isSelected()) enableSmoothingView(true); else enableSmoothingView(false); setRanges(); } }
From source file:au.org.ala.delta.editor.DeltaEditor.java
/** * Loads a previously loaded delta file from the Most Recently Used list. It is assumed that the source ActionEvent as set the filename in a client property called "Filename". * //from w ww.ja va2 s .c o m * @param e * The action event that triggered this action * @return A DeltaFileLoader task */ @Action(block = BlockingScope.APPLICATION) public DeltaFileLoader loadPreviousFile(ActionEvent e) { DeltaFileLoader fileOpenTask = null; JComponent item = (JComponent) e.getSource(); if (item != null) { String filename = (String) item.getClientProperty("Filename"); File toOpen = new File(filename); if (toOpen != null && toOpen.exists()) { fileOpenTask = new DeltaFileLoader(this, toOpen); fileOpenTask.addPropertyChangeListener(_statusBar); } else { JOptionPane.showMessageDialog(getMainFrame(), "File not found or not readable!", "File open failed", JOptionPane.ERROR_MESSAGE); item.getParent().remove(item); EditorPreferences.removeFileFromMRU(filename); } } return fileOpenTask; }
From source file:edu.ucla.stat.SOCR.chart.SuperXYChart_QQ.java
public void actionPerformed(ActionEvent evt) { if (evt.getActionCommand().equals(NORMAL)) { try {//from w w w. j av a2 s . c o m disChoice = NORMAL; } catch (Exception e) { e.printStackTrace(); } } else if (evt.getActionCommand().equals(POISSON)) { try { disChoice = POISSON; } catch (Exception e) { e.printStackTrace(); } } else if (evt.getSource() == addButton1) { addButtonDependent(); } else if (evt.getSource() == removeButton1) { removeButtonDependent(); } }
From source file:de.codesourcery.eve.skills.ui.components.impl.AssetListComponent.java
private void actionPerformed(ActionEvent e) { final Object src = e.getSource(); if (src == ignorePackaging || src == ignoreLocations || src == mergeAssetsByType) { updateAssetListModel();//w ww . j av a 2 s . co m } else if (src == filterByLocation || src == locationComboBox) { model.viewFilterChanged(); } else if (src == filterByType || src == typeComboBox) { model.viewFilterChanged(); if (src == filterByType) { updateComboBoxModels(model.getAssetList()); } } else if (src == filterByCategory || src == categoryComboBox) { model.viewFilterChanged(); if (src == filterByCategory) { updateComboBoxModels(model.getAssetList()); } } else if (src == filterByGroup || src == groupComboBox) { model.viewFilterChanged(); if (src == filterByGroup) { updateComboBoxModels(model.getAssetList()); } } }