当前位置: 首页>>代码示例>>Java>>正文


Java UIManager.getBorder方法代码示例

本文整理汇总了Java中javax.swing.UIManager.getBorder方法的典型用法代码示例。如果您正苦于以下问题:Java UIManager.getBorder方法的具体用法?Java UIManager.getBorder怎么用?Java UIManager.getBorder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.UIManager的用法示例。


在下文中一共展示了UIManager.getBorder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getNoFocusBorder

import javax.swing.UIManager; //导入方法依赖的package包/类
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;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:CheckBoxRenderrer.java

示例2: installUI

import javax.swing.UIManager; //导入方法依赖的package包/类
@Override
public void installUI(JComponent c)
{
	super.installUI(c);

	mBackgroundNormal = UIManager.getColor("Button.background");
	mBackgroundPressed = UIManager.getColor("Button.backgroundPressed");
	mBackgroundActive = UIManager.getColor("Button.backgroundActive");
	mTextNormal = UIManager.getColor("Button.textNormal");
	mTextPressed = UIManager.getColor("Button.textPressed");
	mTextActive = UIManager.getColor("Button.textActive");
	mTextDisabled = UIManager.getColor("Button.textDisabled");
	mBorder = UIManager.getBorder("Button.border");

	c.addKeyListener(this);
}
 
开发者ID:equella,项目名称:Equella,代码行数:17,代码来源:FlatterButtonUI.java

示例3: configure

import javax.swing.UIManager; //导入方法依赖的package包/类
public void configure( Color foreground, Color background, boolean isSelected, boolean hasFocus, int rowHeight, int rowWidth ) {
    removeAll();
    int maxWidth = rowWidth - SelectionList.INSETS_LEFT - SelectionList.INSETS_RIGHT;
    JComponent inner = node.getComponent( foreground, background, isSelected, hasFocus, maxWidth > 0 ? maxWidth : 0);
    add( inner, BorderLayout.CENTER );

    setBackground( background );
    setForeground( foreground );

    Border border = null;
    if( hasFocus ) {
        if( isSelected ) {
            border = UIManager.getBorder( "List.focusSelectedCellHighlightBorder" ); // NOI18N
        }
        if( border == null ) {
            border = UIManager.getBorder( "List.focusCellHighlightBorder" ); // NOI18N
        }
    }
    if( null != border ) {
        border = BorderFactory.createCompoundBorder( border,
                BorderFactory.createEmptyBorder( SelectionList.INSETS_TOP, SelectionList.INSETS_LEFT,
                SelectionList.INSETS_BOTTOM, SelectionList.INSETS_RIGHT ) );
    } else {
        border = BorderFactory.createEmptyBorder( SelectionList.INSETS_TOP, SelectionList.INSETS_LEFT,
                SelectionList.INSETS_BOTTOM, SelectionList.INSETS_RIGHT );
    }

    try {
        setBorder( border );
    } catch( NullPointerException npe ) {
        //workaround for 175940
        Logger.getLogger( ListRendererPanel.class.getName() ).log( Level.INFO, "Bug #175940", npe );
    }

    RendererPanel.configureAccessibility(this, false);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:37,代码来源:ListRendererPanel.java

示例4: getToolTipBorder

import javax.swing.UIManager; //导入方法依赖的package包/类
/**
 * Returns the border used by tool tips in this look and feel.
 *
 * @return The border.
 */
public static Border getToolTipBorder() {

	Border border = UIManager.getBorder("ToolTip.border");

	if (border==null || isNimbusLookAndFeel()) {
		border = UIManager.getBorder("nimbusBorder");
		if (border==null) {
			border = BorderFactory.createLineBorder(SystemColor.controlDkShadow);
		}
	}

	return border;

}
 
开发者ID:Thecarisma,项目名称:powertext,代码行数:20,代码来源:TipUtil.java

示例5: RowHeaderRenderer

import javax.swing.UIManager; //导入方法依赖的package包/类
RowHeaderRenderer(final JTable table) {
    this.table = table;
    normalBorder = UIManager.getBorder("TableHeader.cellBorder");
    selectedBorder = BorderFactory.createRaisedBevelBorder();
    final JTableHeader header = table.getTableHeader();
    normalFont = header.getFont();
    selectedFont = normalFont.deriveFont(normalFont.getStyle() | Font.BOLD);
    setForeground(header.getForeground());
    setBackground(header.getBackground());
    setOpaque(true);
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:12,代码来源:RowHeaderRenderer.java

示例6: getTableCellRendererComponent

import javax.swing.UIManager; //导入方法依赖的package包/类
public Component getTableCellRendererComponent(final JTable table,
                                               final Object value, final boolean isSelected,
                                               final boolean hasFocus, final int row, final int column) {
    if (isSelected) {
        super.setForeground(table.getSelectionForeground());
        super.setBackground(table.getSelectionBackground());
    } else {
        super.setForeground(table.getForeground());
        super.setBackground(table.getBackground());
    }

    setFont(table.getFont());

    if (hasFocus) {
        Border border = null;
        if (isSelected) {
            border = UIManager
                    .getBorder("Table.focusSelectedCellHighlightBorder");
        }
        if (border == null) {
            border = UIManager
                    .getBorder("Table.focusCellHighlightBorder");
        }
        setBorder(border);
    } else {
        setBorder(noFocusBorder);
    }
    return this;
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:30,代码来源:SectorRowsEditor.java

示例7: EditorToolbar

import javax.swing.UIManager; //导入方法依赖的package包/类
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
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:DependencyGraphTopComponent.java

示例8: getNoFocusBorder

import javax.swing.UIManager; //导入方法依赖的package包/类
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;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:AnalyserCellRenderer.java

示例9: getListCellRendererComponent

import javax.swing.UIManager; //导入方法依赖的package包/类
@Override
    public Component getListCellRendererComponent (
        JList                   list,
        Object                  value,
        int                     index,
        boolean                 isSelected,
        boolean                 cellHasFocus
    ) {
        setComponentOrientation (list.getComponentOrientation ());

        Color bg = null;
        Color fg = null;

        JList.DropLocation dropLocation = list.getDropLocation ();
        if (dropLocation != null && !dropLocation.isInsert () && dropLocation.getIndex () == index) {

            bg = UIManager.getColor ("List.dropCellBackground");
            fg = UIManager.getColor ("List.dropCellForeground");

            isSelected = true;
        }

        String line = (String) value;
        Link link = StackLineAnalyser.analyse (line);

        if (isSelected) {
            setBackground (bg == null ? list.getSelectionBackground () : bg);
            setForeground(fg == null ? list.getSelectionForeground() : fg);
        } else {
            setBackground (list.getBackground ());
//            if (link != null)
//                setForeground (foreground);
//            else
                setForeground (list.getForeground ());
        }

        if (link != null) {
            StringBuilder sb = new StringBuilder ();
            sb.append ("<html>");
            if (isSelected)
                sb.append("<style> a.val {text-decoration: underline; color: " + toRgbText(getForeground().getRGB()) + "} </style><body>");
            sb.append (line.substring (0, link.getStartOffset ()));
            sb.append ("<a class=\"val\" href=\"\">");
            sb.append (line.substring (link.getStartOffset (), link.getEndOffset ()));
            sb.append ("</a>");
            sb.append (line.substring (link.getEndOffset ()));
            sb.append ("</body></html>");
            setText (sb.toString ());
        } else
            setText (line.trim ());

        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 = getNoFocusBorder ();
        }
        setBorder (border);

        return this;
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:69,代码来源:AnalyserCellRenderer.java

示例10: test

import javax.swing.UIManager; //导入方法依赖的package包/类
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);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:Test6963870.java

示例11: adjustToolbarPanelBorder

import javax.swing.UIManager; //导入方法依赖的package包/类
private void adjustToolbarPanelBorder() {
    if( toolbarPanel.getComponentCount() > 0 ) {
        Border b = UIManager.getBorder( "Nb.MainWindow.Toolbar.Border");
        if( null != b ) {
            toolbarPanel.setBorder( b );
            return;
        }
        //add border
        if ("Windows".equals(UIManager.getLookAndFeel().getID())) { //NOI18N
            if( isXPTheme() ) {
                if( isWindows8() ) {
                    toolbarPanel.setBorder( BorderFactory.createEmptyBorder() );
                } else {
                    //Set up custom borders for XP
                    toolbarPanel.setBorder(BorderFactory.createCompoundBorder(
                        upperBorder,
                        BorderFactory.createCompoundBorder(
                            BorderFactory.createMatteBorder(0, 0, 1, 0,
                            fetchColor("controlShadow", Color.DARK_GRAY)),
                            BorderFactory.createMatteBorder(0, 0, 1, 0, mid))
                    )); //NOI18N
                }
            } else {
                toolbarPanel.setBorder( BorderFactory.createEtchedBorder() );
            }
        } else if ("GTK".equals(UIManager.getLookAndFeel().getID())) { //NOI18N
            //No border
            toolbarPanel.setBorder(BorderFactory.createEmptyBorder());
        }
    } else {
        if ("GTK".equals(UIManager.getLookAndFeel().getID())) {
            toolbarPanel.setBorder(BorderFactory.createEmptyBorder());
        } else {
            toolbarPanel.setBorder(lowerBorder);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:38,代码来源:ToolbarConfiguration.java

示例12: getQuickSearchBorder

import javax.swing.UIManager; //导入方法依赖的package包/类
/**
 * 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());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:QuickSearchComboBar.java

示例13: getEtchedBorder

import javax.swing.UIManager; //导入方法依赖的package包/类
static synchronized Border getEtchedBorder() {
    if (etchedBorder == null) {
        etchedBorder = UIManager.getBorder( "TitledBorder.aquaVariant" );
        if (etchedBorder == null)
            etchedBorder = BorderFactory.createCompoundBorder(new EtchedBorder(), BorderFactory.createEmptyBorder(5, 5, 5, 5));
    }
    return etchedBorder;
}
 
开发者ID:adnanmitf09,项目名称:Rubus,代码行数:9,代码来源:SetupUtils.java

示例14: getBorder

import javax.swing.UIManager; //导入方法依赖的package包/类
/**
 * 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");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:TitledBorder.java

示例15: configure

import javax.swing.UIManager; //导入方法依赖的package包/类
public void configure(Color foreground, Color background, boolean isSelected, boolean hasFocus, int nestingDepth, int rowHeight, int rowWidth) {
    if (isRoot && node.isExpandable() || node.getType().equals(TreeListNode.Type.CLOSED)) {
        foreground = isSelected ? expandableRootSelectedForeground : expandableRootForeground;
        background = isSelected ? expandableRootSelectedBackground : expandableRootBackground;
    } else if (node.getType().equals(TreeListNode.Type.TITLE)) {
        foreground = isSelected ? expandableRootSelectedForeground : colorManager.getDefaultBackground();
        background = isSelected ? colorManager.getTitleSelectedBackground() : colorManager.getTitleBackground();
    }
    int maxWidth = rowWidth - depth * EMPTY_ICON.getIconWidth() - (TreeList.INSETS_LEFT + nestingDepth * rowHeight / 2) - TreeList.INSETS_RIGHT;
    if (expander == null) {
        maxWidth += EMPTY_ICON.getIconWidth();
    }
    JComponent inner = node.getComponent(foreground, background, isSelected, hasFocus, maxWidth > 0 ? maxWidth : 0);
    if (node.isExpandable() || !isRoot || node.getType().equals(TreeListNode.Type.CLOSED)) {
        inner.setBorder(INNER_BORDER);
    }
    add(inner, BorderLayout.CENTER);

    setBackground(background);
    setForeground(foreground);
    
    if (null != expander) {
        expander.setEnabled(node.isLoaded());
        expander.setIcon(node.isLoaded() ? node.isExpanded() ? getExpandedIcon() : getCollapsedIcon() : EMPTY_ICON);
        expander.setPressedIcon(expander.getIcon());
    }
    Border border = null;
    if (hasFocus) {
        if (isSelected) {
            border = UIManager.getBorder("List.focusSelectedCellHighlightBorder"); // NOI18N
        }
        if (border == null) {
            border = UIManager.getBorder("List.focusCellHighlightBorder"); // NOI18N
        }
    }
    if (null == border) {
        border = NO_FOCUS_BORDER;
    }
    border = BorderFactory.createCompoundBorder(border,
            BorderFactory.createEmptyBorder(TreeList.INSETS_TOP, TreeList.INSETS_LEFT + nestingDepth * rowHeight / 2,
            TreeList.INSETS_BOTTOM, TreeList.INSETS_RIGHT));

    try {
        setBorder(border);
    } catch (NullPointerException npe) {
        //workaround for 175940
        Logger.getLogger(RendererPanel.class.getName()).log(Level.INFO, "Bug #175940", npe);
    }

    configureAccessibility(this, true);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:52,代码来源:RendererPanel.java


注:本文中的javax.swing.UIManager.getBorder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。