本文整理汇总了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);
}
}
示例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)
}
}
}
示例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());
}
}
示例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, ""));
}
}
示例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();
}
}
示例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);
}
}
示例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();
}
}
示例8: menuCanceled
import javax.swing.event.MenuEvent; //导入方法依赖的package包/类
public void menuCanceled(MenuEvent e) {
event = "canceled";
src = e.getSource();
if (debugOut) {
System.out.println(event);
}
}
示例9: menuDeselected
import javax.swing.event.MenuEvent; //导入方法依赖的package包/类
public void menuDeselected(MenuEvent e) {
event = "deselected";
src = e.getSource();
if (debugOut) {
System.out.println(event);
}
}
示例10: menuSelected
import javax.swing.event.MenuEvent; //导入方法依赖的package包/类
public void menuSelected(MenuEvent e) {
event = "selected";
src = e.getSource();
if (debugOut) {
System.out.println(event);
}
}
示例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();
}
}
}
}
示例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());
}
}
}
}
示例13: menuSelected
import javax.swing.event.MenuEvent; //导入方法依赖的package包/类
public void menuSelected(MenuEvent e) {
event = "selected";
src = e.getSource();
}