当前位置: 首页>>代码示例>>Java>>正文


Java JMenuItem.setFont方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:24,代码来源:RecentItems.java

示例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);
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:18,代码来源:DriverContextMenu.java

示例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;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:15,代码来源:NetworkAddresses.java

示例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;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:15,代码来源:NetworkAddresses.java

示例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);
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:33,代码来源:LogViewer.java

示例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;
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:20,代码来源:TilePopup.java

示例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;
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:20,代码来源:TilePopup.java

示例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);
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:10,代码来源:DriverContextMenu.java


注:本文中的javax.swing.JMenuItem.setFont方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。