本文整理汇总了Java中javax.swing.JMenuItem.setFont方法的典型用法代码示例。如果您正苦于以下问题:Java JMenuItem.setFont方法的具体用法?Java JMenuItem.setFont怎么用?Java JMenuItem.setFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JMenuItem
的用法示例。
在下文中一共展示了JMenuItem.setFont方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateMenu
import javax.swing.JMenuItem; //导入方法依赖的package包/类
/**
* Add list orecentProjFile recent projects as Menu Items to the Recent
* projects menu
*
*
* @param recentProj instance orecentProjFile the menu to address
* <code>Recent Projects</code>
*/
public void updateMenu(JMenu recentProj) {
recentProj.removeAll();
try {
for (String file : recentProjects) {
recentItemMenu = new JMenuItem();
recentItemMenu.setFont(new java.awt.Font("sansserif", 0, 11));
recentItemMenu.setText(toName(file));
recentItemMenu.setToolTipText(file);
recentProj.add(recentItemMenu);
addlistener(recentItemMenu);
}
} catch (Exception ex) {
Logger.getLogger(RecentItems.class.getName()).log(Level.SEVERE, null, ex);
}
}
示例2: addCarAction
import javax.swing.JMenuItem; //导入方法依赖的package包/类
private void addCarAction(final Car c)
{
JMenuItem lbl = new JMenuItem(String.format("%s %s #%s %s %s", c.getClassCode(), Database.d.getEffectiveIndexStr(c), c.getNumber(), c.getMake(), c.getModel()));
lbl.setFont(itemFont);
lbl.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
Messenger.sendEvent(MT.CAR_CHANGE, c.getCarId());
}});
if (Database.d.isInOrder(DataEntry.state.getCurrentEventId(), c.getCarId(), DataEntry.state.getCurrentCourse()))
{
lbl.setEnabled(false);
lbl.setForeground(superLightGray);
}
menu.add(lbl);
}
示例3: getJMenueItemDefault
import javax.swing.JMenuItem; //导入方法依赖的package包/类
/**
* Gets the JMenuItem -for the specified {@link NetworkAddress}.
*
* @param networkAddress the network address
* @param actListener the {@link ActionListener}
* @return the JMenueItem network address
*/
private JMenuItem getJMenueItemDefault(String header, ActionListener actListener) {
JMenuItem jMenuItem = new JMenuItem(header);
jMenuItem.setFont(new Font("Dialog", Font.PLAIN, 12));
jMenuItem.setActionCommand(header);
jMenuItem.addActionListener(actListener);
return jMenuItem;
}
示例4: getJMenueItemNetworkAddress
import javax.swing.JMenuItem; //导入方法依赖的package包/类
/**
* Gets the JMenuItem for the specified {@link NetworkAddress}.
*
* @param networkAddress the network address
* @param actListener the act listener
* @return the JMenueItem network address
*/
private JMenuItem getJMenueItemNetworkAddress(NetworkAddress networkAddress, ActionListener actListener) {
JMenuItem jMenuItem = new JMenuItem(networkAddress.toString());
jMenuItem.setFont(new Font("Dialog", Font.PLAIN, 12));
jMenuItem.addActionListener(actListener);
jMenuItem.setActionCommand(networkAddress.getInetAddress().getHostAddress());
return jMenuItem;
}
示例5: LogLevelMenu
import javax.swing.JMenuItem; //导入方法依赖的package包/类
public LogLevelMenu() {
super("log_level");
for (final Level level : LogViewer.SELECTABLE_LEVELS) {
JMenuItem item = new JMenuItem(new AbstractAction(level.getName()) {
private static final long serialVersionUID = 1L;
@Override
public void actionPerformed(ActionEvent e) {
new Thread(new Runnable() {
@Override
public void run() {
// change the log level outside the EDT
// no progress thread because the part that may take some time (the
// GUI refresh by Swing) cannot be cancelled anyway
setLogLevel(level);
}
}).start();
}
});
// highlight current log level
if (getLogSelectionModel().getCurrentLogModel() != null) {
if (level.equals(getLogSelectionModel().getCurrentLogModel().getLogLevel())) {
item.setFont(item.getFont().deriveFont(Font.BOLD));
}
}
add(item);
}
}
示例6: addIndianSettlement
import javax.swing.JMenuItem; //导入方法依赖的package包/类
/**
* Adds an indian settlement entry to this popup.
*
* @param is The {@code IndianSettlement} that will be
* represented on the popup.
*/
private void addIndianSettlement(final IndianSettlement is) {
StringTemplate name
= is.getLocationLabelFor(freeColClient.getMyPlayer());
JMenuItem menuItem = Utility.localizedMenuItem(name);
menuItem.setFont(FontLibrary.createFont(FontLibrary.FontType.NORMAL,
FontLibrary.FontSize.TINY, Font.BOLD,
gui.getImageLibrary().getScaleFactor()));
menuItem.addActionListener((ActionEvent ae) -> {
gui.showIndianSettlement(is);
});
add(menuItem);
hasAnItem = true;
}
示例7: addIndianSettlement
import javax.swing.JMenuItem; //导入方法依赖的package包/类
/**
* Adds an indian settlement entry to this popup.
*
* @param is The {@code IndianSettlement} that will be
* represented on the popup.
*/
private void addIndianSettlement(final IndianSettlement is) {
StringTemplate name
= is.getLocationLabelFor(freeColClient.getMyPlayer());
JMenuItem menuItem = Utility.localizedMenuItem(name);
menuItem.setFont(FontLibrary.createFont(FontLibrary.FontType.NORMAL,
FontLibrary.FontSize.TINY, Font.BOLD,
gui.getImageLibrary().getScaleFactor()));
menuItem.addActionListener((ActionEvent ae) -> {
gui.showIndianSettlementPanel(is);
});
add(menuItem);
hasAnItem = true;
}
示例8: addTitle
import javax.swing.JMenuItem; //导入方法依赖的package包/类
private void addTitle(String s)
{
JMenuItem lbl = new JMenuItem(s);
lbl.setFont(new Font("sansserif", Font.BOLD, 13));
lbl.setForeground(Color.DARK_GRAY);
lbl.setBorder(new UnderlineBorder(2, 0, 0, 0));
lbl.setBorderPainted(true);
menu.add(lbl);
}