Java Code Examples for javax.swing.JButton#getFont()
The following examples show how to use
javax.swing.JButton#getFont() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SampleAnalysisWorkflowManagerIDTIMS.java From ET_Redux with Apache License 2.0 | 5 votes |
private void tuneNotesButton(JButton tempJB, String notes) { Font font = tempJB.getFont(); if (notes.length() == 0) { tempJB.setFont(font.deriveFont(font.getStyle() & ~Font.BOLD)); } else { tempJB.setFont(font.deriveFont(font.getStyle() | Font.BOLD)); } tempJB.setToolTipText(notes); }
Example 2
Source File: SNT.java From SNT with GNU General Public License v3.0 | 5 votes |
protected static JButton smallButton(final String text) { final double SCALE = .85; final JButton button = new JButton(text); final Font font = button.getFont(); button.setFont(font.deriveFont((float) (font.getSize() * SCALE))); final Insets insets = button.getMargin(); button.setMargin(new Insets((int) (insets.top * SCALE), (int) (insets.left * SCALE), (int) (insets.bottom * SCALE), (int) (insets.right * SCALE))); return button; }
Example 3
Source File: BeltColumnStatisticsPanel.java From rapidminer-studio with GNU Affero General Public License v3.0 | 4 votes |
/** * Updates the charts. */ @SuppressWarnings({ "unchecked", "rawtypes" }) private void updateCharts() { for (int i = 0; i < listOfChartPanels.size(); i++) { JPanel panel = listOfChartPanels.get(i); panel.removeAll(); JFreeChart chartOrNull = getModel().getChartOrNull(i); if (chartOrNull != null) { final ChartPanel chartPanel = new ChartPanel(chartOrNull) { private static final long serialVersionUID = -6953213567063104487L; @Override public Dimension getPreferredSize() { return DIMENSION_CHART_PANEL_ENLARGED; } }; chartPanel.setPopupMenu(null); chartPanel.setBackground(COLOR_TRANSPARENT); chartPanel.setOpaque(false); chartPanel.addMouseListener(enlargeAndHoverAndPopupMouseAdapter); panel.add(chartPanel, BorderLayout.CENTER); JPanel openChartPanel = new JPanel(new GridBagLayout()); openChartPanel.setOpaque(false); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.NONE; gbc.weightx = 1.0; gbc.weighty = 1.0; JButton openChartButton = new JButton(OPEN_CHART_ACTION); openChartButton.setOpaque(false); openChartButton.setContentAreaFilled(false); openChartButton.setBorderPainted(false); openChartButton.addMouseListener(enlargeAndHoverAndPopupMouseAdapter); openChartButton.setHorizontalAlignment(SwingConstants.LEFT); openChartButton.setHorizontalTextPosition(SwingConstants.LEFT); openChartButton.setIcon(null); Font font = openChartButton.getFont(); Map attributes = font.getAttributes(); attributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON); openChartButton.setFont(font.deriveFont(attributes).deriveFont(10.0f)); openChartPanel.add(openChartButton, gbc); panel.add(openChartPanel, BorderLayout.SOUTH); } panel.revalidate(); panel.repaint(); } }
Example 4
Source File: AttributeStatisticsPanel.java From rapidminer-studio with GNU Affero General Public License v3.0 | 4 votes |
/** * Updates the charts. */ @SuppressWarnings({ "unchecked", "rawtypes" }) private void updateCharts() { for (int i = 0; i < listOfChartPanels.size(); i++) { JPanel panel = listOfChartPanels.get(i); panel.removeAll(); final ChartPanel chartPanel = new ChartPanel(getModel().getChartOrNull(i)) { private static final long serialVersionUID = -6953213567063104487L; @Override public Dimension getPreferredSize() { return DIMENSION_CHART_PANEL_ENLARGED; } }; chartPanel.setPopupMenu(null); chartPanel.setBackground(COLOR_TRANSPARENT); chartPanel.setOpaque(false); chartPanel.addMouseListener(enlargeAndHoverAndPopupMouseAdapter); panel.add(chartPanel, BorderLayout.CENTER); JPanel openChartPanel = new JPanel(new GridBagLayout()); openChartPanel.setOpaque(false); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.NONE; gbc.weightx = 1.0; gbc.weighty = 1.0; JButton openChartButton = new JButton(OPEN_CHART_ACTION); openChartButton.setOpaque(false); openChartButton.setContentAreaFilled(false); openChartButton.setBorderPainted(false); openChartButton.addMouseListener(enlargeAndHoverAndPopupMouseAdapter); openChartButton.setHorizontalAlignment(SwingConstants.LEFT); openChartButton.setHorizontalTextPosition(SwingConstants.LEFT); openChartButton.setIcon(null); Font font = openChartButton.getFont(); Map attributes = font.getAttributes(); attributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON); openChartButton.setFont(font.deriveFont(attributes).deriveFont(10.0f)); openChartPanel.add(openChartButton, gbc); panel.add(openChartPanel, BorderLayout.SOUTH); panel.revalidate(); panel.repaint(); } }