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


Java JPopupMenu.Separator方法代码示例

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


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

示例1: TitledMenuSeparator

import javax.swing.JPopupMenu; //导入方法依赖的package包/类
public TitledMenuSeparator(String text) {
    setLayout(new BorderLayout());
    setOpaque(false);

    JLabel l = new JLabel(text);
    l.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
    if (UIUtils.isWindowsLookAndFeel()) l.setOpaque(true);
    l.setFont(l.getFont().deriveFont(Font.BOLD, l.getFont().getSize2D() - 1));
    if (UIUtils.isWindowsLookAndFeel()) l.setForeground(UIUtils.getDisabledLineColor());
    
    add(l, BorderLayout.WEST);
    
    if (UIUtils.isGTKLookAndFeel()) {
        add(UIUtils.createHorizontalSeparator(), BorderLayout.CENTER);
    } else {
        JComponent sep = new JPopupMenu.Separator();
        add(sep, BorderLayout.CENTER);
        
        if (UIUtils.isOracleLookAndFeel()) {
            setOpaque(true);
            setBackground(sep.getBackground());
            l.setForeground(sep.getForeground());
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:TitledMenuSeparator.java

示例2: getMenuBarArrayList

import javax.swing.JPopupMenu; //导入方法依赖的package包/类
/** Get MenuBar and tranfer it to ArrayList.
    * @param menu menu to be tranfered
    * @return tranfered menubar  - !separator is ignored
    */
   public static ArrayList<NbMenuItem> getMenuBarArrayList(JMenuBar menu) {
//       System.out.println("getMenuBarArrayList " + menu.getName());
       visitMenuBar(menu);

       MenuElement[] elements = menu.getSubElements();

       ArrayList<NbMenuItem> list = new ArrayList<NbMenuItem>();
       for (int k = 0; k < elements.length; k++) {
           if (elements[k] instanceof JPopupMenu.Separator) {
               NbMenuItem separator = new NbMenuItem();
               separator.setSeparator(true);
               list.add(separator);
           } else {
               if (elements[k] instanceof JMenuItem) {

                   NbMenuItem item = new NbMenuItem((JMenuItem) elements[k]);
                   JMenuBarOperator menuOp = new JMenuBarOperator(menu);
                   item.setSubmenu(getMenuArrayList(menuOp.getMenu(k)));
                   list.add(item);
               }
           }
       }
       return list;
   }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:MenuChecker.java

示例3: ZoomMenu

import javax.swing.JPopupMenu; //导入方法依赖的package包/类
public ZoomMenu() {
  super();

  sep = new JPopupMenu.Separator();
  add(sep);

  bg = new ButtonGroup();

  other = new JRadioButtonMenuItem(
    Resources.getString("Zoomer.ZoomMenu.other")); //$NON-NLS-1$
  other.setActionCommand(OTHER);
  other.addActionListener(this);
  bg.add(other);
  add(other);

  addSeparator();

  final JMenuItem fw = new JMenuItem(
    Resources.getString("Zoomer.ZoomMenu.fit_width")); //$NON-NLS-1$
  fw.setActionCommand(FIT_WIDTH);
  fw.addActionListener(this);
  add(fw);

  final JMenuItem fh = new JMenuItem(
    Resources.getString("Zoomer.ZoomMenu.fit_height")); //$NON-NLS-1$
  fh.setActionCommand(FIT_HEIGHT);
  fh.addActionListener(this);
  add(fh);

  final JMenuItem fv = new JMenuItem(
    Resources.getString("Zoomer.ZoomMenu.fit_visible")); //$NON-NLS-1$
  fv.setActionCommand(FIT_VISIBLE);
  fv.addActionListener(this);
  add(fv);
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:36,代码来源:Zoomer.java

示例4: createInstanceImpl

import javax.swing.JPopupMenu; //导入方法依赖的package包/类
protected JSeparator createInstanceImpl() {
    return new JPopupMenu.Separator();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:JComponentBuilders.java


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