本文整理汇总了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;
}
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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
}
}
示例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;
}
}
示例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;
}
示例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);
}
}
示例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);
}
}
}
示例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());
}
示例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;
}
示例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");
}
示例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);
}