本文整理汇总了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();
}