当前位置: 首页>>代码示例>>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;未经允许,请勿转载。