Search in sources :

Example 41 with EmptyBorder

use of javax.swing.border.EmptyBorder in project nhin-d by DirectProject.

the class EditorPanel method initUI.

protected void initUI() {
    setLayout(new BorderLayout());
    setBorder(new CompoundBorder(new SoftBevelBorder(BevelBorder.LOWERED), new EmptyBorder(5, 5, 5, 5)));
    policyText = new JTextArea();
    policyText.setLineWrap(true);
    policyText.setWrapStyleWord(true);
    policyText.setEditable(true);
    final JScrollPane scrollPane = new JScrollPane(policyText);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    scrollPane.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
    fileNameLabel = new JLabel("*New File*");
    final JPanel reportPanel = new JPanel(new BorderLayout());
    reportPanel.add(fileNameLabel, BorderLayout.NORTH);
    reportPanel.add(scrollPane, BorderLayout.CENTER);
    //this.add(reportPanel, BorderLayout.CENTER);
    validatePanel = new ValidatePanel();
    validatePanel.setFeedMode(PolicyLexicon.SIMPLE_TEXT_V1, policyText.getDocument());
    final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, reportPanel, validatePanel);
    splitPane.setDividerLocation(400);
    this.add(splitPane, BorderLayout.CENTER);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) JTextArea(javax.swing.JTextArea) ValidatePanel(org.nhindirect.policy.tools.policyvalidate.ValidatePanel) BorderLayout(java.awt.BorderLayout) SoftBevelBorder(javax.swing.border.SoftBevelBorder) JLabel(javax.swing.JLabel) CompoundBorder(javax.swing.border.CompoundBorder) EmptyBorder(javax.swing.border.EmptyBorder) JSplitPane(javax.swing.JSplitPane)

Example 42 with EmptyBorder

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

the class Test7022041 method checkTitleFont.

/**
      * Check behaviour of method TitledBorder.getTitleFont()
      */
private static void checkTitleFont() {
    TitledBorder titledBorder = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
    Font defaultFont = UIManager.getLookAndFeelDefaults().getFont("TitledBorder.font");
    Font titledBorderFont = titledBorder.getTitleFont();
    // check default configuration
    if (defaultFont == null) {
        if (titledBorderFont == null) {
            return;
        } else {
            throw new RuntimeException("TitledBorder default font should be null");
        }
    }
    if (!defaultFont.equals(titledBorderFont)) {
        throw new RuntimeException("L&F default font " + defaultFont.toString() + " differs from TitledBorder font " + titledBorderFont.toString());
    }
    // title font is explicitly specified
    Font font = new Font("Dialog", Font.PLAIN, 10);
    titledBorder.setTitleFont(font);
    if (!font.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("TitledBorder font should be " + font.toString());
    }
    // title Font is unspecified
    titledBorder.setTitleFont(null);
    if (!defaultFont.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("L&F default font " + defaultFont.toString() + " differs from TitledBorder font " + titledBorderFont.toString());
    }
}
Also used : TitledBorder(javax.swing.border.TitledBorder) EmptyBorder(javax.swing.border.EmptyBorder) Font(java.awt.Font)

Example 43 with EmptyBorder

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

the class Test7022041 method checkTitleColor.

/**
      * Check behaviour of method TitledBorder.getTitleColor()
      */
private static void checkTitleColor() {
    TitledBorder titledBorder = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
    Color defaultColor = UIManager.getLookAndFeelDefaults().getColor("TitledBorder.titleColor");
    Color titledBorderColor = titledBorder.getTitleColor();
    // check default configuration
    if (defaultColor == null) {
        if (titledBorderColor == null) {
            return;
        } else {
            throw new RuntimeException("TitledBorder default color should be null");
        }
    }
    if (!defaultColor.equals(titledBorderColor)) {
        throw new RuntimeException("L&F default color " + defaultColor.toString() + " differs from TitledBorder color " + titledBorderColor.toString());
    }
    // title color is explicitly specified
    Color color = Color.green;
    titledBorder.setTitleColor(color);
    if (!color.equals(titledBorder.getTitleColor())) {
        throw new RuntimeException("TitledBorder color should be " + color.toString());
    }
    // title color is unspecified
    titledBorder.setTitleColor(null);
    if (!defaultColor.equals(titledBorder.getTitleColor())) {
        throw new RuntimeException("L&F default color " + defaultColor.toString() + " differs from TitledBorder color " + titledBorderColor.toString());
    }
}
Also used : Color(java.awt.Color) TitledBorder(javax.swing.border.TitledBorder) EmptyBorder(javax.swing.border.EmptyBorder)

Example 44 with EmptyBorder

use of javax.swing.border.EmptyBorder in project intellij-community by JetBrains.

the class JBTabbedPane method insertTab.

@Override
public void insertTab(String title, Icon icon, Component component, String tip, int index) {
    super.insertTab(title, icon, component, tip, index);
    //set custom label for correct work spotlighting in settings
    JLabel label = new JLabel(title);
    label.setIcon(icon);
    label.setBorder(new EmptyBorder(1, 1, 1, 1));
    setTabComponentAt(index, label);
    updateSelectedTabForeground();
    label.putClientProperty(LABEL_FROM_TABBED_PANE, Boolean.TRUE);
    component.addHierarchyListener(this);
    UIUtil.setNotOpaqueRecursively(component);
    setInsets(component);
    revalidate();
    repaint();
}
Also used : EmptyBorder(javax.swing.border.EmptyBorder)

Example 45 with EmptyBorder

use of javax.swing.border.EmptyBorder in project intellij-community by JetBrains.

the class FormBuilder method addTooltip.

public FormBuilder addTooltip(final String text) {
    final JBLabel label = new JBLabel(text, UIUtil.ComponentStyle.SMALL, UIUtil.FontColor.BRIGHTER);
    label.setBorder(new EmptyBorder(0, 10, 0, 0));
    return addComponentToRightColumn(label, 1);
}
Also used : JBLabel(com.intellij.ui.components.JBLabel) EmptyBorder(javax.swing.border.EmptyBorder)

Aggregations

EmptyBorder (javax.swing.border.EmptyBorder)224 JPanel (javax.swing.JPanel)96 BorderLayout (java.awt.BorderLayout)87 JLabel (javax.swing.JLabel)70 JButton (javax.swing.JButton)44 JScrollPane (javax.swing.JScrollPane)44 Insets (java.awt.Insets)37 Dimension (java.awt.Dimension)35 Border (javax.swing.border.Border)30 GridBagLayout (java.awt.GridBagLayout)29 ActionEvent (java.awt.event.ActionEvent)27 ActionListener (java.awt.event.ActionListener)27 TitledBorder (javax.swing.border.TitledBorder)25 GridBagConstraints (java.awt.GridBagConstraints)24 Box (javax.swing.Box)22 JTextField (javax.swing.JTextField)21 CompoundBorder (javax.swing.border.CompoundBorder)20 BoxLayout (javax.swing.BoxLayout)17 FlowLayout (java.awt.FlowLayout)16 JCheckBox (javax.swing.JCheckBox)16