Search in sources :

Example 21 with LineBorder

use of javax.swing.border.LineBorder in project JMRI by JMRI.

the class PositionablePropertiesUtil method preview.

void preview() {
    int attrs = Font.PLAIN;
    if (bold.isSelected()) {
        attrs = Font.BOLD;
    }
    if (italic.isSelected()) {
        attrs |= Font.ITALIC;
    }
    Font newFont = new Font(_parent.getFont().getName(), attrs, Integer.parseInt(fontSizeField.getText()));
    Color desiredColor;
    desiredColor = colorFromComboBox(borderColorCombo, null);
    Border borderMargin = BorderFactory.createEmptyBorder(0, 0, 0, 0);
    int margin = ((Number) marginSizeTextSpin.getValue()).intValue();
    Border outlineBorder = BorderFactory.createEmptyBorder(0, 0, 0, 0);
    if (desiredColor != null) {
        outlineBorder = new LineBorder(desiredColor, ((Number) borderSizeTextSpin.getValue()).intValue());
    } else {
        outlineBorder = BorderFactory.createEmptyBorder(0, 0, 0, 0);
    }
    int hoz = 0;
    switch(_justificationCombo.getSelectedIndex()) {
        case 0:
            hoz = (0x02);
            break;
        case 1:
            hoz = (0x04);
            break;
        case 2:
            hoz = (0x00);
            break;
        default:
            log.warn("Unhandled combo index: {}", _justificationCombo.getSelectedIndex());
            break;
    }
    for (int i = 0; i < txtList.size(); i++) {
        JLabel tmp = txtList.get(i).getLabel();
        if (tmp.isOpaque()) {
            borderMargin = new LineBorder(tmp.getBackground(), margin);
        } else {
            borderMargin = BorderFactory.createEmptyBorder(margin, margin, margin, margin);
        }
        tmp.setFont(newFont);
        tmp.setHorizontalAlignment(hoz);
        tmp.setBorder(new CompoundBorder(outlineBorder, borderMargin));
        tmp.setSize(new Dimension(maxWidth(tmp), maxHeight(tmp)));
        tmp.setPreferredSize(new Dimension(maxWidth(tmp), maxHeight(tmp)));
    }
    mFrame.pack();
}
Also used : Color(java.awt.Color) LineBorder(javax.swing.border.LineBorder) JLabel(javax.swing.JLabel) CompoundBorder(javax.swing.border.CompoundBorder) Dimension(java.awt.Dimension) LineBorder(javax.swing.border.LineBorder) Border(javax.swing.border.Border) CompoundBorder(javax.swing.border.CompoundBorder) Font(java.awt.Font)

Example 22 with LineBorder

use of javax.swing.border.LineBorder in project JMRI by JMRI.

the class DecoratorPanel method updateSamples.

private void updateSamples() {
    if (_previewPanel == null) {
        return;
    }
    int mar = _util.getMargin();
    int bor = _util.getBorderSize();
    Border outlineBorder;
    if (bor == 0) {
        outlineBorder = BorderFactory.createEmptyBorder(0, 0, 0, 0);
    } else {
        outlineBorder = new LineBorder(_util.getBorderColor(), bor);
    }
    Font font = _util.getFont();
    int just = _util.getJustification();
    Iterator<PositionableLabel> it = _sample.values().iterator();
    while (it.hasNext()) {
        PositionableLabel sam = it.next();
        PositionablePopupUtil util = sam.getPopupUtility();
        sam.setFont(font);
        util.setFixedWidth(_util.getFixedWidth());
        util.setFixedHeight(_util.getFixedHeight());
        util.setMargin(mar);
        util.setBorderSize(bor);
        Border borderMargin;
        if (sam.isOpaque()) {
            borderMargin = new LineBorder(sam.getBackground(), mar);
        } else {
            borderMargin = BorderFactory.createEmptyBorder(mar, mar, mar, mar);
        }
        sam.setBorder(new CompoundBorder(outlineBorder, borderMargin));
        switch(just) {
            case PositionablePopupUtil.LEFT:
                sam.setHorizontalAlignment(JLabel.LEFT);
                break;
            case PositionablePopupUtil.RIGHT:
                sam.setHorizontalAlignment(JLabel.RIGHT);
                break;
            default:
                sam.setHorizontalAlignment(JLabel.CENTER);
        }
        sam.updateSize();
        sam.setPreferredSize(sam.getSize());
        sam.repaint();
    }
    if (_dialog != null) {
        _dialog.pack();
    }
}
Also used : PositionablePopupUtil(jmri.jmrit.display.PositionablePopupUtil) LineBorder(javax.swing.border.LineBorder) PositionableLabel(jmri.jmrit.display.PositionableLabel) CompoundBorder(javax.swing.border.CompoundBorder) LineBorder(javax.swing.border.LineBorder) Border(javax.swing.border.Border) CompoundBorder(javax.swing.border.CompoundBorder) Font(java.awt.Font)

Example 23 with LineBorder

use of javax.swing.border.LineBorder in project beast-mcmc by beast-dev.

the class JTableButtonCellRenderer method getTableCellRendererComponent.

// END: Constructor
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    JButton button = (JButton) value;
    if (isSelected) {
        button.setForeground(table.getSelectionForeground());
        button.setBackground(table.getSelectionBackground());
    } else {
        button.setForeground(table.getForeground());
        button.setBackground(UIManager.getColor("Button.background"));
    }
    if (hasFocus) {
        button.setBorder(new LineBorder(Color.BLUE));
    } else {
        button.setBorder(button.getBorder());
    }
    // label on button
    if (dataList != null) {
        // switch between edit taxa and choose file labels
        String label = null;
        switch(columnIndex) {
            case TreesTableModel.TREE_FILE_INDEX:
                if (!dataList.recordsList.get(row).isTreeSet()) {
                    label = Utils.CHOOSE_FILE;
                } else {
                    label = dataList.recordsList.get(row).getName();
                }
                break;
            case TreesTableModel.TAXA_SET_INDEX:
                if (!dataList.recordsList.get(row).isTaxaSet()) {
                    label = Utils.EDIT_TAXA_SET;
                } else {
                    label = dataList.recordsList.get(row).getName();
                }
                break;
            default:
                break;
        }
        // END: switch
        button.setText(label);
    }
    // tooltips
    if (toolTipText != null) {
        button.setToolTipText(toolTipText);
    }
    return button;
}
Also used : LineBorder(javax.swing.border.LineBorder) JButton(javax.swing.JButton)

Example 24 with LineBorder

use of javax.swing.border.LineBorder in project jgnash by ccavanaugh.

the class NewFileSummary method layoutMainPanel.

private void layoutMainPanel() {
    initComponents();
    FormLayout layout = new FormLayout("p, 8dlu, d:g", "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout, this);
    builder.appendSeparator(rb.getString("Title.Summary"));
    builder.append(rb.getString("Label.FileName"), fileField);
    builder.append(rb.getString("Label.DefaultCurrency"), baseCurrencyField);
    JScrollPane scrollPane = new JScrollPane(currenciesList);
    scrollPane.setBorder(new LineBorder((Color) UIManager.getDefaults().get("TextArea.inactiveForeground")));
    builder.append(rb.getString("Label.Currencies"), scrollPane);
}
Also used : FormLayout(com.jgoodies.forms.layout.FormLayout) JScrollPane(javax.swing.JScrollPane) DefaultFormBuilder(com.jgoodies.forms.builder.DefaultFormBuilder) LineBorder(javax.swing.border.LineBorder) Color(java.awt.Color)

Example 25 with LineBorder

use of javax.swing.border.LineBorder in project gephi by gephi.

the class BasicRichTooltipPanelUI method installDefaults.

/**
	 * Installs default settings for the associated rich tooltip panel.
	 */
protected void installDefaults() {
    Border b = this.richTooltipPanel.getBorder();
    if (b == null || b instanceof UIResource) {
        Border toSet = UIManager.getBorder("RichTooltipPanel.border");
        if (toSet == null)
            toSet = new BorderUIResource.CompoundBorderUIResource(new LineBorder(FlamingoUtilities.getBorderColor()), new EmptyBorder(2, 4, 3, 4));
        this.richTooltipPanel.setBorder(toSet);
    }
    LookAndFeel.installProperty(this.richTooltipPanel, "opaque", Boolean.TRUE);
}
Also used : LineBorder(javax.swing.border.LineBorder) EmptyBorder(javax.swing.border.EmptyBorder) LineBorder(javax.swing.border.LineBorder) Border(javax.swing.border.Border) EmptyBorder(javax.swing.border.EmptyBorder) BorderUIResource(javax.swing.plaf.BorderUIResource) UIResource(javax.swing.plaf.UIResource)

Aggregations

LineBorder (javax.swing.border.LineBorder)37 ActionEvent (java.awt.event.ActionEvent)9 CompoundBorder (javax.swing.border.CompoundBorder)9 Color (java.awt.Color)7 Border (javax.swing.border.Border)7 ActionListener (java.awt.event.ActionListener)6 JButton (javax.swing.JButton)6 EmptyBorder (javax.swing.border.EmptyBorder)6 Dimension (java.awt.Dimension)4 JLabel (javax.swing.JLabel)4 JScrollPane (javax.swing.JScrollPane)4 BorderLayout (java.awt.BorderLayout)3 Font (java.awt.Font)3 JTextField (javax.swing.JTextField)3 Tree (com.intellij.ui.treeStructure.Tree)2 Point (java.awt.Point)2 ItemEvent (java.awt.event.ItemEvent)2 ItemListener (java.awt.event.ItemListener)2 MouseEvent (java.awt.event.MouseEvent)2 IOException (java.io.IOException)2