JButton b = new JButton("Hello World"); b.setFont(myFont);
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; }
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));
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));
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(); }
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);
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;
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));
clearButton.setFont(FontManager.getRunescapeBoldFont()); clearButton.setForeground(ColorScheme.PROGRESS_ERROR_COLOR); clearButton.setBorder(null);
JButton b = new JButton(); b.setFont(b.getFont().deriveFont(18.0f));
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); }
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()); }
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);
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()); }
btn.setFont(JMapStatusBar.DEFAULT_FONT); btn.setToolTipText(TOOL_TIP); add(btn);
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));
private void initializeMoveColorUpButton() { moveColorUp.setName("moveColorUp"); moveColorUp.setFont(BUTTON_FONT); moveColorUp.setText(MOVE_UP); moveColorUp.addActionListener(new ColorSwapper(-1)); moveColorUp.setVisible(index > 0); }
private void initializeMoveColorDownButton() { moveColorDown.setName("moveColorDown"); moveColorDown.setFont(BUTTON_FONT); moveColorDown.setText(MOVE_DOWN); moveColorDown.addActionListener(new ColorSwapper(+1)); updateMoveColorDownButton(); }