Search in sources :

Example 66 with Border

use of javax.swing.border.Border in project jdk8u_jdk by JetBrains.

the class BasicOptionPaneUI method createButtonArea.

/**
     * Creates and returns a Container containing the buttons. The buttons
     * are created by calling <code>getButtons</code>.
     */
protected Container createButtonArea() {
    JPanel bottom = new JPanel();
    Border border = (Border) DefaultLookup.get(optionPane, this, "OptionPane.buttonAreaBorder");
    bottom.setName("OptionPane.buttonArea");
    if (border != null) {
        bottom.setBorder(border);
    }
    bottom.setLayout(new ButtonAreaLayout(DefaultLookup.getBoolean(optionPane, this, "OptionPane.sameSizeButtons", true), DefaultLookup.getInt(optionPane, this, "OptionPane.buttonPadding", 6), DefaultLookup.getInt(optionPane, this, "OptionPane.buttonOrientation", SwingConstants.CENTER), DefaultLookup.getBoolean(optionPane, this, "OptionPane.isYesLast", false)));
    addButtonComponents(bottom, getButtons(), getInitialValueIndex());
    return bottom;
}
Also used : Border(javax.swing.border.Border) EmptyBorder(javax.swing.border.EmptyBorder)

Example 67 with Border

use of javax.swing.border.Border in project jdk8u_jdk by JetBrains.

the class BasicOptionPaneUI method createMessageArea.

/**
     * Messaged from installComponents to create a Container containing the
     * body of the message. The icon is the created by calling
     * <code>addIcon</code>.
     */
protected Container createMessageArea() {
    JPanel top = new JPanel();
    Border topBorder = (Border) DefaultLookup.get(optionPane, this, "OptionPane.messageAreaBorder");
    if (topBorder != null) {
        top.setBorder(topBorder);
    }
    top.setLayout(new BorderLayout());
    /* Fill the body. */
    Container body = new JPanel(new GridBagLayout());
    Container realBody = new JPanel(new BorderLayout());
    body.setName("OptionPane.body");
    realBody.setName("OptionPane.realBody");
    if (getIcon() != null) {
        JPanel sep = new JPanel();
        sep.setName("OptionPane.separator");
        sep.setPreferredSize(new Dimension(15, 1));
        realBody.add(sep, BorderLayout.BEFORE_LINE_BEGINS);
    }
    realBody.add(body, BorderLayout.CENTER);
    GridBagConstraints cons = new GridBagConstraints();
    cons.gridx = cons.gridy = 0;
    cons.gridwidth = GridBagConstraints.REMAINDER;
    cons.gridheight = 1;
    cons.anchor = DefaultLookup.getInt(optionPane, this, "OptionPane.messageAnchor", GridBagConstraints.CENTER);
    cons.insets = new Insets(0, 0, 3, 0);
    addMessageComponents(body, cons, getMessage(), getMaxCharactersPerLineCount(), false);
    top.add(realBody, BorderLayout.CENTER);
    addIcon(top);
    return top;
}
Also used : Border(javax.swing.border.Border) EmptyBorder(javax.swing.border.EmptyBorder)

Example 68 with Border

use of javax.swing.border.Border in project jdk8u_jdk by JetBrains.

the class BasicSplitPaneUI method installDefaults.

/**
     * Installs the UI defaults.
     */
protected void installDefaults() {
    LookAndFeel.installBorder(splitPane, "SplitPane.border");
    LookAndFeel.installColors(splitPane, "SplitPane.background", "SplitPane.foreground");
    LookAndFeel.installProperty(splitPane, "opaque", Boolean.TRUE);
    if (divider == null)
        divider = createDefaultDivider();
    divider.setBasicSplitPaneUI(this);
    Border b = divider.getBorder();
    if (b == null || !(b instanceof UIResource)) {
        divider.setBorder(UIManager.getBorder("SplitPaneDivider.border"));
    }
    dividerDraggingColor = UIManager.getColor("SplitPaneDivider.draggingColor");
    setOrientation(splitPane.getOrientation());
    // note: don't rename this temp variable to dividerSize
    // since it will conflict with "this.dividerSize" field
    Integer temp = (Integer) UIManager.get("SplitPane.dividerSize");
    LookAndFeel.installProperty(splitPane, "dividerSize", temp == null ? 10 : temp);
    divider.setDividerSize(splitPane.getDividerSize());
    dividerSize = divider.getDividerSize();
    splitPane.add(divider, JSplitPane.DIVIDER);
    setContinuousLayout(splitPane.isContinuousLayout());
    resetLayoutManager();
    /* Install the nonContinuousLayoutDivider here to avoid having to
        add/remove everything later. */
    if (nonContinuousLayoutDivider == null) {
        setNonContinuousLayoutDivider(createDefaultNonContinuousLayoutDivider(), true);
    } else {
        setNonContinuousLayoutDivider(nonContinuousLayoutDivider, true);
    }
    // focus forward traversal key
    if (managingFocusForwardTraversalKeys == null) {
        managingFocusForwardTraversalKeys = new HashSet<KeyStroke>();
        managingFocusForwardTraversalKeys.add(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0));
    }
    splitPane.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, managingFocusForwardTraversalKeys);
    // focus backward traversal key
    if (managingFocusBackwardTraversalKeys == null) {
        managingFocusBackwardTraversalKeys = new HashSet<KeyStroke>();
        managingFocusBackwardTraversalKeys.add(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_MASK));
    }
    splitPane.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, managingFocusBackwardTraversalKeys);
}
Also used : Border(javax.swing.border.Border) UIResource(javax.swing.plaf.UIResource)

Example 69 with Border

use of javax.swing.border.Border in project jdk8u_jdk by JetBrains.

the class BasicSplitPaneDivider method paint.

/**
     * Paints the divider.
     */
public void paint(Graphics g) {
    super.paint(g);
    // Paint the border.
    Border border = getBorder();
    if (border != null) {
        Dimension size = getSize();
        border.paintBorder(this, g, 0, 0, size.width, size.height);
    }
}
Also used : Border(javax.swing.border.Border)

Example 70 with Border

use of javax.swing.border.Border in project jdk8u_jdk by JetBrains.

the class SynthStyle method installDefaults.

void installDefaults(SynthContext context, SynthUI ui) {
    // can have more control over this.
    if (!context.isSubregion()) {
        JComponent c = context.getComponent();
        Border border = c.getBorder();
        if (border == null || border instanceof UIResource) {
            c.setBorder(new SynthBorder(ui, getInsets(context, null)));
        }
    }
    installDefaults(context);
}
Also used : Border(javax.swing.border.Border) UIResource(javax.swing.plaf.UIResource)

Aggregations

Border (javax.swing.border.Border)218 JPanel (javax.swing.JPanel)66 JLabel (javax.swing.JLabel)55 EmptyBorder (javax.swing.border.EmptyBorder)46 Insets (java.awt.Insets)43 Dimension (java.awt.Dimension)41 JScrollPane (javax.swing.JScrollPane)38 BorderLayout (java.awt.BorderLayout)36 GridBagConstraints (java.awt.GridBagConstraints)35 JButton (javax.swing.JButton)33 GridBagLayout (java.awt.GridBagLayout)32 TitledBorder (javax.swing.border.TitledBorder)32 BoxLayout (javax.swing.BoxLayout)29 ActionEvent (java.awt.event.ActionEvent)28 FlowLayout (java.awt.FlowLayout)24 CompoundBorder (javax.swing.border.CompoundBorder)24 ActionListener (java.awt.event.ActionListener)23 JTextField (javax.swing.JTextField)23 JTable (javax.swing.JTable)20 EtchedBorder (javax.swing.border.EtchedBorder)20