Search in sources :

Example 6 with AbstractBorder

use of javax.swing.border.AbstractBorder in project java-swing-tips by aterai.

the class TitledBorderUtil method getBorderInsets.

// private static Insets getBorderInsets(Border bdr, Component c, Insets insets) {
public static Insets getBorderInsets(Border bdr, Component c) {
    Insets insets = new Insets(0, 0, 0, 0);
    if (bdr instanceof AbstractBorder) {
        AbstractBorder ab = (AbstractBorder) bdr;
        insets = ab.getBorderInsets(c, insets);
    } else if (Objects.nonNull(bdr)) {
        Insets i = bdr.getBorderInsets(c);
        insets.set(i.top, i.left, i.bottom, i.right);
    }
    return insets;
}
Also used : AbstractBorder(javax.swing.border.AbstractBorder)

Aggregations

AbstractBorder (javax.swing.border.AbstractBorder)6 Component (java.awt.Component)3 Graphics (java.awt.Graphics)3 BasicStroke (java.awt.BasicStroke)2 Color (java.awt.Color)2 Graphics2D (java.awt.Graphics2D)2 Border (javax.swing.border.Border)2 EditorEx (com.intellij.openapi.editor.ex.EditorEx)1 SwingAppender (com.jsql.view.swing.console.SwingAppender)1 CheckBoxIcon (com.jsql.view.swing.ui.CheckBoxIcon)1 CustomBasicComboBoxUI (com.jsql.view.swing.ui.CustomBasicComboBoxUI)1 Font (java.awt.Font)1 FontFormatException (java.awt.FontFormatException)1 GraphicsEnvironment (java.awt.GraphicsEnvironment)1 Insets (java.awt.Insets)1 BufferedInputStream (java.io.BufferedInputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 ImageIcon (javax.swing.ImageIcon)1 JLabel (javax.swing.JLabel)1