Java Code Examples for javax.swing.UIManager#getBorder()

The following examples show how to use javax.swing.UIManager#getBorder() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PanelTableHeaderRenderer.java    From chipster with MIT License 6 votes vote down vote up
public PanelTableHeaderRenderer(ImportScreen screen, int i) {
	this.screen = screen;
	columnIndex = i;
	
	chipCombo = new JComboBox();
	titleLabel = new JLabel("Title");
	typeLabel = new JLabel("Type");
	
	chipCombo.addItemListener(this);
	//titleLabel.setForeground(UIManager.getColor("Label.disabledForeground"));
	
	
	this.setLayout(new BorderLayout());	
	
	Border border = UIManager.getBorder("TableHeader.cellBorder");
	border.getBorderInsets(this).set(5,5,5,5);
	setBorder(border);
			
	setBackground(UIManager.getColor("TableHeader.background"));

	add(titleLabel,BorderLayout.NORTH);
	add(typeLabel,BorderLayout.WEST);
	add(chipCombo,BorderLayout.EAST);
}
 
Example 2
Source File: CheckBoxRenderrer.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private Border getNoFocusBorder () {
    Border border = UIManager.getBorder("List.cellNoFocusBorder");
    if (System.getSecurityManager () != null) {
        if (border != null) {
            return border;
        }
        return SAFE_NO_FOCUS_BORDER;
    } else {
        if (border != null &&
            (noFocusBorder == null ||
            noFocusBorder == DEFAULT_NO_FOCUS_BORDER)) {
            return border;
        }
        return noFocusBorder;
    }
}
 
Example 3
Source File: AutoHideStatusText.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private AutoHideStatusText( JFrame frame, JPanel statusContainer  ) {
    this.statusContainer = statusContainer;
    Border outerBorder = UIManager.getBorder( "Nb.ScrollPane.border" ); //NOI18N
    if( null == outerBorder ) {
        outerBorder = BorderFactory.createEtchedBorder();
    }
    panel.setBorder( BorderFactory.createCompoundBorder( outerBorder, 
            BorderFactory.createEmptyBorder(3,3,3,3) ) );
    lblStatus.setName("AutoHideStatusTextLabel"); //NOI18N
    panel.add( lblStatus, BorderLayout.CENTER );
    frame.getLayeredPane().add( panel, Integer.valueOf( 101 ) );
    StatusDisplayer.getDefault().addChangeListener( this );

    frame.addComponentListener( new ComponentAdapter() {
        @Override
        public void componentResized( ComponentEvent e ) {
            run();
        }
    });
}
 
Example 4
Source File: DefaultsDisplay.java    From littleluck with Apache License 2.0 6 votes vote down vote up
protected void setBorder(JComponent renderer, boolean hasFocus, boolean isSelected) {

    if (hasFocus) {
        Border border = null;
        if (isSelected) {
            border = UIManager.getBorder("Table.focusSelectedCellHighlightBorder");
        }
        if (border == null) {
            border = UIManager.getBorder("Table.focusCellHighlightBorder");
        }
        renderer.setBorder(border);
                        
    } else {
        renderer.setBorder(noFocusBorder);
    }
}
 
Example 5
Source File: PToolTipUI.java    From PolyGlot with MIT License 5 votes vote down vote up
/**
 * Invoked when the <code>JComponent</code> associated with the
 * <code>JToolTip</code> has changed, or at initialization time. This
 * should update any state dependant upon the <code>JComponent</code>.
 *
 * @param c the JToolTip the JComponent has changed on.
 */
private void componentChanged(JComponent c) {
    JComponent comp = ((JToolTip)c).getComponent();

    if (comp != null && !(comp.isEnabled())) {
        // For better backward compatibility, only install inactive
        // properties if they are defined.
        if (UIManager.getBorder("ToolTip.borderInactive") != null) {
            LookAndFeel.installBorder(c, "ToolTip.borderInactive");
        }
        else {
            LookAndFeel.installBorder(c, "ToolTip.border");
        }
        if (UIManager.getColor("ToolTip.backgroundInactive") != null) {
            LookAndFeel.installColors(c,"ToolTip.backgroundInactive",
                                      "ToolTip.foregroundInactive");
        }
        else {
            LookAndFeel.installColors(c,"ToolTip.background",
                                      "ToolTip.foreground");
        }
    } else {
        LookAndFeel.installBorder(c, "ToolTip.border");
        LookAndFeel.installColors(c, "ToolTip.background",
                                  "ToolTip.foreground");
    }
}
 
Example 6
Source File: Test6963870.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
void test(String uiName) {
    Border b = UIManager.getBorder(uiName);
    Insets i = b.getBorderInsets(null);
    if (i == null) {
        throw new RuntimeException("getBorderInsets() returns null for " + uiName);
    }
}
 
Example 7
Source File: QuickSearchComboBar.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Get customizable border for QuickSearch. See bug 246907.
 *
 * @return Custom border if defined in {@link UIManager} or default line
 * border.
 */
private Border getQuickSearchBorder() {
    Border border = UIManager.getBorder("nb.quicksearch.border"); //NOI18N
    return border != null
            ? border
            : BorderFactory.createLineBorder(getComboBorderColor());
}
 
Example 8
Source File: DependencyGraphTopComponent.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public EditorToolbar() {
    Border b = UIManager.getBorder("Nb.Editor.Toolbar.border"); //NOI18N
    setBorder(b);
    if( "Aqua".equals(UIManager.getLookAndFeel().getID()) ) { //NOI18N
        setBackground(UIManager.getColor("NbExplorerView.background")); //NOI18N
    }
}
 
Example 9
Source File: Test6963870.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
void test(String uiName) {
    Border b = UIManager.getBorder(uiName);
    Insets i = b.getBorderInsets(null);
    if (i == null) {
        throw new RuntimeException("getBorderInsets() returns null for " + uiName);
    }
}
 
Example 10
Source File: CheckListBoxCellRenderer.java    From nextreports-designer with Apache License 2.0 5 votes vote down vote up
/**
 * Safe getter for active border.
 */
Border getActiveBorder() {
    if (activeBorder == null) {
        activeBorder = UIManager.getBorder("List.focusCellHighlightBorder");
    }

    return activeBorder;
}
 
Example 11
Source File: CssStylesPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private Border getButtonBorder() {
    if (buttonBorder == null) {
        //For some lf's, core will supply one
        buttonBorder = UIManager.getBorder("nb.tabbutton.border"); //NOI18N
    }

    return buttonBorder;
}
 
Example 12
Source File: Test6963870.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
void test(String uiName) {
    Border b = UIManager.getBorder(uiName);
    Insets i = b.getBorderInsets(null);
    if (i == null) {
        throw new RuntimeException("getBorderInsets() returns null for " + uiName);
    }
}
 
Example 13
Source File: ManageTags.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Component getListCellRendererComponent (JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
    if (value instanceof GitTag) {
        GitTag tag = (GitTag) value;
        renderer.setText(tag.getTagName());
        renderer.setFont(list.getFont());
        renderer.setOpaque(true);
        renderer.setBackground(isSelected ? list.getSelectionBackground() : list.getBackground());
        renderer.setForeground(isSelected ? list.getSelectionForeground() : list.getForeground());
        renderer.setEnabled(list.isEnabled());
        Border border = null;
        if (cellHasFocus) {
            if (isSelected) {
                border = UIManager.getBorder("List.focusSelectedCellHighlightBorder");
            }
            if (border == null) {
                border = UIManager.getBorder("List.focusCellHighlightBorder");
            }
        } else {
            border = new EmptyBorder(1, 1, 1, 1);
        }
        renderer.setBorder(border);
        return renderer;
    } else {
        return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
    }
}
 
Example 14
Source File: HyperlinkCellRenderer.java    From littleluck with Apache License 2.0 5 votes vote down vote up
protected void applyDefaults() {
    setOpaque(true);
    setBorderPainted(false);
    foreground = UIManager.getColor("Hyperlink.foreground");
    visitedForeground = UIManager.getColor("Hyperlink.visitedForeground");

    // Make sure border used on non-focussed cells is same size as focussed border
    focusBorder = UIManager.getBorder("Table.focusCellHighlightBorder");
    if (focusBorder != null) {
        Insets insets = focusBorder.getBorderInsets(this);
        noFocusBorder = new EmptyBorder(insets.top, insets.left, insets.bottom, insets.right);
    } else {
        focusBorder = noFocusBorder = new EmptyBorder(1, 1, 1, 1);
    }
}
 
Example 15
Source File: TitledBorder.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns the border of the titled border.
 *
 * @return the border of the titled border
 */
public Border getBorder() {
    return border != null
            ? border
            : UIManager.getBorder("TitledBorder.border");
}
 
Example 16
Source File: TitledBorder.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns the border of the titled border.
 *
 * @return the border of the titled border
 */
public Border getBorder() {
    return border != null
            ? border
            : UIManager.getBorder("TitledBorder.border");
}
 
Example 17
Source File: WindowsOutlookBarUI.java    From orbit-image-analysis with GNU General Public License v3.0 4 votes vote down vote up
protected void installDefaults() {
  super.installDefaults();
  tabButtonBorder = UIManager.getBorder("OutlookBar.tabButtonBorder");
}
 
Example 18
Source File: TitledBorder.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns the border of the titled border.
 *
 * @return the border of the titled border
 */
public Border getBorder() {
    return border != null
            ? border
            : UIManager.getBorder("TitledBorder.border");
}
 
Example 19
Source File: WindowsOutlookBarUI.java    From CodenameOne with GNU General Public License v2.0 4 votes vote down vote up
protected void installDefaults() {
  super.installDefaults();
  tabButtonBorder = UIManager.getBorder("OutlookBar.tabButtonBorder");
}
 
Example 20
Source File: TitledBorder.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * Returns the border of the titled border.
 *
 * @return the border of the titled border
 */
public Border getBorder() {
    return border != null
            ? border
            : UIManager.getBorder("TitledBorder.border");
}