Java Code Examples for java.awt.event.ActionEvent
The following code examples are extracted from open source projects. You can click to
vote up the examples that are useful to you.
Example 1
From project 3Dto2DApplet, under directory /src/java/nl/dannyarends/generator/model/.
Source file: Value.java

Value(){ setLayout(new FlowLayout()); for ( Type t : Type.values()) { typeIn.addItem(t.internalname); } typeIn.addActionListener(new ActionListener(){ public void actionPerformed( ActionEvent e){ System.out.println(((JComboBox)e.getSource()).getSelectedItem()); } } ); UpdateBtn.addActionListener(new ActionListener(){ public void actionPerformed( ActionEvent e){ type=Type.getType((String)typeIn.getSelectedItem()); val=valueIn.getText(); } } ); add(typelbl); add(typeIn); add(valuelbl); add(valueIn); add(UpdateBtn); }
Example 2
From project addis, under directory /application/src/main/java/org/drugis/addis/gui/.
Source file: AddisWindow.java

private JButton createToolbarButton(final CategoryKnowledge knowledge){ String title="New " + knowledge.getSingularCapitalized(); JButton topAddStudyButton=new JButton(title,Main.IMAGELOADER.getIcon(knowledge.getNewIconName())); topAddStudyButton.setToolTipText(title); topAddStudyButton.addActionListener(new AbstractAction(){ public void actionPerformed( final ActionEvent e){ showAddDialog(knowledge,null); } } ); return topAddStudyButton; }
Example 3
From project addis, under directory /application/src/main/java/org/drugis/addis/gui/.
Source file: AddisWindow.java

private JMenuItem createAboutItem(){ JMenuItem item=new JMenuItem("About"); item.setMnemonic('a'); item.addActionListener(new AbstractAction(){ public void actionPerformed( final ActionEvent arg0){ showAboutDialog(); } } ); return item; }
Example 4
public MainPanel(TestMainUI fram){ this.screen=Utility.createImage(width,height,true); this.setPreferredSize(new Dimension(width,height)); this.graphics=(Graphics2D)screen.getGraphics(); graphics.drawImage(backgroundImage,0,0,null); this.fram=fram; this.repaint(); this.addMouseListener(new MouseListener(){ @Override public void mouseClicked( MouseEvent e){ Timer timer=new Timer(3000,new ActionListener(){ @Override public void actionPerformed( ActionEvent e){ Random random=new Random(System.nanoTime()); if (MainPanel.this.fram.state == 0) { new InfoStatusDialog(TestMainUI.this,String.valueOf(random.nextLong())); } } } ); timer.start(); timer.setRepeats(true); } @Override public void mouseEntered( MouseEvent e){ } @Override public void mouseExited( MouseEvent e){ } @Override public void mousePressed( MouseEvent e){ } @Override public void mouseReleased( MouseEvent e){ } } ); }
Example 5
From project Agot-Java, under directory /src/main/java/got/ui/.
Source file: InfluenceDialog.java

public InfluenceDialog(Node node){ super(node.gameFrame); int width=480; int height=198; this.setSize(width,height); this.setLocationRelativeTo(node.gameFrame); this.add(createPanel()); this.setUndecorated(true); this.setVisible(true); Timer timer=new Timer(3000,new ActionListener(){ public void actionPerformed( ActionEvent e){ InfluenceDialog.this.dispose(); } } ); timer.setRepeats(true); timer.start(); }
Example 6
@Override public void actionPerformed(ActionEvent evt){ super.actionPerformed(evt); if (evt.getSource() == B23) { ((AA)M.D).setMode23(B23.isSelected()); } }
Example 7
@Override public void actionPerformed(ActionEvent evt){ super.actionPerformed(evt); if (evt.getSource() == order) { ((BST)M.D).order=order.isSelected(); } }
Example 8
From project androvoip, under directory /src/com/mexuar/corraleta/faceless/.
Source file: Faceless.java

/** * Register with the infrastructure so that calls may be made. This method is called via javascript in the register() method. The value is passed from the webpage via javascript. <p> This method will be called in javascript, which is not trusted (even though the jar itself is signed). For that reason we use the Timer ActionListener, so the swing thread will 'transfer' this method from an untrusted to a trusted environment. Also, it will make sure the method 'registered' isn't called too soon, this might cause an re-entrant problem with javascript. </p> * @see #registered */ public void register(){ if (_peer == null && _bind != null && _user != null && _pass != null) { ActionListener ans=new ActionListener(){ public void actionPerformed( ActionEvent e){ if (isExpired() == false) { try { Log.debug("register() _bind = " + _bind); _bind.register(_user,_pass,_pevl,_incoming); } catch ( Exception ex) { Log.warn("register " + ex.getClass().getName() + ": "+ ex.getMessage()); show("register " + ex.getMessage()); } showTrialDaysLeft(); } else { showTrialExpired(); } } } ; Timer timer=new Timer(100,ans); timer.setRepeats(false); timer.start(); } else { show("can't register"); } }
Example 9
From project autopsy, under directory /Core/src/org/sleuthkit/autopsy/casemodule/.
Source file: AddImageAction.java

/** * The constructor for AddImageAction class */ public AddImageAction(){ putValue(Action.NAME,NbBundle.getMessage(AddImageAction.class,"CTL_AddImage")); toolbarButton.addActionListener(new ActionListener(){ @Override public void actionPerformed( ActionEvent e){ AddImageAction.this.actionPerformed(e); } } ); this.setEnabled(false); }
Example 10
From project autopsy, under directory /Core/src/org/sleuthkit/autopsy/casemodule/.
Source file: AddImageAction.java

/** * Pop-up the "Add Image" wizard panel. * @param e */ @Override public void actionPerformed(ActionEvent e){ Logger.noteAction(AddImageAction.class); final IngestConfigurator ingestConfig=Lookup.getDefault().lookup(IngestConfigurator.class); if (ingestConfig.isIngestRunning()) { final String msg="<html>Ingest is ongoing on another image. Adding a new image now might slow down the current ingest.<br />Do you want to proceed and add a new image now?</html>"; if (JOptionPane.showConfirmDialog(null,msg,"Ingest in progress",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE) == JOptionPane.NO_OPTION) { return; } } iterator=new AddImageWizardIterator(this); wizardDescriptor=new WizardDescriptor(iterator); wizardDescriptor.setTitle("Add Image"); wizardDescriptor.putProperty(NAME,e); if (dialog != null) { dialog.setVisible(false); } dialog=DialogDisplayer.getDefault().createDialog(wizardDescriptor); dialog.setVisible(true); dialog.toFront(); runCleanupTasks(); }
Example 11
From project BDSup2Sub, under directory /src/main/java/bdsup2sub/gui/edit/.
Source file: EditDialogController.java

@Override public void actionPerformed(ActionEvent event){ if (model.getIndex() > 0) { view.setIndex(model.getIndex() - 1); setEdited(false); } }
Example 12
From project BDSup2Sub, under directory /src/main/java/bdsup2sub/gui/edit/.
Source file: EditDialogController.java

@Override public void actionPerformed(ActionEvent event){ if (model.getIndex() < Core.getNumFrames() - 1) { view.setIndex(model.getIndex() + 1); setEdited(false); } }
Example 13
From project beam-meris-icol, under directory /src/main/java/org/esa/beam/meris/icol/ui/.
Source file: IcolForm.java

IcolForm(AppContext appContext,IcolModel icolModel,TargetProductSelector targetProductSelector){ this.appContext=appContext; bc=new BindingContext(icolModel.getPropertyContainer()); this.targetProductSelector=targetProductSelector; sourceProductSelector=new SourceProductSelector(appContext,"Input-Product (MERIS L1b, Landsat5 TM or Landsat7 ETM+):"); cloudProductSelector=new SourceProductSelector(appContext,"Cloud-Product:"); initComponents(); JComboBox sourceComboBox=sourceProductSelector.getProductNameComboBox(); final PropertyContainer valueContainer=targetProductSelector.getModel().getValueContainer(); sourceComboBox.addActionListener(new ActionListener(){ @Override public void actionPerformed( ActionEvent e){ updateProductTypeSettings(); if (isEnvisatSourceProduct(IcolForm.this.sourceProductSelector.getSelectedProduct()) && radianceProductTypeButton.isSelected()) { valueContainer.setValue("formatName",EnvisatConstants.ENVISAT_FORMAT_NAME); } } } ); PropertyChangeListener formatNameChangeListener=new PropertyChangeListener(){ @Override public void propertyChange( PropertyChangeEvent evt){ updateProductFormatChange(); } } ; valueContainer.addPropertyChangeListener("formatName",formatNameChangeListener); icolContainer=icolModel.getPropertyContainer(); bindComponents(); updateUIStates(); }
Example 14
From project beam-meris-icol, under directory /src/main/java/org/esa/beam/meris/icol/ui/.
Source file: IcolForm.java

private JPanel createCTPPanel(){ TableLayout layout=new TableLayout(3); layout.setTableAnchor(TableLayout.Anchor.WEST); layout.setTableFill(TableLayout.Fill.HORIZONTAL); layout.setColumnWeightX(0,0.1); layout.setColumnWeightX(1,0.1); layout.setColumnWeightX(2,1); layout.setCellColspan(0,0,3); layout.setCellColspan(1,0,3); layout.setTablePadding(2,2); layout.setCellPadding(2,0,new Insets(0,24,0,0)); layout.setCellPadding(3,0,new Insets(0,24,0,0)); JPanel panel=new JPanel(layout); panel.setBorder(BorderFactory.createTitledBorder("Cloud Top Pressure")); ctpGroup=new ButtonGroup(); icolCtp=new JRadioButton("Compute by algorithm"); icolCtp.setSelected(true); panel.add(icolCtp); ctpGroup.add(icolCtp); userCtp=new JRadioButton("Use constant value"); userCtp.setSelected(false); panel.add(userCtp); ctpGroup.add(userCtp); ctpValue=new JFormattedTextField("1013.0"); userCtpLabel=new JLabel("CTP: "); panel.add(userCtpLabel); panel.add(ctpValue); panel.add(new JPanel()); ActionListener ctpActionListener=new ActionListener(){ @Override public void actionPerformed( ActionEvent e){ updateCtpUIstate(); } } ; icolCtp.addActionListener(ctpActionListener); userCtp.addActionListener(ctpActionListener); return panel; }
Example 15
From project beam-third-party, under directory /beam-meris-veg/src/main/java/org/esa/beam/processor/baer/ui/.
Source file: BaerUi.java

/** * Creates all user interface components and sets them to their appropriate default values */ private void createUI(){ int line=0; JPanel ioParamPanel=GridBagUtils.createDefaultEmptyBorderPanel(); GridBagConstraints gbc=GridBagUtils.createConstraints(null); addParameterToPanel(ioParamPanel,DefaultRequestElementFactory.INPUT_PRODUCT_PARAM_NAME,line,12,gbc); line+=2; addParameterToPanel(ioParamPanel,DefaultRequestElementFactory.OUTPUT_PRODUCT_PARAM_NAME,line,12,gbc); line+=10; final JLabel outFormatLabel=new JLabel(OUT_FORMAT_LABEL); _fileFormatCombo=new JComboBox(_fileFormatNames); _fileFormatCombo.addActionListener(new ActionListener(){ public void actionPerformed( final ActionEvent e){ updateOutFileType(); } } ); GridBagUtils.setAttributes(gbc,"anchor=SOUTHWEST, fill=NONE, insets.top=12, weightx = 0, weighty=0.5, gridy=" + String.valueOf(line++)); GridBagUtils.addToPanel(ioParamPanel,outFormatLabel,gbc); GridBagUtils.setAttributes(gbc,"anchor=NORTHWEST, weighty=0.5, insets.top=0 ,gridy=" + String.valueOf(line++)); GridBagUtils.addToPanel(ioParamPanel,_fileFormatCombo,gbc); JPanel procParamPanel=GridBagUtils.createDefaultEmptyBorderPanel(); gbc=GridBagUtils.createConstraints(null); addParameterToPanel2(procParamPanel,BaerConstants.USE_CLOUD_PARAM_NAME,line++,12,false,gbc); addParameterToPanel2(procParamPanel,BaerConstants.USE_BAER_PARAM_NAME,line++,2,false,gbc); addParameterToPanel2(procParamPanel,BaerConstants.USE_ATM_COR_PARAM_NAME,line++,2,false,gbc); addParameterToPanel2(procParamPanel,BaerConstants.SMAC_PARAM_NAME,line++,12,true,gbc); addParameterToPanel2(procParamPanel,BaerConstants.AER_PHASE_PARAM_NAME,line++,2,true,gbc); addParameterToPanel2(procParamPanel,BaerConstants.BITMASK_PARAM_NAME,line++,12,false,gbc); getParameter(BaerConstants.USE_CLOUD_PARAM_NAME).getEditor().setEnabled(false); final JTabbedPane tabbedPane=new JTabbedPane(); tabbedPane.addTab("I/O Parameters",ioParamPanel); tabbedPane.addTab("Processing Parameters",procParamPanel); _uiComponent=tabbedPane; }
Example 16
From project beam-third-party, under directory /beam-meris-veg/src/main/java/org/esa/beam/processor/toa/ui/.
Source file: ToaVegUi.java

/** * Creates all user interface components and sets them to their appropriate default values */ private void createUI(){ int line=0; _panel=GridBagUtils.createDefaultEmptyBorderPanel(); final GridBagConstraints gbc=GridBagUtils.createConstraints(null); addParameterToPanel(_panel,DefaultRequestElementFactory.INPUT_PRODUCT_PARAM_NAME,line,12,gbc); line+=2; addParameterToPanel(_panel,DefaultRequestElementFactory.OUTPUT_PRODUCT_PARAM_NAME,line,12,gbc); line+=2; final JLabel outFormatLabel=new JLabel(OUT_FORMAT_LABEL); _fileFormatCombo=new JComboBox(_fileFormatNames); _fileFormatCombo.addActionListener(new ActionListener(){ public void actionPerformed( final ActionEvent e){ updateOutFileType(); } } ); GridBagUtils.setAttributes(gbc,"anchor=SOUTHWEST, fill=NONE, insets.top=12, weightx = 0, weighty=0.5, gridy=" + String.valueOf(line++)); GridBagUtils.addToPanel(_panel,outFormatLabel,gbc); GridBagUtils.setAttributes(gbc,"anchor=NORTHWEST, weighty=0.5, insets.top=0 ,gridy=" + String.valueOf(line++)); GridBagUtils.addToPanel(_panel,_fileFormatCombo,gbc); addParameterToPanel(_panel,ToaVegConstants.BITMASK_PARAM_NAME,line,12,gbc); }
Example 17
From project beanmill_1, under directory /src/main/java/com/traxel/lumbermill/desk/.
Source file: MillAction.java

@Override public void actionPerformed(final ActionEvent e){ final Mill mill; mill=getMill(); if (mill != null) { desktopControl.add(mill.getMillFrame()); } else { System.err.println("Null Mill? Probably unparseable settings."); } }
Example 18
From project beanmill_1, under directory /src/main/java/com/traxel/lumbermill/event/.
Source file: ColumnSetControl.java

@Override public void actionPerformed(final ActionEvent e){ final JCheckBoxMenuItem item; item=(JCheckBoxMenuItem)e.getSource(); if (item.getState()) { COLUMN_SET.addColumn(COLUMN); } else { COLUMN_SET.removeColumn(COLUMN); } }
Example 19
From project BioMAV, under directory /Behavior/src/nl/ru/ai/projects/parrot/biomav/editor/.
Source file: BehaviorEditor.java

private void setNewSelectedParameterControlInterface(ParameterControlInterface pcInterface){ pcInterfacePanelContents.removeAll(); selectedPCInterface=null; if (pcInterface != null) { selectedPCInterface=pcInterface; final ParameterControlInterface fpcInterface=pcInterface; String[] parameterNames=pcInterface.getParameterNames(); ParameterControlInterface.ParameterTypes[] parameterTypes=pcInterface.getParameterTypes(); for (int i=0; i < parameterTypes.length; i++) { JLabel label=new JLabel(parameterNames[i]); pcInterfacePanelContents.add(label); final int index=i; switch (parameterTypes[i]) { case OPTIONS: final JComboBox optionComboBox=new JComboBox(pcInterface.getParameterOptions(i)); optionComboBox.setEditable(false); optionComboBox.setSelectedItem(pcInterface.getParameterValue(i)); optionComboBox.addActionListener(new ActionListener(){ @Override public void actionPerformed( ActionEvent e){ fpcInterface.setParameterValue(index,optionComboBox.getSelectedItem()); repaint(); } } ); pcInterfacePanelContents.add(optionComboBox); break; } } } pcInterfacePanel.validate(); }
Example 20
public void actionPerformed(ActionEvent event){ currentButton.setContentAreaFilled(false); JButton clickedButton=(JButton)event.getSource(); clickedButton.setBackground(Color.LIGHT_GRAY); clickedButton.setContentAreaFilled(true); currentButton=clickedButton; contentPane=getContentPane(); contentPane.remove(currentPanel); currentPanel=panelList.get(event.getActionCommand()); contentPane.add(currentPanel); contentPane.validate(); repaint(); }
Example 21
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") private void initComponents(){ jPanel1=new javax.swing.JPanel(); jButton1=new javax.swing.JButton(); jPanel2=new javax.swing.JPanel(); jScrollPane1=new javax.swing.JScrollPane(); jEditorPane1=new javax.swing.JEditorPane(); setTitle("BMach - Help Contents"); jButton1.setText("Close"); jButton1.addActionListener(new java.awt.event.ActionListener(){ public void actionPerformed( java.awt.event.ActionEvent evt){ jButton1ActionPerformed(evt); } } ); jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jPanel2.setLayout(new javax.swing.BoxLayout(jPanel2,javax.swing.BoxLayout.LINE_AXIS)); jScrollPane1.setBackground(new java.awt.Color(255,255,255)); jEditorPane1.setBackground(new java.awt.Color(255,255,255)); jEditorPane1.setContentType("text/html"); jEditorPane1.setEditable(false); jScrollPane1.setViewportView(jEditorPane1); jPanel2.add(jScrollPane1); javax.swing.GroupLayout jPanel1Layout=new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel1Layout.createSequentialGroup().addContainerGap().addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jButton1,javax.swing.GroupLayout.Alignment.TRAILING,javax.swing.GroupLayout.PREFERRED_SIZE,118,javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jPanel2,javax.swing.GroupLayout.DEFAULT_SIZE,766,Short.MAX_VALUE)).addContainerGap())); jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(javax.swing.GroupLayout.Alignment.TRAILING,jPanel1Layout.createSequentialGroup().addContainerGap().addComponent(jPanel2,javax.swing.GroupLayout.DEFAULT_SIZE,414,Short.MAX_VALUE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jButton1).addContainerGap())); javax.swing.GroupLayout layout=new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jPanel1,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,Short.MAX_VALUE)); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jPanel1,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,Short.MAX_VALUE)); pack(); }
Example 22
public void actionPerformed(ActionEvent e){ try { docIOMngr.createNew(getDialogParent(),new BMAFileFilter()); } catch ( IOException ioe) { showError("BMach - Error","I/O error:","An error occured while trying to save the file."); } }
Example 23
From project Briss, under directory /src/main/java/at/laborg/briss/gui/.
Source file: MergedPanel.java

@Override public void actionPerformed(ActionEvent e){ if (PopUpMenuForCropRectangles.DELETE.equals(e.getActionCommand())) { for ( Rectangle crop : crops) { if (crop.contains(popUpMenuPoint)) { crops.remove(crop); break; } } cluster.clearRatios(); repaint(); } else if (PopUpMenuForCropRectangles.SELECT_DESELECT.equals(e.getActionCommand())) { changeSelectRectangle(popUpMenuPoint); } else if (PopUpMenuForCropRectangles.COPY.equals(e.getActionCommand())) { copyToClipBoard(); } else if (PopUpMenuForCropRectangles.PASTE.equals(e.getActionCommand())) { pasteFromClipBoard(); } else if (PopUpMenuForCropRectangles.ALIGN_SELECTED.equals(e.getActionCommand())) { alignSelected(popUpMenuPoint); } }
Example 24
@Override public void actionPerformed(ActionEvent e){ if (e.getSource() == m_prev_button) { m_month--; if (m_month < 0) { m_month+=12; m_year--; } RenderMV(); } else if (e.getSource() == m_next_button) { m_month++; if (m_month > 11) { m_month-=12; m_year++; } RenderMV(); } }