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


Java Separator类代码示例

本文整理汇总了Java中javax.swing.JPopupMenu.Separator的典型用法代码示例。如果您正苦于以下问题:Java Separator类的具体用法?Java Separator怎么用?Java Separator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: makeScaleOptionPanel

import javax.swing.JPopupMenu.Separator; //导入依赖的package包/类
public static JPanel makeScaleOptionPanel(){
  
  // create the side panel with scale change options
  JPanel optionPanel = new JPanel();
  optionPanel.add(Box.createVerticalStrut(20));
  optionPanel.setLayout(new BoxLayout(optionPanel,BoxLayout.Y_AXIS));
  optionPanel.add(makeScalePanel(pv1,"View (0,0)"));
  optionPanel.add(Box.createVerticalStrut(20));
  optionPanel.add(new Separator());
  optionPanel.add(makeScalePanel(pv2,"View (0,1)"));
  optionPanel.add(Box.createVerticalStrut(20));
  optionPanel.add(new Separator());
  optionPanel.add(makeScalePanel(pv3,"View (1,0)"));
  optionPanel.add(Box.createVerticalStrut(20));
  optionPanel.add(new Separator());
  optionPanel.add(makeScalePanel(pv4,"View (1,1)"));
  optionPanel.add(Box.createVerticalStrut(20));
  return optionPanel;
}
 
开发者ID:MinesJTK,项目名称:jtk,代码行数:20,代码来源:LogAxisPlotDemo2.java

示例2: createFileMenu

import javax.swing.JPopupMenu.Separator; //导入依赖的package包/类
/**
 * Creates the file menu
 * 
 * @return the file menu
 */
private JMenu createFileMenu() {
	JMenu fileMenu = new JMenu(getCaption("tab_file"));
	
	// Input folder
	folder = new JMenuItem(getCaption("tab_item_choose_input"));
	folder.addActionListener(new FileInputListener(new UiCallback(), frame));
	
	// Output folder
	outputFolder = new JMenuItem(getCaption("tab_item_choose_output"));
	outputFolder.addActionListener(new FileOutputListener(frame));		
	
	// Exit button
	JMenuItem exit = new JMenuItem(getCaption("tab_item_exit"));
	exit.addActionListener(ae -> shutdown());
	
	fileMenu.add(folder);
	fileMenu.add(outputFolder);
	fileMenu.add(new Separator());
	fileMenu.add(exit);
	return fileMenu;
}
 
开发者ID:KodeMunkie,项目名称:imagetozxspec,代码行数:27,代码来源:ImageToZxSpec.java

示例3: disableOrEnableMenuItems

import javax.swing.JPopupMenu.Separator; //导入依赖的package包/类
private void disableOrEnableMenuItems() {
	//ce ni nobenega izbranega frejma, onemogoci
	//menije, ki potrebujejo sliko
	MenuElement[] menuElement = meni.menuBar.getSubElements();
	Component[] component;
	//boolean isThereAnyFrame = (desktop.getAllFrames().length > 0); //TODONEW 
	boolean isThereASelectedFrame =	!( desktop.getSelectedFrame() == null );
	
	for ( int i = 0; i < meni.menuBar.getMenuCount() ; i++ ) {
		component =	((JMenu) menuElement[i]).getMenuComponents();
		for ( int j = 0; j < ((JMenu) menuElement[i]).getItemCount(); j++ ) {
			if (component[j] instanceof Separator)
				continue;
			//ce ni izbrane slike in ce meni ajtem potrebuje eno ali vec slik pol ga disejbla
			if ( !isThereASelectedFrame && (((MyMenuInterface)component[j]).noOfOperands() > 0) ) {
				component[j].setEnabled(false);
			}
			else {
				component[j].setEnabled(true);
			}
		}
	}
}
 
开发者ID:gto76,项目名称:fun-photo-time,代码行数:24,代码来源:FunPhotoTimeFrame.java

示例4: buildBottomPane

import javax.swing.JPopupMenu.Separator; //导入依赖的package包/类
/** @{hide */
private JComponent buildBottomPane() {
	JPanel p = new JPanel(new BorderLayout());
	JPanel f = new JPanel(new FlowLayout(FlowLayout.RIGHT));

	f.add(btnCancel);
	f.add(btnPrev);
	f.add(btnNext);

	p.add(new JSeparator(Separator.HORIZONTAL), BorderLayout.NORTH);
	p.add(f, BorderLayout.SOUTH);

	return p;
}
 
开发者ID:djools,项目名称:libui,代码行数:15,代码来源:Wizard.java

示例5: fillSubMenu

import javax.swing.JPopupMenu.Separator; //导入依赖的package包/类
@Messages({
    "LBL_NewFileAction_File_PopupName=Other...",
    "NewFile.please_wait=Please wait..."
})
private void fillSubMenu(final JMenu menuItem, final Lookup lookup) {
    menuItem.removeAll();
    JMenuItem wait = new JMenuItem(NewFile_please_wait());
    wait.setEnabled(false);
    menuItem.add(wait);
    final Pair<List<Project>, List<FileObject>> data = ActionsUtil.mineFromLookup(lookup);
    RP.post(new Runnable() {
        @Override public void run() {
            Project projects[] = ActionsUtil.getProjects(data);
            final Project project = projects.length > 0 ? projects[0] : null;
            final List<TemplateItem> items = OpenProjectList.prepareTemplates(project, getLookup());
            EventQueue.invokeLater(new Runnable() {
                @Override public void run() {
                    menuItem.removeAll();
                    ActionListener menuListener = new PopupListener();
                    for (TemplateItem i : items) {
                        JMenuItem item = new JMenuItem(
                                LBL_NewFileAction_Template_PopupName(i.displayName),
                                i.icon);
                        item.addActionListener(menuListener);
                        item.putClientProperty(TEMPLATE_PROPERTY, i.template);
                        item.putClientProperty(IN_PROJECT_PROPERTY, project != null);
                        menuItem.add(item);
                    }
                    if (!items.isEmpty()) {
                        menuItem.add(new Separator());
                    }
                    JMenuItem fileItem = new JMenuItem(LBL_NewFileAction_File_PopupName(), (Icon) getValue(Action.SMALL_ICON));
                    fileItem.addActionListener(menuListener);
                    fileItem.putClientProperty(TEMPLATE_PROPERTY, null);
                    fileItem.putClientProperty(IN_PROJECT_PROPERTY, project != null);
                    menuItem.add(fileItem);
                    // #205616 - need to refresh please wait node
                    menuItem.getPopupMenu().pack();
                }
            });
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:44,代码来源:NewFile.java

示例6: setup

import javax.swing.JPopupMenu.Separator; //导入依赖的package包/类
protected final void setup() {
    for (MenuElement me : globalCacheMenu.getSubElements()) {
        if (AbstractButton.class.isInstance(me)) {
            buttonGroup.remove((AbstractButton) me);
        }
    }
    globalCacheMenu.removeAll();
    globalCacheRadioButtons = new JRadioButton[GlobalCacheManager.getInstance().getAutomatic().length + GlobalCacheManager.getInstance().getManual().length];

    InetAddress[] automaticGlobalCaches = GlobalCacheManager.getInstance().getAutomatic();
    InetAddress[] manualGlobalCaches = GlobalCacheManager.getInstance().getManual();

    int index = 0;
    for (InetAddress ipName : manualGlobalCaches) {
        addGlobalCache(index, ipName.getHostName(), ipName, "Manually entered GlobalCache.");
        index++;
    }

    if (automaticGlobalCaches.length > 0 && manualGlobalCaches.length > 0)
        globalCacheMenu.add(new Separator());

    String[] automaticGlobalCachesPretty = GlobalCacheManager.getInstance().getAutomaticPrettyNames();
    for (int i = 0; i < automaticGlobalCaches.length; i++) {
        addGlobalCache(index, automaticGlobalCachesPretty[i],
                automaticGlobalCaches[i], "Automatically discovered GlobalCache.");
        index++;
    }

    globalCacheMenu.add(new Separator());
    JMenuItem manualAddMenuItem = new JMenuItem("Add manually...");
    manualAddMenuItem.setMnemonic('A');
    globalCacheMenu.add(manualAddMenuItem);
    manualAddMenuItem.addActionListener((java.awt.event.ActionEvent evt) -> {
        try {
            String ip = guiUtils.getInput("Enter GlobalCache IP-Name or -address", "GlobalCache entry", GlobalCache.defaultGlobalCacheIP);
            if (ip != null)
                GlobalCacheManager.getInstance().addManualGlobalCache(InetAddress.getByName(ip));
        } catch (UnknownHostException ex) {
            guiUtils.error(ex);
        }
    });
    globalCacheMenu.repaint();
    globalCacheMenu.getParent().repaint();
}
 
开发者ID:bengtmartensson,项目名称:harctoolboxbundle,代码行数:45,代码来源:GlobalCacheManagerMenu.java

示例7: addContact

import javax.swing.JPopupMenu.Separator; //导入依赖的package包/类
/**
 * Shows the appropriate user interface that would allow the user to add
 * the given <tt>SourceUIContact</tt> to their contact list.
 *
 * @param contact the contact to add
 */
private void addContact(SourceUIContact contact)
{
    SourceContact sourceContact = (SourceContact) contact.getDescriptor();

    List<ContactDetail> details = sourceContact.getContactDetails(
                OperationSetPersistentPresence.class);
    int detailsCount = details.size();

    if (detailsCount > 1)
    {
        JMenuItem addContactMenu = TreeContactList.createAddContactMenu(
            (SourceContact) contact.getDescriptor());

        JPopupMenu popupMenu = ((JMenu) addContactMenu).getPopupMenu();

        // Add a title label.
        JLabel infoLabel = new JLabel();
        infoLabel.setText("<html><b>"
                            + GuiActivator.getResources()
                                .getI18NString("service.gui.ADD_CONTACT")
                            + "</b></html>");

        popupMenu.insert(infoLabel, 0);
        popupMenu.insert(new Separator(), 1);

        popupMenu.setFocusable(true);
        popupMenu.setInvoker(treeContactList);

        Point location = new Point(addContactButton.getX(),
            addContactButton.getY() + addContactButton.getHeight());

        SwingUtilities.convertPointToScreen(location, treeContactList);

        location.y = location.y
            + treeContactList.getPathBounds(treeContactList.getSelectionPath()).y;

        popupMenu.setLocation(location.x + 8, location.y - 8);
        popupMenu.setVisible(true);
    }
    else if (details.size() == 1)
    {
        TreeContactList.showAddContactDialog(
            details.get(0),
            sourceContact.getDisplayName());
    }
}
 
开发者ID:jitsi,项目名称:jitsi,代码行数:53,代码来源:ContactListTreeCellRenderer.java


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