當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。