本文整理了Java中javax.swing.JButton.setFont()
方法的一些代码示例,展示了JButton.setFont()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JButton.setFont()
方法的具体详情如下:
包路径:javax.swing.JButton
类名称:JButton
方法名:setFont
暂无
代码示例来源:origin: stackoverflow.com
JButton b = new JButton("Hello World");
b.setFont(myFont);
代码示例来源:origin: deathmarine/Luyten
protected JDialog createDialog(Component parent) {
Frame frame = parent instanceof Frame ? (Frame) parent
: (Frame) SwingUtilities.getAncestorOfClass(Frame.class, parent);
JDialog dialog = new JDialog(frame, ("Select Font"), true);
Action okAction = new DialogOKAction(dialog);
Action cancelAction = new DialogCancelAction(dialog);
JButton okButton = new JButton(okAction);
okButton.setFont(DEFAULT_FONT);
JButton cancelButton = new JButton(cancelAction);
cancelButton.setFont(DEFAULT_FONT);
JPanel buttonsPanel = new JPanel();
buttonsPanel.setLayout(new GridLayout(2, 1));
buttonsPanel.add(okButton);
buttonsPanel.add(cancelButton);
buttonsPanel.setBorder(BorderFactory.createEmptyBorder(25, 0, 10, 10));
ActionMap actionMap = buttonsPanel.getActionMap();
actionMap.put(cancelAction.getValue(Action.DEFAULT), cancelAction);
actionMap.put(okAction.getValue(Action.DEFAULT), okAction);
InputMap inputMap = buttonsPanel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
inputMap.put(KeyStroke.getKeyStroke("ESCAPE"), cancelAction.getValue(Action.DEFAULT));
inputMap.put(KeyStroke.getKeyStroke("ENTER"), okAction.getValue(Action.DEFAULT));
JPanel dialogEastPanel = new JPanel();
dialogEastPanel.setLayout(new BorderLayout());
dialogEastPanel.add(buttonsPanel, BorderLayout.NORTH);
dialog.getContentPane().add(this, BorderLayout.CENTER);
dialog.getContentPane().add(dialogEastPanel, BorderLayout.EAST);
dialog.pack();
dialog.setLocationRelativeTo(frame);
return dialog;
}
代码示例来源:origin: libgdx/libgdx
upButton.setMargin(new Insets(0, 0, 0, 0));
Font font = upButton.getFont();
upButton.setFont(new Font(font.getName(), font.getStyle(), font.getSize() - 2));
downButton.setMargin(new Insets(0, 0, 0, 0));
Font font = downButton.getFont();
downButton.setFont(new Font(font.getName(), font.getStyle(), font.getSize() - 2));
deleteButton.setMargin(new Insets(0, 0, 0, 0));
Font font = deleteButton.getFont();
deleteButton.setFont(new Font(font.getName(), font.getStyle(), font.getSize() - 2));
代码示例来源:origin: libgdx/libgdx
upButton.setMargin(new Insets(0, 0, 0, 0));
Font font = upButton.getFont();
upButton.setFont(new Font(font.getName(), font.getStyle(), font.getSize() - 2));
downButton.setMargin(new Insets(0, 0, 0, 0));
Font font = downButton.getFont();
downButton.setFont(new Font(font.getName(), font.getStyle(), font.getSize() - 2));
deleteButton.setMargin(new Insets(0, 0, 0, 0));
Font font = deleteButton.getFont();
deleteButton.setFont(new Font(font.getName(), font.getStyle(), font.getSize() - 2));
代码示例来源:origin: wildfly/wildfly
public void go() throws Exception {
if(!no_channel && !use_state)
channel.connect(cluster_name);
mainFrame=new JFrame();
mainFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
panel=new DrawPanel(use_state);
panel.setBackground(background_color);
sub_panel=new JPanel();
mainFrame.getContentPane().add("Center", panel);
clear_button=new JButton("Clear");
clear_button.setFont(default_font);
clear_button.addActionListener(this);
leave_button=new JButton("Leave");
leave_button.setFont(default_font);
leave_button.addActionListener(this);
sub_panel.add("South", clear_button);
sub_panel.add("South", leave_button);
mainFrame.getContentPane().add("South", sub_panel);
mainFrame.setBackground(background_color);
clear_button.setForeground(Color.blue);
leave_button.setForeground(Color.blue);
mainFrame.pack();
mainFrame.setLocation(15, 25);
mainFrame.setBounds(new Rectangle(250, 250));
if(!no_channel && use_state) {
channel.connect(cluster_name, null, state_timeout);
}
mainFrame.setVisible(true);
setTitle();
}
代码示例来源:origin: wildfly/wildfly
mainFrame.getContentPane().add("Center", panel);
clear_button=new JButton("Clear");
clear_button.setFont(default_font);
clear_button.addActionListener(this);
leave_button=new JButton("Leave");
leave_button.setFont(default_font);
leave_button.addActionListener(this);
sub_panel.add("South", clear_button);
代码示例来源:origin: RipMeApp/ripme
optionQueue = new JButton(rb.getString("Queue"));
optionConfiguration = new JButton(rb.getString("Configuration"));
optionLog.setFont(optionLog.getFont().deriveFont(Font.PLAIN));
optionHistory.setFont(optionLog.getFont().deriveFont(Font.PLAIN));
optionQueue.setFont(optionLog.getFont().deriveFont(Font.PLAIN));
optionConfiguration.setFont(optionLog.getFont().deriveFont(Font.PLAIN));
try {
Image icon;
代码示例来源:origin: RipMeApp/ripme
configurationPanel.setVisible(false);
if (logPanel.isVisible()) {
optionLog.setFont(optionLog.getFont().deriveFont(Font.BOLD));
} else {
optionLog.setFont(optionLog.getFont().deriveFont(Font.PLAIN));
optionHistory.setFont(optionLog.getFont().deriveFont(Font.PLAIN));
optionQueue.setFont(optionLog.getFont().deriveFont(Font.PLAIN));
optionConfiguration.setFont(optionLog.getFont().deriveFont(Font.PLAIN));
pack();
});
queuePanel.setVisible(false);
configurationPanel.setVisible(false);
optionLog.setFont(optionLog.getFont().deriveFont(Font.PLAIN));
if (historyPanel.isVisible()) {
optionHistory.setFont(optionLog.getFont().deriveFont(Font.BOLD));
} else {
optionHistory.setFont(optionLog.getFont().deriveFont(Font.PLAIN));
optionQueue.setFont(optionLog.getFont().deriveFont(Font.PLAIN));
optionConfiguration.setFont(optionLog.getFont().deriveFont(Font.PLAIN));
pack();
});
emptyPanel.setVisible(!queuePanel.isVisible());
configurationPanel.setVisible(false);
optionLog.setFont(optionLog.getFont().deriveFont(Font.PLAIN));
optionHistory.setFont(optionLog.getFont().deriveFont(Font.PLAIN));
代码示例来源:origin: runelite/runelite
clearButton.setFont(FontManager.getRunescapeBoldFont());
clearButton.setForeground(ColorScheme.PROGRESS_ERROR_COLOR);
clearButton.setBorder(null);
代码示例来源:origin: magefree/mage
private void setGUISize() {
renderButton.setFont(GUISizeHelper.tableFont);
editButton.setFont(GUISizeHelper.tableFont);
}
代码示例来源:origin: stackoverflow.com
JButton b = new JButton();
b.setFont(b.getFont().deriveFont(18.0f));
代码示例来源:origin: magefree/mage
private void setGUISize() {
Font font = GUISizeHelper.gameRequestsFont;
lblText.setFont(font);
lblText.setMaximumSize(new Dimension(300 + font.getSize() * 15, 20 + font.getSize() * 5));
lblText.setMinimumSize(new Dimension(300 + font.getSize() * 15, 20 + font.getSize() * 5));
lblText.setPreferredSize(new Dimension(300 + font.getSize() * 15, 20 + font.getSize() * 5));
btn1.setFont(font);
btn1.setMinimumSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
btn1.setMaximumSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
btn1.setPreferredSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
btn2.setFont(font);
btn2.setMinimumSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
btn2.setMaximumSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
btn2.setPreferredSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
btn3.setFont(font);
btn3.setMinimumSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
btn3.setMaximumSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
btn3.setPreferredSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
JComponent c = ((BasicInternalFrameUI) this.getUI()).getNorthPane();
c.setMinimumSize(new Dimension(c.getMinimumSize().width, font.getSize() + 10));
c.setMaximumSize(new Dimension(c.getMaximumSize().width, font.getSize() + 10));
c.setPreferredSize(new Dimension(c.getPreferredSize().width, font.getSize() + 10));
c.setFont(font);
}
代码示例来源:origin: magefree/mage
btnLeft.setFont(GUISizeHelper.gameDialogAreaFont);
btnRight.setFont(GUISizeHelper.gameDialogAreaFont);
btnSpecial.setFont(GUISizeHelper.gameDialogAreaFont);
btnUndo.setFont(GUISizeHelper.gameDialogAreaFont);
代码示例来源:origin: nodebox/nodebox
public DataControl(String nodePath, Port port) {
super(nodePath, port);
setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
clearDataButton = new JButton("Clear");
clearDataButton.setMargin(new Insets(1, 0, 0, 0));
clearDataButton.putClientProperty("JButton.buttonType", "textured");
clearDataButton.putClientProperty("JComponent.sizeVariant", "small");
clearDataButton.setFont(Theme.SMALL_BOLD_FONT);
clearDataButton.setForeground(Theme.TEXT_NORMAL_COLOR);
clearDataButton.addActionListener(this);
add(clearDataButton);
/*showDataButton = new JButton("Show Data...");
showDataButton.setMargin(new Insets(1, 0, 0, 0));
showDataButton.putClientProperty("JButton.buttonType", "textured");
showDataButton.putClientProperty("JComponent.sizeVariant", "small");
showDataButton.setFont(Theme.SMALL_BOLD_FONT);
showDataButton.setForeground(Theme.TEXT_NORMAL_COLOR);
showDataButton.addActionListener(this);
add(showDataButton);*/
add(Box.createHorizontalGlue());
}
代码示例来源:origin: magefree/mage
jPanelBottom.setMinimumSize(newDimension);
jPanelBottom.setPreferredSize(newDimension);
jButtonFooterNext.setFont(GUISizeHelper.menuFont);
jLabelFooterLabel.setFont(new Font(GUISizeHelper.menuFont.getName(), Font.BOLD, GUISizeHelper.menuFont.getSize()));
jLabelFooterText.setFont(GUISizeHelper.menuFont);
代码示例来源:origin: nodebox/nodebox
public TextControl(String nodePath, Port port) {
super(nodePath, port);
setLayout(new BorderLayout(0, 0));
textField = new JTextField();
textField.putClientProperty("JComponent.sizeVariant", "small");
textField.setFont(Theme.SMALL_BOLD_FONT);
textField.addActionListener(this);
externalWindowButton = new JButton("...");
externalWindowButton.putClientProperty("JComponent.sizeVariant", "small");
externalWindowButton.putClientProperty("JButton.buttonType", "gradient");
externalWindowButton.setFont(Theme.SMALL_BOLD_FONT);
externalWindowButton.addActionListener(this);
add(textField, BorderLayout.CENTER);
add(externalWindowButton, BorderLayout.EAST);
setValueForControl(port.getValue());
}
代码示例来源:origin: geotools/geotools
btn.setFont(JMapStatusBar.DEFAULT_FONT);
btn.setToolTipText(TOOL_TIP);
add(btn);
代码示例来源:origin: magefree/mage
btnConnect.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
btnConnect.setText("Connect to server");
btnConnect.setMargin(new java.awt.Insets(2, 2, 2, 2));
代码示例来源:origin: freeplane/freeplane
private void initializeMoveColorUpButton() {
moveColorUp.setName("moveColorUp");
moveColorUp.setFont(BUTTON_FONT);
moveColorUp.setText(MOVE_UP);
moveColorUp.addActionListener(new ColorSwapper(-1));
moveColorUp.setVisible(index > 0);
}
代码示例来源:origin: freeplane/freeplane
private void initializeMoveColorDownButton() {
moveColorDown.setName("moveColorDown");
moveColorDown.setFont(BUTTON_FONT);
moveColorDown.setText(MOVE_DOWN);
moveColorDown.addActionListener(new ColorSwapper(+1));
updateMoveColorDownButton();
}
内容来源于网络,如有侵权,请联系作者删除!