當前位置: 首頁>>代碼示例>>Java>>正文


Java ActionEvent.getID方法代碼示例

本文整理匯總了Java中java.awt.event.ActionEvent.getID方法的典型用法代碼示例。如果您正苦於以下問題:Java ActionEvent.getID方法的具體用法?Java ActionEvent.getID怎麽用?Java ActionEvent.getID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.awt.event.ActionEvent的用法示例。


在下文中一共展示了ActionEvent.getID方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: actionPerformed

import java.awt.event.ActionEvent; //導入方法依賴的package包/類
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;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:26,代碼來源:JExtendedSplitPane.java

示例2: actionPerformed

import java.awt.event.ActionEvent; //導入方法依賴的package包/類
@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);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:DialogDisplayer.java

示例3: factory

import java.awt.event.ActionEvent; //導入方法依賴的package包/類
@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();
        }
    };
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:15,代碼來源:ActionProcessorTest.java

示例4: testCallbackAction

import java.awt.event.ActionEvent; //導入方法依賴的package包/類
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);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:31,代碼來源:ActionProcessorTest.java

示例5: testCallbackOnFieldAction

import java.awt.event.ActionEvent; //導入方法依賴的package包/類
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);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:41,代碼來源:ActionProcessorTest.java

示例6: actionPerformed

import java.awt.event.ActionEvent; //導入方法依賴的package包/類
@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);
		}
	}
}
 
開發者ID:LogisimIt,項目名稱:Logisim,代碼行數:11,代碼來源:MenuItemHelper.java

示例7: actionPerformed

import java.awt.event.ActionEvent; //導入方法依賴的package包/類
public void actionPerformed(ActionEvent e) {
    ActionEvent event = new ActionEvent(source, e.getID(), e.getActionCommand(), e.getWhen(), e.getModifiers());
    scrollAction.actionPerformed(event);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:5,代碼來源:SourceTranslatorAction.java

示例8: actionPerformed

import java.awt.event.ActionEvent; //導入方法依賴的package包/類
@Override
public void actionPerformed(ActionEvent e) {
    cnt += e.getID();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:5,代碼來源:ActionProcessorTest.java

示例9: btnGenerateActionPerformed

import java.awt.event.ActionEvent; //導入方法依賴的package包/類
private void btnGenerateActionPerformed(ActionEvent evt) {                                            
    evt.getID();
    showWord();

}
 
開發者ID:EvilInsultGenerator,項目名稱:desktop,代碼行數:6,代碼來源:Main.java

示例10: jMenuItem2ActionPerformed

import java.awt.event.ActionEvent; //導入方法依賴的package包/類
private void jMenuItem2ActionPerformed(ActionEvent evt) {                                           
    evt.getID();
    String URL = "https://www.facebook.com/EvilInsultGenerator/";
    webPages(URL);
}
 
開發者ID:EvilInsultGenerator,項目名稱:desktop,代碼行數:6,代碼來源:Main.java

示例11: jMenuItem3ActionPerformed

import java.awt.event.ActionEvent; //導入方法依賴的package包/類
private void jMenuItem3ActionPerformed(ActionEvent evt) {                                           
    evt.getID();
    String URL = "https://twitter.com/__E__I__G__";
    webPages(URL);
}
 
開發者ID:EvilInsultGenerator,項目名稱:desktop,代碼行數:6,代碼來源:Main.java

示例12: jMenuItem4ActionPerformed

import java.awt.event.ActionEvent; //導入方法依賴的package包/類
private void jMenuItem4ActionPerformed(ActionEvent evt) {                                           
    evt.getID();
    String URL = "https://evilinsult.com/newsletter/";
    webPages(URL);
}
 
開發者ID:EvilInsultGenerator,項目名稱:desktop,代碼行數:6,代碼來源:Main.java

示例13: ExtendedActionEvent

import java.awt.event.ActionEvent; //導入方法依賴的package包/類
/**
 * @param source
 * @param id
 * @param command
 */
public ExtendedActionEvent(ActionEvent objPactionEvent) {
	super(objPactionEvent.getSource(), objPactionEvent.getID(), objPactionEvent.getActionCommand());
}
 
開發者ID:jugglemaster,項目名稱:JuggleMasterPro,代碼行數:9,代碼來源:ExtendedActionEvent.java


注:本文中的java.awt.event.ActionEvent.getID方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。