Refine search
JLabel label = new JLabel("Underlined Label"); Font font = label.getFont(); Map attributes = font.getAttributes(); attributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON); label.setFont(font.deriveFont(attributes));
public ViewBar(ChartPanelView chartPanelView) { this.chartPanelView = chartPanelView; setLayout(new GridBagLayout()); this.title.setOpaque(false); this.title.setHorizontalAlignment(SwingConstants.LEFT); this.title.setFont(this.title.getFont().deriveFont(this.title.getFont().getSize2D()*0.8f)); //minimize.set GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.weightx = 2.0; gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; add(this.title, gridBagConstraints); gridBagConstraints.weightx = 0.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.gridx = 1; gridBagConstraints.fill = GridBagConstraints.VERTICAL; add(minimizeButton, gridBagConstraints); gridBagConstraints.gridx = 2; add(closeButton, gridBagConstraints); minimizeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { ViewBar.this.chartPanelView.setMinimized(!ViewBar.this.chartPanelView.isMinimized()); } }); closeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { ViewBar.this.chartPanelView.close(); } }); }
public MessageOverlay() { iconInfo = new ImageIcon(MessageOverlay.class.getResource("info.gif")); iconInfo.setImageObserver(this); iconError = new ImageIcon(MessageOverlay.class.getResource("error.gif")); iconError.setImageObserver(this); icon = iconInfo; messageFont = new JLabel().getFont().deriveFont(Font.BOLD); }
Font labelFont = labelRender.getFont(); String labelText = "{W}"; //labelRender.getText(); // need same font size for all -- use max symbol ever, not current text int stringWidth = labelRender.getFontMetrics(labelFont).stringWidth(labelText); labelRender.setFont(new Font(labelFont.getName(), Font.PLAIN + Font.BOLD, fontSizeToUse - 1)); // - for "..." fix in text
JLabel label = new JLabel("Underlined Label"); Font font = label.getFont(); Map attributes = font.getAttributes(); attributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON); label.setFont(font.deriveFont(attributes));
public MessageOverlay(int maxLength) { max_length = maxLength; iconInfo = new ImageIcon(MessageOverlay.class.getResource("info.gif")); iconInfo.setImageObserver(this); iconError = new ImageIcon(MessageOverlay.class.getResource("error.gif")); iconError.setImageObserver(this); icon = iconInfo; messageFont = new JLabel().getFont().deriveFont(Font.BOLD); } public MessageOverlay() {
browseCancelButton.addActionListener(evt -> browseCancelButtonActionPerformed(evt)); Font f = currentFile.getFont(); currentFile.setFont(f.deriveFont(f.getStyle() | Font.BOLD));
@Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JLabel defaultLabel = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); defaultLabel.setHorizontalAlignment(JLabel.CENTER); // colors String val = (String) value; String[] valsList = val.split("/"); if (valsList.length == 2 && !valsList[0].equals(valsList[1])) { // green draw Color defaultBack = defaultLabel.getBackground(); greenLabel.setText(val); greenLabel.setHorizontalAlignment(JLabel.CENTER); greenLabel.setFont(defaultLabel.getFont()); greenLabel.setForeground(Color.black); greenLabel.setOpaque(true); greenLabel.setBackground(new Color(156, 240, 146)); greenLabel.setBorder(new LineBorder(defaultBack, 1)); return greenLabel; } else { // default draw return defaultLabel; } } };
private JComponent getNorthLabel() { final JLabel text = new JLabel("PlantUML (" + Version.versionString() + ")"); final Font font = text.getFont().deriveFont(Font.BOLD, (float) 20.0); text.setFont(font); final JPanel ptext = new JPanel(); ptext.add(text); final JLabel icon = new JLabel(new ImageIcon(PSystemVersion.getPlantumlImage())); final JPanel result = new JPanel(new BorderLayout()); result.add(ptext, BorderLayout.CENTER); result.add(icon, BorderLayout.EAST); return result; }
final Spacer spacer1 = new Spacer(); rootPanel.add(spacer1, new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); final JLabel label1 = new JLabel(); Font label1Font = this.$$$getFont$$$(null, Font.BOLD, 20, label1.getFont()); if (label1Font != null) label1.setFont(label1Font); label1.setText("Miscellaneous Settings"); rootPanel.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
JTextArea ta = new JTextArea(text); ta.setEditable(false); ta.setLineWrap(true); ta.setWrapStyleWord(true); JLabel lb = new JLabel(); Font f = lb.getFont(); ta.setFont(f.deriveFont(f.getSize2D() * 0.9f)); ta.setBorder(lb.getBorder()); ta.setBackground(new Color(lb.getBackground().getRGB(), true)); ta.setForeground(new Color(lb.getForeground().getRGB(), true)); ta.setOpaque(lb.isOpaque());
Font font = lifeLabel.getFont(); font = font.deriveFont(9f); lifeLabel.setFont(font); changedFontLife = true; } else if (changedFontLife) { Font font = lifeLabel.getFont(); font = font.deriveFont(12f); lifeLabel.setFont(font); changedFontLife = false; int libraryCards = player.getLibraryCount(); if (libraryCards > 99) { Font font = libraryLabel.getFont(); font = font.deriveFont(9f); libraryLabel.setFont(font); changedFontLibrary = true; } else if (changedFontLibrary) { Font font = libraryLabel.getFont(); if (graveCards > 99) { if (!changedFontGrave) { Font font = graveLabel.getFont(); Font font = lifeLabel.getFont(); if (exileCards > 99) { if (!changedFontExile) { Font font = exileLabel.getFont();
@Override public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus ) { if (index == selected) { numberLabel.setFont(doDeriveFont(numberLabel.getFont(), Font.BOLD)); ta.setFont(doDeriveFont(ta.getFont(), Font.BOLD)); } else { numberLabel.setFont(doDeriveFont(numberLabel.getFont(), Font.PLAIN)); ta.setFont(doDeriveFont(ta.getFont(), Font.PLAIN)); } if (contentNumbered) { numberLabel.setText(Integer.toString(index + 1) + "."); // NOI18N } // #21322: on JDK1.4 wrapping width is cleared between two rendering runs Insets taInsets = ta.getInsets(); ta.setSize(taWidth, taInsets.top + taInsets.bottom + 1); ta.setText((String) value); return this; }
private JComponent getNorthLabel() { final JLabel text = new JLabel("PlantUML (" + Version.versionString() + ")"); final Font font = text.getFont().deriveFont(Font.BOLD, (float) 20.0); text.setFont(font); final JPanel ptext = new JPanel(); ptext.add(text); final JLabel icon = new JLabel(new ImageIcon(PSystemVersion.getPlantumlImage())); final JPanel result = new JPanel(new BorderLayout()); result.add(ptext, BorderLayout.CENTER); result.add(icon, BorderLayout.EAST); return result; }