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


Java MenuEvent.getSource方法代碼示例

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


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

示例1: menuSelected

import javax.swing.event.MenuEvent; //導入方法依賴的package包/類
/**
 * check file menu
 */
public void menuSelected(MenuEvent e) {
    JMenu source = (JMenu) e.getSource();
    if((source != null) && "File".equals(source.getText())) {
        // close menu item only active, if something is selected.
        getMainMenu().getCloseMenuItem().setEnabled(tree.getSelectionPath() != null);
        getMainMenu().getCloseToolBarButton().setEnabled(tree.getSelectionPath() != null);
    }
}
 
開發者ID:irockel,項目名稱:tda,代碼行數:12,代碼來源:TDA.java

示例2: menuDeselected

import javax.swing.event.MenuEvent; //導入方法依賴的package包/類
public void menuDeselected(MenuEvent e) {
	JMenu wm = (JMenu) e.getSource();

	// Cleans Windows if not visible
	if(wm.getText().matches("Windows") || wm.getText().matches("Window")) {
	wm.removeAll();
	System.gc();
	}

	/* When user first imports menu item the background is set to another color to catch user attention.
	 * After user interaction will set the background color back.
	 */
	if(wm.getText().matches("My Layer Sessions")) {
		JMenu selectSessionMenu = (JMenu) wm;
		try {
			JMenuItem selectSessionMenuChild = (JMenuItem) selectSessionMenu.getMenuComponent(0);
			Color currentColor = selectSessionMenu.getBackground();
			Color defaultColor = selectSessionMenuChild.getBackground();
			if(currentColor.getRed() + currentColor.getGreen() + currentColor.getBlue() == 586) {
				selectSessionMenu.setBackground(defaultColor);
				selectSessionMenu.revalidate();	
		}
		} catch (Exception ex) {
			//don't do anything if menu component and cannot be cast as a JMenuItem 
			//(eg if it is a separator bar)
		}
	}
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:29,代碼來源:MapApp.java

示例3: menuSelected

import javax.swing.event.MenuEvent; //導入方法依賴的package包/類
@Override
public void menuSelected(MenuEvent e) {
    if (e.getSource() == menu.srlStreams) {
        ArrayList<String> popoutStreams = new ArrayList<>();
        for (Channel channel : channels.getPopoutChannels().keySet()) {
            popoutStreams.add(channel.getStreamName());
        }
        menu.updateSrlStreams(channels.getActiveTab().getStreamName(), popoutStreams);
    } else if (e.getSource() == menu.view) {
        menu.updateCount(highlightedMessages.getNewCount(),
                highlightedMessages.getDisplayedCount(),
                ignoredMessages.getNewCount(),
                ignoredMessages.getDisplayedCount());
    }
}
 
開發者ID:chatty,項目名稱:chatty,代碼行數:16,代碼來源:MainGui.java

示例4: menuSelected

import javax.swing.event.MenuEvent; //導入方法依賴的package包/類
@Override
public void menuSelected(MenuEvent evt) {
    updateActions();
    updateLogSourceMenuActions();
    if (evt.getSource() == mAboutMenu) {
        mAboutMenu.getAction().actionPerformed(new ActionEvent(ChartView.this, ActionEvent.ACTION_PERFORMED, ""));
    }
}
 
開發者ID:sonyxperiadev,項目名稱:logdog,代碼行數:9,代碼來源:ChartView.java

示例5: menuSelected

import javax.swing.event.MenuEvent; //導入方法依賴的package包/類
@Override
public void menuSelected(MenuEvent me) {
    if (me.getSource() == menuEdit) {    
        //Update Undo and Redu MenuItems to include the action description.
        updateEditMenu();
    }
}
 
開發者ID:alecdhuse,項目名稱:Folding-Map,代碼行數:8,代碼來源:MainWindow.java

示例6: menuSelected

import javax.swing.event.MenuEvent; //導入方法依賴的package包/類
@Override
public void menuSelected(MenuEvent event)
{
	JMenu menu = (JMenu)event.getSource();
	
	if(menu == editMenu)
	{
		currentChildFrame.updateEditMenu(editMenu);
	}
}
 
開發者ID:lucaseverini,項目名稱:ROPE,代碼行數:11,代碼來源:RopeFrame.java

示例7: menuSelected

import javax.swing.event.MenuEvent; //導入方法依賴的package包/類
public void menuSelected(MenuEvent event)
{
	Object eventSource = event.getSource();
	for (Menu menu : Menu.values())
	{
		if (eventSource == menu.menu)
			menu.update();
	}
}
 
開發者ID:blankaspect,項目名稱:regexSearch,代碼行數:10,代碼來源:MainWindow.java

示例8: menuCanceled

import javax.swing.event.MenuEvent; //導入方法依賴的package包/類
public void menuCanceled(MenuEvent e) {
    event = "canceled";
    src = e.getSource();
    if (debugOut) {
        System.out.println(event);
    }
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:8,代碼來源:JMenuTest.java

示例9: menuDeselected

import javax.swing.event.MenuEvent; //導入方法依賴的package包/類
public void menuDeselected(MenuEvent e) {
    event = "deselected";
    src = e.getSource();
    if (debugOut) {
        System.out.println(event);
    }
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:8,代碼來源:JMenuTest.java

示例10: menuSelected

import javax.swing.event.MenuEvent; //導入方法依賴的package包/類
public void menuSelected(MenuEvent e) {
    event = "selected";
    src = e.getSource();
    if (debugOut) {
        System.out.println(event);
    }
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:8,代碼來源:JMenuTest.java

示例11: menuSelected

import javax.swing.event.MenuEvent; //導入方法依賴的package包/類
@Override
public void menuSelected(MenuEvent event) {
	JMenu menu = (JMenu) event.getSource();
	for (Component component : menu.getMenuComponents()) {
		if (component instanceof JMenuItem) {
			JMenuItem item = (JMenuItem) component;
			Action action = item.getAction();
			if (action instanceof Command) {
				((Command) action).adjust();
			}
		}
	}
}
 
開發者ID:Ayutac,項目名稱:toolkit,代碼行數:14,代碼來源:DynamicMenuEnabler.java

示例12: menuSelected

import javax.swing.event.MenuEvent; //導入方法依賴的package包/類
@Override
public void menuSelected(MenuEvent e) {
    if (e.getSource() instanceof JMenu) {
        JMenu menu = (JMenu) e.getSource();
        int count = menu.getItemCount();
        for (int i = 0; i < count; ++i) {
            JMenuItem item = menu.getItem(i);
            if (item != null) {
                item.setEnabled(item.isEnabled());
            }
        }
    }
}
 
開發者ID:GideonLeGrange,項目名稱:panstamp-tools,代碼行數:14,代碼來源:Menus.java

示例13: menuSelected

import javax.swing.event.MenuEvent; //導入方法依賴的package包/類
public void menuSelected(MenuEvent e) {
    event = "selected";
    src = e.getSource();
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:5,代碼來源:JPopupMenuTest.java


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