本文整理匯總了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());
}
}
}
示例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;
}
示例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);
}
示例4: createInstanceImpl
import javax.swing.JPopupMenu; //導入方法依賴的package包/類
protected JSeparator createInstanceImpl() {
return new JPopupMenu.Separator();
}