當前位置: 首頁>>代碼示例>>Java>>正文


Java JToggleButton.setFont方法代碼示例

本文整理匯總了Java中javax.swing.JToggleButton.setFont方法的典型用法代碼示例。如果您正苦於以下問題:Java JToggleButton.setFont方法的具體用法?Java JToggleButton.setFont怎麽用?Java JToggleButton.setFont使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.JToggleButton的用法示例。


在下文中一共展示了JToggleButton.setFont方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: actionPerformed

import javax.swing.JToggleButton; //導入方法依賴的package包/類
@Override
public void actionPerformed(ActionEvent e) {
	for (JToggleButton button : primaryButtons) {
		if (button != e.getSource() && button.isSelected()) {
			button.setSelected(false);
		} else if (button == e.getSource() && !button.isSelected()) {
			button.setSelected(true);
		}

		if (button.isSelected()) {
			button.setFont(button.getFont().deriveFont(Font.BOLD));
		} else {
			button.setFont(button.getFont().deriveFont(Font.PLAIN));
		}
	}

	if (secondaryButton != null) {
		if (secondaryButton != e.getSource() && secondaryButton.isSelected()) {
			secondaryButton.clearMenuSelection();
		}
	}
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:23,代碼來源:ToggleButtonGroup.java

示例2: toggleView

import javax.swing.JToggleButton; //導入方法依賴的package包/類
private void toggleView(java.awt.event.ItemEvent evt) {
    JToggleButton toggleButton = ((JToggleButton) evt.getSource());
    if (evt.getStateChange() == ItemEvent.SELECTED) {
        toggleButton.setFont(toggleButton.getFont().deriveFont(Font.BOLD));
        String text = toggleButton.getText();
        CardLayout layout = (CardLayout) cardPanel.getLayout();
        layout.show(cardPanel, text);
    } else {
        toggleButton.setFont(toggleButton.getFont().deriveFont(Font.PLAIN));
    }
}
 
開發者ID:CognizantQAHub,項目名稱:Cognizant-Intelligent-Test-Scripter,代碼行數:12,代碼來源:StartUp.java

示例3: waypointAdded

import javax.swing.JToggleButton; //導入方法依賴的package包/類
/**
 * Called when a waypoint is added. This implementation adds a waypoint button.
 * @param graphic the waypoint graphic, whose ID may or may not be populated.
 * @param graphicUid the waypoint graphic's ID.
 * @see RouteListener#waypointAdded(com.esri.core.map.Graphic, int)
 */
public void waypointAdded(Graphic graphic, int graphicUid) {
    final JToggleButton button = new JToggleButton((String) graphic.getAttributeValue("name"));
    waypointButtonToGraphicId.put(button, graphicUid);
    graphicIdToWaypointButton.put(graphicUid, button);
    Font font = new Font("Arial", Font.PLAIN, 18);
    button.setFont(font);
    button.setFocusable(false);
    button.setSelected(false);
    button.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            if (button == selectedWaypointButton) {
                //Unselect
                buttonGroup_waypoints.remove(button);
                button.setSelected(false);
                buttonGroup_waypoints.add(button);
                selectedWaypointButton = null;

                routeController.setSelectedWaypoint(null);
            } else {
                selectedWaypointButton = button;

                routeController.setSelectedWaypoint(waypointButtonToGraphicId.get(button));
            }
        }
    });
    button.setMaximumSize(new Dimension(Integer.MAX_VALUE, 60));
    button.setMinimumSize(new Dimension(0, 60));
    jPanel_waypointsList.add(button);
    buttonGroup_waypoints.add(button);
}
 
開發者ID:Esri,項目名稱:defense-solutions-proofs-of-concept,代碼行數:38,代碼來源:MainMenuJPanel.java


注:本文中的javax.swing.JToggleButton.setFont方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。