Example usage for javax.swing LookAndFeel installBorder

List of usage examples for javax.swing LookAndFeel installBorder

Introduction

In this page you can find the example usage for javax.swing LookAndFeel installBorder.

Prototype

public static void installBorder(JComponent c, String defaultBorderName) 

Source Link

Document

Convenience method for setting a component's border property with a value from the defaults.

Usage

From source file:RowNumberHeader.java

public RowNumberHeader(JTable table) {
    super();//from ww  w .  ja  v  a 2 s.c o  m
    mainTable = table;
    setModel(new RowNumberTableModel());
    setPreferredScrollableViewportSize(getMinimumSize());
    setRowSelectionAllowed(false);
    JComponent renderer = (JComponent) getDefaultRenderer(Object.class);
    LookAndFeel.installColorsAndFont(renderer, "TableHeader.background", "TableHeader.foreground",
            "TableHeader.font");
    LookAndFeel.installBorder(this, "TableHeader.cellBorder");
}

From source file:SortedTableModel.java

public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
        int row, int column) {
    Component text;// w w  w .  j av  a2  s .c om
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());

    if (textRenderer != null) {
        text = textRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    } else {
        text = new JLabel((String) value, JLabel.CENTER);
        LookAndFeel.installColorsAndFont((JComponent) text, "TableHeader.background", "TableHeader.foreground",
                "TableHeader.font");
    }
    panel.add(text, BorderLayout.CENTER);

    if (column == sortColumn) {
        BasicArrowButton bab = new BasicArrowButton(
                (sortAscending ? SwingConstants.NORTH : SwingConstants.SOUTH));
        panel.add(bab, BorderLayout.WEST);
    }
    LookAndFeel.installBorder(panel, "TableHeader.cellBorder");
    return panel;
}

From source file:SortedTableModel.java

public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
        int row, int column) {
    JLabel label;//from w  w  w. ja v a2  s  .c o m
    removeAll();
    String[] header = ((String) value).split("\n");
    setLayout(new GridLayout(header.length, 1));
    for (String s : header) {
        label = new JLabel(s, JLabel.CENTER);
        LookAndFeel.installColorsAndFont(label, "TableHeader.background", "TableHeader.foreground",
                "TableHeader.font");
        add(label);
    }
    LookAndFeel.installBorder(this, "TableHeader.cellBorder");
    return this;
}