Java Code Examples for java.awt.event.ActionEvent#getID()
The following examples show how to use
java.awt.event.ActionEvent#getID() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: netbeans File: DialogDisplayer.java License: Apache License 2.0 | 6 votes |
@Override public void actionPerformed( ActionEvent e ) { nd.setValue(option); if (buttonListener != null) { // #34485: some listeners expect that the action source is the option, not the button ActionEvent e2 = new ActionEvent( option, e.getID(), e.getActionCommand(), e.getWhen(), e.getModifiers() ); buttonListener.actionPerformed(e2); } if ((closingOptions == null) || Arrays.asList(closingOptions).contains(option)) { haveFinalValue = true; setVisible(false); } }
Example 2
Source Project: netbeans File: JExtendedSplitPane.java License: Apache License 2.0 | 6 votes |
public void actionPerformed(ActionEvent e) { switch (e.getID()) { case JTitledPanel.STATE_CLOSED: //System.err.println(">>> STATE_CLOSED"); break; case JTitledPanel.STATE_RESTORED: setDividerLocation(getLastDividerLocation()); break; case JTitledPanel.STATE_MAXIMIZED: //System.err.println(">>> STATE_MAXIMIZED"); break; case JTitledPanel.STATE_MINIMIZED: if (e.getSource() == getFirstComponent()) { setDividerLocation(getFirstComponent().getPreferredSize().height); } else { setDividerLocation(getSize().height - dividerSize - getSecondComponent().getPreferredSize().height); } break; } }
Example 3
Source Project: visualvm File: JExtendedSplitPane.java License: GNU General Public License v2.0 | 6 votes |
public void actionPerformed(ActionEvent e) { switch (e.getID()) { case JTitledPanel.STATE_CLOSED: //System.err.println(">>> STATE_CLOSED"); break; case JTitledPanel.STATE_RESTORED: setDividerLocation(getLastDividerLocation()); break; case JTitledPanel.STATE_MAXIMIZED: //System.err.println(">>> STATE_MAXIMIZED"); break; case JTitledPanel.STATE_MINIMIZED: if (e.getSource() == getFirstComponent()) { setDividerLocation(getFirstComponent().getPreferredSize().height); } else { setDividerLocation(getSize().height - dividerSize - getSecondComponent().getPreferredSize().height); } break; } }
Example 4
Source Project: pcgen File: CompanionInfoTab.java License: GNU Lesser General Public License v2.1 | 6 votes |
@Override public void actionPerformed(ActionEvent e) { if (!"null".equals(e.getActionCommand())) { if ("SELECT".equals(e.getActionCommand()) || (e.getID() == JTableEx.ACTION_DOUBLECLICK)) { newCompanion = CharacterManager.createNewCharacter(character.getUIDelegate(), character.getDataSet()); CompanionStubFacade selected = (CompanionStubFacade) raceTable.getSelectedObject(); newCompanion.setRace(selected.getRaceRef().get()); character.getCompanionSupport().addCompanion(newCompanion, companionType); setVisible(false); } else { newCompanion = null; setVisible(false); } } }
Example 5
Source Project: pcgen File: CompanionInfoTab.java License: GNU Lesser General Public License v2.1 | 6 votes |
@Override public void actionPerformed(ActionEvent e) { if (!"null".equals(e.getActionCommand())) { if ("SELECT".equals(e.getActionCommand()) || (e.getID() == JTableEx.ACTION_DOUBLECLICK)) { newCompanion = CharacterManager.createNewCharacter(character.getUIDelegate(), character.getDataSet()); CompanionStubFacade selected = (CompanionStubFacade) raceTable.getSelectedObject(); newCompanion.setRace(selected.getRaceRef().get()); character.getCompanionSupport().addCompanion(newCompanion, companionType); setVisible(false); } else { newCompanion = null; setVisible(false); } } }
Example 6
Source Project: netbeans File: ActionProcessorTest.java License: Apache License 2.0 | 5 votes |
@ActionRegistration(displayName="#AlwaysOn") @ActionID(id="my.test.AlwaysByMethod", category="Tools") @ActionReferences({ @ActionReference(path="Kuk/buk", position=1, separatorAfter=2), @ActionReference(path="Muk/luk", position=11, separatorBefore=10) }) public static ActionListener factory() { created++; return new ActionListener() { public @Override void actionPerformed(ActionEvent e) { cnt += e.getID(); } }; }
Example 7
Source Project: netbeans File: ActionProcessorTest.java License: Apache License 2.0 | 5 votes |
public void testCallbackAction() throws Exception { Callback.cnt = 0; ContextAwareAction a = (ContextAwareAction) Actions.forID("Tools", "my.action"); class MyAction extends AbstractAction { int cnt; @Override public void actionPerformed(ActionEvent e) { cnt += e.getID(); } } MyAction my = new MyAction(); ActionMap m = new ActionMap(); m.put("klic", my); InstanceContent ic = new InstanceContent(); AbstractLookup lkp = new AbstractLookup(ic); Action clone = a.createContextAwareInstance(lkp); ic.add(m); assertEquals("I am context", clone.getValue(Action.NAME)); clone.actionPerformed(new ActionEvent(this, 300, "")); assertEquals("Local Action called", 300, my.cnt); assertEquals("Global Action not called", 0, Callback.cnt); ic.remove(m); clone.actionPerformed(new ActionEvent(this, 200, "")); assertEquals("Local Action stays", 300, my.cnt); assertEquals("Global Action ncalled", 200, Callback.cnt); }
Example 8
Source Project: netbeans File: ActionProcessorTest.java License: Apache License 2.0 | 5 votes |
public void testCallbackOnFieldAction() throws Exception { Callback.cnt = 0; FileObject fo = FileUtil.getConfigFile( "Actions/Edit/my-field-action.instance" ); assertNotNull("File found", fo); Object icon = fo.getAttribute("iconBase"); assertEquals("Icon found", "org/openide/awt/TestIcon.png", icon); Object obj = fo.getAttribute("instanceCreate"); assertNotNull("Attribute present", obj); assertTrue("It is context aware action", obj instanceof ContextAwareAction); ContextAwareAction a = (ContextAwareAction)obj; class MyAction extends AbstractAction { int cnt; @Override public void actionPerformed(ActionEvent e) { cnt += e.getID(); } } MyAction my = new MyAction(); ActionMap m = new ActionMap(); m.put(ACTION_MAP_KEY, my); InstanceContent ic = new InstanceContent(); AbstractLookup lkp = new AbstractLookup(ic); Action clone = a.createContextAwareInstance(lkp); ic.add(m); assertEquals("I am context", clone.getValue(Action.NAME)); clone.actionPerformed(new ActionEvent(this, 300, "")); assertEquals("Local Action called", 300, my.cnt); assertEquals("Global Action not called", 0, Callback.cnt); ic.remove(m); clone.actionPerformed(new ActionEvent(this, 200, "")); assertEquals("Local Action stays", 300, my.cnt); assertEquals("Global Action not called, there is no fallback", 0, Callback.cnt); }
Example 9
Source Project: Logisim File: MenuItemHelper.java License: GNU General Public License v3.0 | 5 votes |
@Override public void actionPerformed(ActionEvent event) { if (!listeners.isEmpty()) { ActionEvent e = new ActionEvent(menuItem, event.getID(), event.getActionCommand(), event.getWhen(), event.getModifiers()); for (ActionListener l : listeners) { l.actionPerformed(e); } } }
Example 10
Source Project: netcdf-java File: Field.java License: BSD 3-Clause "New" or "Revised" License | 4 votes |
public void actionPerformed(ActionEvent e) { ActionEvent me = new ActionEvent(Field.this, e.getID(), e.getActionCommand(), e.getWhen(), e.getModifiers()); orgAct.actionPerformed(me); }
Example 11
Source Project: netbeans File: ActionProcessorTest.java License: Apache License 2.0 | 4 votes |
@Override public void actionPerformed(ActionEvent e) { cnt += e.getID(); }
Example 12
Source Project: netbeans File: ActionProcessorTest.java License: Apache License 2.0 | 4 votes |
@Override public void actionPerformed(ActionEvent e) { cnt += e.getID(); }
Example 13
Source Project: netbeans File: SourceTranslatorAction.java License: Apache License 2.0 | 4 votes |
public void actionPerformed(ActionEvent e) { ActionEvent event = new ActionEvent(source, e.getID(), e.getActionCommand(), e.getWhen(), e.getModifiers()); scrollAction.actionPerformed(event); }
Example 14
Source Project: desktop File: Main.java License: The Unlicense | 4 votes |
private void btnGenerateActionPerformed(ActionEvent evt) { evt.getID(); showWord(); }
Example 15
Source Project: desktop File: Main.java License: The Unlicense | 4 votes |
private void jMenuItem2ActionPerformed(ActionEvent evt) { evt.getID(); String URL = "https://www.facebook.com/EvilInsultGenerator/"; webPages(URL); }
Example 16
Source Project: desktop File: Main.java License: The Unlicense | 4 votes |
private void jMenuItem3ActionPerformed(ActionEvent evt) { evt.getID(); String URL = "https://twitter.com/__E__I__G__"; webPages(URL); }
Example 17
Source Project: desktop File: Main.java License: The Unlicense | 4 votes |
private void jMenuItem4ActionPerformed(ActionEvent evt) { evt.getID(); String URL = "https://evilinsult.com/newsletter/"; webPages(URL); }
Example 18
Source Project: megamek File: OkayAction.java License: GNU General Public License v2.0 | 4 votes |
@Override public void actionPerformed(ActionEvent e) { ActionEvent f = new ActionEvent(e.getSource(), e.getID(), OKAY); owner.actionPerformed(f); }