Java Code Examples for javax.swing.LookAndFeel#installBorder()

The following examples show how to use javax.swing.LookAndFeel#installBorder() . 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: FlatTreeUI.java    From FlatLaf with Apache License 2.0 6 votes vote down vote up
@Override
protected void installDefaults() {
	super.installDefaults();

	LookAndFeel.installBorder( tree, "Tree.border" );

	selectionBackground = UIManager.getColor( "Tree.selectionBackground" );
	selectionForeground = UIManager.getColor( "Tree.selectionForeground" );
	selectionInactiveBackground = UIManager.getColor( "Tree.selectionInactiveBackground" );
	selectionInactiveForeground = UIManager.getColor( "Tree.selectionInactiveForeground" );
	selectionBorderColor = UIManager.getColor( "Tree.selectionBorderColor" );
	wideSelection = UIManager.getBoolean( "Tree.wideSelection" );
	showCellFocusIndicator = UIManager.getBoolean( "Tree.showCellFocusIndicator" );

	// scale
	int rowHeight = FlatUIUtils.getUIInt( "Tree.rowHeight", 16 );
	if( rowHeight > 0 )
		LookAndFeel.installProperty( tree, "rowHeight", UIScale.scale( rowHeight ) );
	setLeftChildIndent( UIScale.scale( getLeftChildIndent() ) );
	setRightChildIndent( UIScale.scale( getRightChildIndent() ) );
}
 
Example 2
Source File: MultiColumnListUI.java    From pdfxtk with Apache License 2.0 6 votes vote down vote up
/**
 * Initialize JList properties, e.g. font, foreground, and background,
 * and add the CellRendererPane.  The font, foreground, and background
 * properties are only set if their current value is either null
 * or a UIResource, other properties are set if the current
 * value is null.
 *
 * @see #uninstallDefaults
 * @see #installUI
 * @see CellRendererPane
 */
protected void installDefaults()
{
  list.setLayout(null);

  LookAndFeel.installBorder(list, "List.border");

  LookAndFeel.installColorsAndFont(list, "List.background", "List.foreground", "List.font");

  if (list.getCellRenderer() == null) {
    list.setCellRenderer((ListCellRenderer)(UIManager.get("List.cellRenderer")));
  }

  Color sbg = list.getSelectionBackground();
  if (sbg == null || sbg instanceof UIResource) {
    list.setSelectionBackground(UIManager.getColor("List.selectionBackground"));
  }

  Color sfg = list.getSelectionForeground();
  if (sfg == null || sfg instanceof UIResource) {
    list.setSelectionForeground(UIManager.getColor("List.selectionForeground"));
  }
}
 
Example 3
Source File: BasicOutlookBarUI.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
protected void installDefaults() {
  super.installDefaults();

  TabLayout layout = new TabLayout();
  tabPane.setLayout(layout);
  // ensure constraints is correct for existing components
  layout.setLayoutConstraints(tabPane);
  updateTabLayoutOrientation();

  buttonToTab = new HashMap();
  tabToButton = new HashMap();

  LookAndFeel.installBorder(tabPane, "OutlookBar.border");
  LookAndFeel.installColors(tabPane, "OutlookBar.background",
    "OutlookBar.foreground");

  tabPane.setOpaque(true);
  
  // add buttons for the current components already added in this panel
  Component[] components = tabPane.getComponents();
  for (int i = 0, c = components.length; i < c; i++) {
    tabAdded(components[i]);
  }
}
 
Example 4
Source File: SeaGlassScrollPaneUI.java    From seaglass with Apache License 2.0 6 votes vote down vote up
protected void installDefaults(JScrollPane scrollpane) {
    LookAndFeel.installBorder(scrollpane, "ScrollPane.border");
    LookAndFeel.installColorsAndFont(scrollpane, "ScrollPane.background", "ScrollPane.foreground", "ScrollPane.font");

    Border vpBorder = scrollpane.getViewportBorder();
    if ((vpBorder == null) || (vpBorder instanceof UIResource)) {
        vpBorder = UIManager.getBorder("ScrollPane.viewportBorder");
        scrollpane.setViewportBorder(vpBorder);
    }

    Object obj = UIManager.get("ScrollPane.cornerPainter");
    if (obj != null && obj instanceof SeaGlassPainter) {
        cornerPainter = (SeaGlassPainter) obj;
    }

    LookAndFeel.installProperty(scrollpane, "opaque", Boolean.TRUE);
    updateStyle(scrollpane);
}
 
Example 5
Source File: BEInternalFrameUI.java    From beautyeye with Apache License 2.0 6 votes vote down vote up
/**
	 * Sets the frame type.
	 *
	 * @param frameType the new frame type
	 */
	private void setFrameType(String frameType)
	{
		if (frameType.equals(OPTION_DIALOG))
		{
			LookAndFeel.installBorder(frame, "InternalFrame.optionDialogBorder");
//			titlePane.setPalette(false);
		}
//		else if (frameType.equals(PALETTE_FRAME))
//		{
//			LookAndFeel.installBorder(frame, "InternalFrame.paletteBorder");
////			titlePane.setPalette(true);
//		}
		else
		{
			LookAndFeel.installBorder(frame, "InternalFrame.border");
//			titlePane.setPalette(false);
		}
	}
 
Example 6
Source File: FlatRootPaneUI.java    From FlatLaf with Apache License 2.0 6 votes vote down vote up
protected void installClientDecorations() {
	boolean isJBRSupported = canUseJBRCustomDecorations && JBRCustomDecorations.isSupported();

	// install border
	if( rootPane.getWindowDecorationStyle() != JRootPane.NONE && !isJBRSupported )
		LookAndFeel.installBorder( rootPane, "RootPane.border" );
	else
		LookAndFeel.uninstallBorder( rootPane );

	// install title pane
	setTitlePane( createTitlePane() );

	// install layout
	oldLayout = rootPane.getLayout();
	rootPane.setLayout( createRootLayout() );

	// install window resizer
	if( !isJBRSupported )
		windowResizer = createWindowResizer();
}
 
Example 7
Source File: BasicOutlookButtonUI.java    From orbit-image-analysis with GNU General Public License v3.0 5 votes vote down vote up
protected void installDefaults(AbstractButton b) {
  super.installDefaults(b);

  b.setRolloverEnabled(true);
  b.setOpaque(false);
  b.setHorizontalTextPosition(JButton.CENTER);
  b.setVerticalTextPosition(JButton.BOTTOM);

  LookAndFeel.installBorder(b, "OutlookButton.border");    
}
 
Example 8
Source File: BasicTipOfTheDayUI.java    From orbit-image-analysis with GNU General Public License v3.0 5 votes vote down vote up
protected void installDefaults() {
  LookAndFeel.installColorsAndFont(tipPane, "TipOfTheDay.background",
    "TipOfTheDay.foreground", "TipOfTheDay.font");
  LookAndFeel.installBorder(tipPane, "TipOfTheDay.border");
  tipFont = UIManager.getFont("TipOfTheDay.tipFont");
  tipPane.setOpaque(true);
}
 
Example 9
Source File: BEComboBoxUI.java    From beautyeye with Apache License 2.0 5 votes vote down vote up
@Override
    public void installUI( JComponent c )
    {
    	super.installUI(c);
    	
    	//2012-08-30*******************************************************【重要说明】 START 对应BEListUI中的【重要说明】
    	//* 【重要说明】因BEListUI中为了使列表行单元高变的更高(在MyDefaultListCellRenderer.java中
    	//* 像COmboxRender一样通过增到border不起效果,它可能是BasicListUI的设计缺陷,它要么取FixedCellHeight
    	//* 固定值,要么取getPreferSize()即自动计算高度——它似乎是不计入border的,所以render设置border不起效)
    	//* 所以只能为列表单元设置因定值:list.setFixedCellHeight(30),但它将影响Combox里的行高(也会变成30高)
    	//* 所以此处要把列表UI中强制设定的30高针对Combox还原成自动计算(API中规定FixedCellHeight==-1即表示自动计算)
    	popup.getList().setFixedCellHeight(-1);
    	//**************************************************************** 【重要说明】 END
    	
    	//* 以下代码由jb2011加入
//    	comboBox.setMaximumRowCount(8);//这个最大行可以起效,但似乎它的行高指的是一个固定值而不是计算值,像本LNF里因cell本身行高就很高
    								   //即使设置了最大显示行,但是显示的并不是指定值,有待进一步研究
    	//为下拉框的弹出弹加border,这样上下空白外一点好看一些
    	// install the scrollpane border
        Container parent = popup.getList().getParent();  // should be viewport
        if (parent != null) 
        {
            parent = parent.getParent();  // should be the scrollpane
            if (parent != null && parent instanceof JScrollPane) 
                LookAndFeel.installBorder((JScrollPane)parent, "ComboBox.scrollPaneBorder");//*~ 注:这个属性是Jack Jiang仿照JTabel里的实现自已加的属性
        }
    }
 
Example 10
Source File: BasicOutlookButtonUI.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
protected void installDefaults(AbstractButton b) {
  super.installDefaults(b);

  b.setRolloverEnabled(true);
  b.setOpaque(false);
  b.setHorizontalTextPosition(JButton.CENTER);
  b.setVerticalTextPosition(JButton.BOTTOM);

  LookAndFeel.installBorder(b, "OutlookButton.border");    
}
 
Example 11
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 12
Source File: BasicMarkerBarUI.java    From microba with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
protected void installDefaults(MarkerBar bar) {
	LookAndFeel.installBorder(bar, "Slider.border");
	LookAndFeel.installColors(bar, "Slider.background", "Slider.foreground");

	// selectedmark
	selectionColor = UIManager.getColor("ComboBox.selectionBackground");
	// fixed mark
	disabledColor = UIManager.getColor("ComboBox.disabledBackground");
	normalColor = UIManager.getColor("ComboBox.background");
	// focus rect
	focusColor = UIManager.getColor("Slider.focus");
	// text & outline color
	textColor = UIManager.getColor("textText");

}
 
Example 13
Source File: FlatDatePickerUI.java    From FlatLaf with Apache License 2.0 5 votes vote down vote up
@Override
protected void installDefaults() {
	super.installDefaults();

	LookAndFeel.installColors( datePicker, "ComboBox.background", "ComboBox.foreground" );

	LookAndFeel.installBorder( datePicker, "JXDatePicker.border" );
	LookAndFeel.installProperty( datePicker, "opaque", Boolean.TRUE );

	MigLayoutVisualPadding.install( datePicker );
}
 
Example 14
Source File: AbstractPanelUI.java    From pumpernickel with MIT License 4 votes vote down vote up
/**
 * Install the default panel border.
 */
protected void installBorder(JPanel p) {
	LookAndFeel.installBorder(p, "Panel.border");
}
 
Example 15
Source File: BasicLizziePaneUI.java    From lizzie with GNU General Public License v3.0 4 votes vote down vote up
protected void installDefaults() {
  LookAndFeel.installBorder(lizziePane, "LizziePane.border");
  LookAndFeel.installColorsAndFont(
      lizziePane, "LizziePane.background", "LizziePane.foreground", "LizziePane.font");
}
 
Example 16
Source File: MultiLineToolTipUI.java    From mzmine2 with GNU General Public License v2.0 4 votes vote down vote up
public void installUI(JComponent c) {
  LookAndFeel.installColorsAndFont(c, "ToolTip.background", "ToolTip.foreground", "ToolTip.font");
  LookAndFeel.installBorder(c, "ToolTip.border");
}
 
Example 17
Source File: FlatInternalFrameTitlePane.java    From FlatLaf with Apache License 2.0 4 votes vote down vote up
@Override
protected void installDefaults() {
	super.installDefaults();

	LookAndFeel.installBorder( this, "InternalFrameTitlePane.border" );
}