当前位置: 首页>>代码示例>>Java>>正文


Java PopupMenu.addSeparator方法代码示例

本文整理汇总了Java中java.awt.PopupMenu.addSeparator方法的典型用法代码示例。如果您正苦于以下问题:Java PopupMenu.addSeparator方法的具体用法?Java PopupMenu.addSeparator怎么用?Java PopupMenu.addSeparator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.PopupMenu的用法示例。


在下文中一共展示了PopupMenu.addSeparator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createComponents

import java.awt.PopupMenu; //导入方法依赖的package包/类
private void createComponents() {
    PopupMenu menu = new PopupMenu();
    menu.add(createMenuItem(openAction));
    menu.add(createMenuItem(controlPanelAction));
    menu.addSeparator();
    menu.add(createMenuItem(quitAction));

    URL url = getClass().getResource("/images/futuresonic-21.png");
    Image image = Toolkit.getDefaultToolkit().createImage(url);
    TrayIcon trayIcon = new TrayIcon(image, "FutureSonic Music Streamer", menu);
    trayIcon.setImageAutoSize(false);

    try {
        SystemTray.getSystemTray().add(trayIcon);
    } catch (Throwable x) {
        System.err.println("Failed to add tray icon.");
    }
}
 
开发者ID:FutureSonic,项目名称:FutureSonic-Server,代码行数:19,代码来源:SubsonicController.java

示例2: createComponents

import java.awt.PopupMenu; //导入方法依赖的package包/类
private void createComponents() {
    PopupMenu menu = new PopupMenu();
    menu.add(createMenuItem(openAction));
    menu.add(createMenuItem(controlPanelAction));
    menu.addSeparator();
    menu.add(createMenuItem(quitAction));

    URL url = getClass().getResource("/images/madsonic-21.png");
    Image image = Toolkit.getDefaultToolkit().createImage(url);
    TrayIcon trayIcon = new TrayIcon(image, "Madsonic Music Streamer", menu);
    trayIcon.setImageAutoSize(false);

    try {
        SystemTray.getSystemTray().add(trayIcon);
    } catch (Throwable x) {
        System.err.println("Failed to add tray icon.");
    }
}
 
开发者ID:MadMarty,项目名称:madsonic-server-5.1,代码行数:19,代码来源:MadsonicController.java

示例3: createPopupMenu

import java.awt.PopupMenu; //导入方法依赖的package包/类
protected static PopupMenu createPopupMenu() {
    final PopupMenu popup = new PopupMenu();
    MenuItem aboutItem = new MenuItem("About");
    CheckboxMenuItem cb1 = new CheckboxMenuItem("Set auto size");
    CheckboxMenuItem cb2 = new CheckboxMenuItem("Set tooltip");
    Menu displayMenu = new Menu("Display");
    MenuItem errorItem = new MenuItem("Error");
    MenuItem warningItem = new MenuItem("Warning");
    MenuItem infoItem = new MenuItem("Info");
    MenuItem noneItem = new MenuItem("None");
    MenuItem exitItem = new MenuItem("Exit");
    // Add components to pop-up menu
    popup.add(aboutItem);
    popup.addSeparator();
    popup.add(cb1);
    popup.add(cb2);
    popup.addSeparator();
    popup.add(displayMenu);
    displayMenu.add(errorItem);
    displayMenu.add(warningItem);
    displayMenu.add(infoItem);
    displayMenu.add(noneItem);
    popup.add(exitItem);
    return popup;
}
 
开发者ID:SaiPradeepDandem,项目名称:javafx-demos,代码行数:26,代码来源:TrayLeftClick.java

示例4: SysTrayIcon

import java.awt.PopupMenu; //导入方法依赖的package包/类
public SysTrayIcon(JDesktopAgent frame, String tooltip) {
    Translate translate = Translate.getTranslate();
    if (SystemTray.isSupported()) {
        Image image = Toolkit.getDefaultToolkit().getImage("icon.png");

        PopupMenu popup = new PopupMenu();
        popup.add(new RestoreMenuItem(frame, translate.backgroundRestore()));
        popup.addSeparator();
        popup.add(new AboutMenuItem(translate.about()));
        popup.addSeparator();
        popup.add(new ExitMenuItem(translate.exit()));

        TrayIcon trayIcon = new TrayIcon(image, tooltip, popup);
        trayIcon.setImageAutoSize(true);
        trayIcon.addMouseListener(new IconListener(frame));

        try {
            SystemTray.getSystemTray().add(trayIcon);
        } catch (AWTException e) {
            new SysTrayForm(frame).setVisible(true);
        }
    } else {
        new SysTrayForm(frame).setVisible(true);
    }

}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:27,代码来源:SysTrayIcon.java

示例5: buildTrayIcon

import java.awt.PopupMenu; //导入方法依赖的package包/类
public TrayIcon buildTrayIcon() throws IOException {
    PopupMenu popup = new PopupMenu();
    for (MenuItemDefinition mid : menuItems) {
        if (mid instanceof SeperatorMenuItem) {
            popup.addSeparator();
        } else {
            MenuItem item = new MenuItem();
            item.setLabel(mid.getText());
            item.addActionListener(mid);
            popup.add(item);
        }
    }

    TrayIcon ti = new TrayIcon(getImage(imageName), tooltip, popup);
    ti.setImageAutoSize(true);
    return ti;
}
 
开发者ID:devbury,项目名称:mkRemote,代码行数:18,代码来源:TrayIconDefinition.java

示例6: createPopupMenu

import java.awt.PopupMenu; //导入方法依赖的package包/类
private PopupMenu createPopupMenu() {
    PopupMenu menu = new PopupMenu(getString("Server") + " "
            + Metadata.getApplicationName());
    menu.add(createStart());
    menu.add(createStop());
    menu.addSeparator();
    menu.add(createRestart());
    menu.addSeparator();
    menu.add(createPreferences());
    menu.addSeparator();
    menu.add(createExit());
    return menu;
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:14,代码来源:Manager.java

示例7: TrayApplication

import java.awt.PopupMenu; //导入方法依赖的package包/类
public TrayApplication(String args[])
{
    if (!SystemTray.isSupported())
    {
        log.severe("\bTrayIcon is not supported, unable to run Scorekeeper monitor application.");
        System.exit(-1);
    }

    if (!ensureSingleton())
    {
        log.warning("Another TrayApplication is running, quitting now.");
        System.exit(-1);
    }

    actions = new Actions();
    state = new StateControl();
    statuswindow = new ScorekeeperStatusWindow(actions);

    PopupMenu trayPopup = new PopupMenu();
    trayPopup.add(new WrappedAWTMenuItem(actions.openStatus));
    trayPopup.addSeparator();
    for (Action a : actions.apps)
        trayPopup.add(new WrappedAWTMenuItem(a));
    trayPopup.addSeparator();
    trayPopup.add(new WrappedAWTMenuItem(actions.quit));

    trayIcon = new TrayIcon(conewarn, "Scorekeeper Monitor", trayPopup);
    trayIcon.setImageAutoSize(true);

    Messenger.register(MT.BACKEND_READY, (type, data) -> trayIcon.setImage(((boolean)data) ? coneok : conewarn));

    try {
        SystemTray.getSystemTray().add(trayIcon);
    } catch (AWTException e) {
        log.severe("\bFailed to create TrayIcon: " + e);
        System.exit(-2);
    }

    statuswindow.setVisible(true);
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:41,代码来源:TrayApplication.java

示例8: createComponents

import java.awt.PopupMenu; //导入方法依赖的package包/类
private void createComponents() {
    startedImage = createImage("/images/subsonic-started-16.png");
    stoppedImage = createImage("/images/subsonic-stopped-16.png");

    PopupMenu menu = new PopupMenu();
    menu.add(createMenuItem(openAction));
    menu.add(createMenuItem(controlPanelAction));
    menu.addSeparator();
    menu.add(createMenuItem(hideAction));

    trayIcon = new TrayIcon(stoppedImage, "Subsonic Music Streamer", menu);
}
 
开发者ID:sindremehus,项目名称:subsonic,代码行数:13,代码来源:TrayController.java

示例9: createComponents

import java.awt.PopupMenu; //导入方法依赖的package包/类
private void createComponents() {
    startedImage = createImage("/images/futuresonic-started-16.png");
    stoppedImage = createImage("/images/futuresonic-stopped-16.png");

    PopupMenu menu = new PopupMenu();
    menu.add(createMenuItem(openAction));
    menu.add(createMenuItem(controlPanelAction));
    menu.addSeparator();
    menu.add(createMenuItem(hideAction));

    trayIcon = new TrayIcon(stoppedImage, "FutureSonic Music Streamer", menu);
}
 
开发者ID:FutureSonic,项目名称:FutureSonic-Server,代码行数:13,代码来源:TrayController.java

示例10: createComponents

import java.awt.PopupMenu; //导入方法依赖的package包/类
private void createComponents() {
    startedImage = createImage("/images/madsonic-started-16.png");
    stoppedImage = createImage("/images/madsonic-stopped-16.png");

    PopupMenu menu = new PopupMenu();
    menu.add(createMenuItem(openAction));
    menu.add(createMenuItem(controlPanelAction));
    menu.addSeparator();
    menu.add(createMenuItem(hideAction));

    trayIcon = new TrayIcon(stoppedImage, "Madsonic Music Streamer", menu);
}
 
开发者ID:MadMarty,项目名称:madsonic-server-5.1,代码行数:13,代码来源:TrayController.java

示例11: getTrayMenu

import java.awt.PopupMenu; //导入方法依赖的package包/类
public PopupMenu getTrayMenu(){
    final PopupMenu menu = new PopupMenu();
    menu.addSeparator();
    menu.add($(EXIT).toAWTMenu());
    
	return menu;
}
 
开发者ID:deonwu,项目名称:CaptchaRoute,代码行数:8,代码来源:MenuToolbar.java

示例12: create

import java.awt.PopupMenu; //导入方法依赖的package包/类
public PopupMenu create(boolean isUserLoggedIn) {
	root = new PopupMenu();

	if (isUserLoggedIn) {
		root.add(createRootFolderMenu());
		// root.add(createRecentFilesMenu()); // TODO: implement additional feature.
		root.addSeparator();
		root.add(createSettingsMenu());
		root.addSeparator();
	}
	root.add(createActivityMenu());
	root.add(createQuitMenu());

	return root;
}
 
开发者ID:PeerWasp,项目名称:PeerWasp,代码行数:16,代码来源:JTrayMenu.java

示例13: initialize

import java.awt.PopupMenu; //导入方法依赖的package包/类
/**
 * Initializes this tray manager object and creates the tray icon and its
 * context menu.
 * 
 * @throws UnsupportedSystemTrayException
 *             If the current platform does not support a system tray.
 */
private final void initialize() throws UnsupportedSystemTrayException {
	this.logger.logInfo("Initializing TrayManager.");

	if (!SystemTray.isSupported()) {
		throw new UnsupportedSystemTrayException();

	}

	this.systemTray = SystemTray.getSystemTray();

	this.trayIcon = new TrayIcon(this.trayIconImage, TRAY_NAME);
	this.trayIcon.setImageAutoSize(true);

	final MenuItem forceCacheUpdate = new MenuItem(FORCE_CACHE_UPDATE_NAME);
	final MenuItem toggleDebugWindow = new MenuItem(TOGGLE_DEBUG_WINDOW_NAME);
	final MenuItem setApiKey = new MenuItem(SET_API_KEY_NAME);
	final MenuItem setRegion = new MenuItem(SET_REGION_NAME);
	final MenuItem setSummonername = new MenuItem(SET_SUMMONER_NAME);
	final MenuItem exit = new MenuItem(EXIT);
	final MenuItem findMatch = new MenuItem(FIND_MATCH_NAME);

	final PopupMenu popup = new PopupMenu();
	popup.add(forceCacheUpdate);
	popup.add(toggleDebugWindow);
	popup.addSeparator();
	popup.add(setApiKey);
	popup.add(setRegion);
	popup.add(setSummonername);
	popup.addSeparator();
	popup.add(findMatch);
	popup.add(exit);
	this.trayIcon.setPopupMenu(popup);
	
	exit.addActionListener(new ExitListener(this.leagueStats));
	toggleDebugWindow.addActionListener(new ToggleDebugWindowListener(this.leagueStats));
	setApiKey.addActionListener(new SetApiKeyListener(this.leagueStats));
	setRegion.addActionListener(new SetRegionListener(this.leagueStats));
	setSummonername.addActionListener(new SetSummonerNameListener(this.leagueStats));
	forceCacheUpdate.addActionListener(new ResetCacheListener(this.leagueStats));
	findMatch.addActionListener(new FindMatchListener(this.leagueStats));

}
 
开发者ID:Ativelox,项目名称:LeagueStats,代码行数:50,代码来源:TrayManager.java

示例14: installTrayIcon

import java.awt.PopupMenu; //导入方法依赖的package包/类
/**
 * Installs a system tray icon.
 */
private void installTrayIcon() {
	if ( !SystemTray.isSupported() )
		return;
	
	final TrayIcon trayIcon = new TrayIcon( Icons.MY_APP_ICON.get().getImage(), Consts.APP_NAME_FULL + " is running." );
	trayIcon.setImageAutoSize( true );
	
	try {
		SystemTray.getSystemTray().add( trayIcon );
		
		this.trayIcon = trayIcon;
		
		trayIcon.addActionListener( Actions.SHOW_MAIN_FRAME );
		
		final PopupMenu popup = new PopupMenu();
		final MenuItem restoreMenuItem = new MenuItem( "Show Main Window" );
		restoreMenuItem.addActionListener( Actions.SHOW_MAIN_FRAME );
		popup.add( restoreMenuItem );
		final MenuItem hideMenuItem = new MenuItem( "Hide Main Window" );
		hideMenuItem.addActionListener( Actions.MINIMIZE_TO_TRAY );
		popup.add( hideMenuItem );
		popup.addSeparator();
		final MenuItem restoreDefPosMenuItem = new MenuItem( "Restore Main Window to defaults" );
		restoreDefPosMenuItem.addActionListener( new ActionAdapter() {
			@Override
			public void actionPerformed( final ActionEvent e ) {
				// First ensure it's visible and active:
				Actions.SHOW_MAIN_FRAME.actionPerformed( null );
				// And the default position:
				Actions.RESTORE_DEF_WIN_POSITION.actionPerformed( null );
			}
		} );
		popup.add( restoreDefPosMenuItem );
		popup.addSeparator();
		final MenuItem exitMenuItem = new MenuItem( "Exit" );
		exitMenuItem.addActionListener( Actions.EXIT );
		popup.add( exitMenuItem );
		trayIcon.setPopupMenu( popup );
		
		Actions.MINIMIZE_TO_TRAY.setEnabled( true );
	} catch ( final AWTException ae ) {
		Env.LOGGER.debug( "Failed to install tray icon!", ae );
	}
}
 
开发者ID:icza,项目名称:scelight,代码行数:48,代码来源:MainFrame.java

示例15: SystemTrayHandler

import java.awt.PopupMenu; //导入方法依赖的package包/类
public SystemTrayHandler(PluginHandler plugin, String working_directory, AudioInput in)
    {
        this.plugin = plugin;
        this.in = in;
        this.plugins_directory = working_directory + "Plugins/";

        // Okay, this one was stupid hacky. I couldn't figure out how to export
        // images with processing, but I noticed that in
        // Processing.app/Contents/Java/ there was a file named jssc.txt.
        // I'm almost 100% certain that Processing isn't using this. So I found
        // the file in /Applications/Processing.app/Contents/Java/modes/java/libraries/serial/library/jssc.txt
        // I took my icon.gif and renamed it to jssc.txt, and it appears to work.
        String icon = SystemTrayHandler.class.getResource("").getPath() + "jssc.txt";

        if ( SystemTray.isSupported() )
        {
            if ( !( new File( icon ) ).exists() )
            {
                String local_icon = working_directory + "icon.gif";
                if ( !( new File( local_icon ) ).exists() )
                {
                    Message.showError(
"Could not find icon.gif to put in the System Tray. We looked in<br />"+
icon +
"<br />and<br />" +
local_icon +
"<br /><br />The program will now exit.",
                                                            "ICON_NOT_FOUND" );
                    System.exit(1);
                }
                icon = local_icon;
            }

            final PopupMenu popup = new PopupMenu();
            final Image image = Toolkit.getDefaultToolkit()
                                    .getImage( icon );
            final TrayIcon trayIcon = new TrayIcon( image, "Light Controller" );
            final SystemTray tray = SystemTray.getSystemTray();

            addPluginsMenu( popup );

            popup.addSeparator();

            if(!MIXER_BUG) addAudioMenu( popup );
            addSettingsMenu( popup );

            popup.addSeparator();

            addExitItem( popup );

            trayIcon.setPopupMenu( popup );

            try
            {
                tray.add( trayIcon );
            }
            catch ( AWTException e )
            {
                Message.showError(
"There was a problem creating an icon on the system tray.<br />"+
"The program will now exit.<br />"+
"Below you will find the stack trace for this error.\n",
                                            "AWTException_CREATING_ICON", e );
                System.exit(1);
            }

        }
        else
        {
            Message.showError(
"Light Controller is not supported on this machine<br />"+
"due to system tray being unsupported.<br />"+
"The program will now exit.",                               "NO_SYS_TRAY" );

            System.exit(1);
        }
    }
 
开发者ID:uPaymeiFixit,项目名称:Processing-Arduino-Light-Controller,代码行数:78,代码来源:SystemTrayHandler.java


注:本文中的java.awt.PopupMenu.addSeparator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。