javax.swing.JMenuItem.setHorizontalTextPosition()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(112)

本文整理了Java中javax.swing.JMenuItem.setHorizontalTextPosition()方法的一些代码示例,展示了JMenuItem.setHorizontalTextPosition()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JMenuItem.setHorizontalTextPosition()方法的具体详情如下:
包路径:javax.swing.JMenuItem
类名称:JMenuItem
方法名:setHorizontalTextPosition

JMenuItem.setHorizontalTextPosition介绍

暂无

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-awt

/** Method to prepare the margins and text positions.
*/
static void prepareMargins(JMenuItem item, Action action) {
  item.setHorizontalTextPosition(JMenuItem.RIGHT);
  item.setHorizontalAlignment(JMenuItem.LEFT);
}

代码示例来源:origin: senbox-org/s1tbx

private JMenuItem createMenuItem(final String name) {
  final JMenuItem item = new JMenuItem(name);
  item.setHorizontalTextPosition(JMenuItem.RIGHT);
  item.addActionListener(this);
  return item;
}

代码示例来源:origin: com.eas.platypus/platypus-js-forms

@ScriptFunction
@Override
public void setHorizontalTextPosition(int aValue) {
  super.setHorizontalTextPosition(aValue);
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** Method to prepare the margins and text positions.
*/
static void prepareMargins (JMenuItem item, Action action) {
  item.setHorizontalTextPosition(JMenuItem.RIGHT);
  item.setHorizontalAlignment(JMenuItem.LEFT);
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Method to prepare the margins and text positions.
*/
static void prepareMargins (JMenuItem item, Action action) {
  item.setHorizontalTextPosition(JMenuItem.RIGHT);
  item.setHorizontalAlignment(JMenuItem.LEFT);
}

代码示例来源:origin: org.appdapter/org.appdapter.lib.gui

/**
 * Factory method which creates the <code>JMenuItem</code> for
 * <code>Actions</code> added to the <code>JPopupMenu</code>.
 *
 * @param a the <code>Action</code> for the menu item to be added
 * @return the new menu item
 * @see Action
 *
 * @since 1.3
 */
protected JMenuItem createActionComponent(Action a, Object ctx) {
  JMenuItem mi = new SafeJMenuItem(ctx, true) {
    protected PropertyChangeListener createActionPropertyChangeListener(Action a) {
      PropertyChangeListener pcl = createActionChangeListener(this);
      if (pcl == null) {
        pcl = super.createActionPropertyChangeListener(a);
      }
      return pcl;
    }
  };
  mi.setHorizontalTextPosition(JButton.TRAILING);
  mi.setVerticalTextPosition(JButton.CENTER);
  return mi;
}

代码示例来源:origin: org.fudaa.framework.ebli/ebli-3d

public final JMenuItem addMenuItem(final String _s, final String _cmd, final BuIcon _icon, final boolean _enabled) {
  final JMenuItem r = new JMenuItem();
  r.setName("mi" + _cmd);
  r.setActionCommand(_cmd);
  r.setText(_s);
  // r.setIcon(_icon);
  r.setHorizontalTextPosition(SwingConstants.RIGHT);
  r.addActionListener(this);
  r.setEnabled(_enabled);
  this.add(r);
  return r;
 }
}

代码示例来源:origin: edu.toronto.cs.medsavant/medsavant-client

@Override
public JMenuItem insert(Action a, int pos) {
  if(pos < 0) {
    throw new IllegalArgumentException("index less than zero.");
  }
  ensurePopupMenuCreated();
  JMenuItem mi = new JMenuItem(a);
  mi.setHorizontalTextPosition(JButton.TRAILING);
  mi.setVerticalTextPosition(JButton.CENTER);
  popupMenu.insert(mi, pos);
  return mi;
}

代码示例来源:origin: senbox-org/snap-desktop

final JMenuItem item = new JMenuItem("Delete");
popup.add(item);
item.setHorizontalTextPosition(JMenuItem.RIGHT);
item.addActionListener(this);
    final JMenuItem nsItem = new JMenuItem(ns.getSourceNodeId());
    removeSourcedMenu.add(nsItem);
    nsItem.setHorizontalTextPosition(JMenuItem.RIGHT);
    nsItem.addActionListener(removeSourceListener);
connectItem.setHorizontalTextPosition(JMenuItem.RIGHT);
connectItem.addActionListener(connectListener);
popup.add(connectItem);

代码示例来源:origin: senbox-org/snap-desktop

@Override
  protected Boolean doInBackground() throws Exception {
    // get operator list from graph executor
    final Set<String> gpfOperatorSet = graphEx.GetOperatorList();
    final String[] gpfOperatorList = new String[gpfOperatorSet.size()];
    gpfOperatorSet.toArray(gpfOperatorList);
    Arrays.sort(gpfOperatorList);
    // add operators
    for (String anAlias : gpfOperatorList) {
      if (!graphEx.isOperatorInternal(anAlias) && OperatorUIRegistry.showInGraphBuilder(anAlias)) {
        final String category = graphEx.getOperatorCategory(anAlias);
        JMenu menu = addMenu;
        if (!category.isEmpty()) {
          final String[] categoryPath = StringUtils.split(category, folderDelim, true);
          for (String folder : categoryPath) {
            menu = getMenuFolder(folder, menu);
          }
        }
        final JMenuItem item = new JMenuItem(anAlias, opIcon);
        item.setHorizontalTextPosition(JMenuItem.RIGHT);
        item.addActionListener(addListener);
        menu.add(item);
      }
    }
    return true;
  }
}

代码示例来源:origin: org.appdapter/org.appdapter.lib.gui

/**
 * Appends a component to the end of this menu.
 * Returns the component added.
 *
 * @param c the <code>Component</code> to add
 * @return the <code>Component</code> added
 */
@Override
protected JMenuItem createActionComponent(Action a) {
  JMenuItem mi = new SafeJMenuItem(userObject, true) {
    @Override
    protected PropertyChangeListener createActionPropertyChangeListener(Action a) {
      PropertyChangeListener pcl = createActionChangeListener(this);
      if (pcl == null) {
        pcl = super.createActionPropertyChangeListener(a);
      }
      return pcl;
    }
  };
  mi.setHorizontalTextPosition(SwingConstants.TRAILING);
  mi.setVerticalTextPosition(SwingConstants.CENTER);
  return mi;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-debugger-common2

public void menuSelected (MenuEvent e) {
JMenu menu = (JMenu)e.getSource();
NativeDebugger debugger = NativeDebuggerManager.get().currentNativeDebugger();
String format_array[] = debugger.formatChoices();
if (debugger != null) {
  for (int vx = 0; vx < format_array.length; vx++) {
  boolean status = (var != null) && format_array[vx].equals(var.getFormat());
  JMenuItem formatItem = new JRadioButtonMenuItem (
    format_array[vx],
    status);
  menu.add(formatItem);
  formatItem.setHorizontalTextPosition(SwingConstants.LEFT);
  formatItem.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent actionEvent) {
    updateFormat(actionEvent.getActionCommand());
    }
  });
  }
}
}

代码示例来源:origin: com.jidesoft/jide-oss

item.setToolTipText(_tabPane.getToolTipTextAt(i));
item.setSelected(selectedIndex == i);
item.setHorizontalTextPosition(JMenuItem.RIGHT);

代码示例来源:origin: org.fudaa.framework.fudaa/fudaa-common

final JMenuItem centerItem = new JMenuItem(FudaaLib.getS("Centre"));
final JMenuItem rightItem = new JMenuItem(FudaaLib.getS("Droite"));
leftItem.setHorizontalTextPosition(SwingConstants.RIGHT);
centerItem.setHorizontalTextPosition(SwingConstants.RIGHT);
rightItem.setHorizontalTextPosition(SwingConstants.RIGHT);
leftItem.setIcon(BuResource.BU.getIcon("alignementgauche"));
centerItem.setIcon(BuResource.BU.getIcon("alignementcentre"));

代码示例来源:origin: net.sf.mmax2/mmax2

item = null;
item = new JMenuItem("    "+currentAttribute.getRemoveFromMarkablesetInstruction(),new BoxIcon(currentAttribute.getLineColor()));
item.setHorizontalTextPosition(SwingConstants.RIGHT);
item.setFont(MMAX2.getStandardFont());
final MarkableSet tempSet = currentPrimaryMarkablesSet;
    item = null;
    item = new JMenuItem("    "+currentAttribute.getAdoptIntoMarkablesetInstruction(),new BoxIcon(currentAttribute.getLineColor()));
    item.setHorizontalTextPosition(SwingConstants.RIGHT);
    item.setFont(MMAX2.getStandardFont());
    final MarkableSet adoptingSet = currentPrimaryMarkablesSet;
    item = null;
    item = new JMenuItem("    "+currentAttribute.getMergeIntoMarkablesetInstruction(),new BoxIcon(currentAttribute.getLineColor()));
    item.setHorizontalTextPosition(SwingConstants.RIGHT);                                
    item.setFont(MMAX2.getStandardFont());
    final MarkableSet adoptingSet2 = currentPrimaryMarkablesSet;
    item = new JMenuItem("    "+currentAttribute.getAddToMarkablesetInstruction(),new BoxIcon(currentAttribute.getLineColor()));
    item.setFont(MMAX2.getStandardFont());
    item.setHorizontalTextPosition(SwingConstants.RIGHT);
    final MarkableSet tempSet = currentPrimaryMarkablesSet;
    item.addActionListener(new ActionListener()
  item = null;
  item = new JMenuItem("    "+currentAttribute.getAdoptIntoMarkablesetInstruction(),new BoxIcon(currentAttribute.getLineColor()));
  item.setHorizontalTextPosition(SwingConstants.RIGHT);                            
  item.setFont(MMAX2.getStandardFont());
  final MarkableSet leftSet = currentRelation.getMarkableSetWithAttributeValue(temp);

相关文章

JMenuItem类方法