當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。