下面列出了javax.swing.LookAndFeel#installBorder ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@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() ) );
}
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();
}
/**
* 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);
}
}
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);
}
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]);
}
}
/**
* 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"));
}
}
@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 );
}
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");
}
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);
}
@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里的实现自已加的属性
}
}
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");
}
/**
* 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");
}
}
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");
}
@Override
protected void installDefaults() {
super.installDefaults();
LookAndFeel.installBorder( this, "InternalFrameTitlePane.border" );
}
protected void installDefaults() {
LookAndFeel.installBorder(lizziePane, "LizziePane.border");
LookAndFeel.installColorsAndFont(
lizziePane, "LizziePane.background", "LizziePane.foreground", "LizziePane.font");
}
/**
* Install the default panel border.
*/
protected void installBorder(JPanel p) {
LookAndFeel.installBorder(p, "Panel.border");
}
public void installUI(JComponent c) {
LookAndFeel.installColorsAndFont(c, "ToolTip.background", "ToolTip.foreground", "ToolTip.font");
LookAndFeel.installBorder(c, "ToolTip.border");
}