下面列出了javax.swing.LookAndFeel#installColorsAndFont ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Overridden to message super and forward the method to the tree. Since
* the tree is not actually in the component hierarchy it will never receive
* this unless we forward it in this manner.
*/
//----------//
// updateUI //
//----------//
@Override
public void updateUI ()
{
super.updateUI();
if (tree != null) {
tree.updateUI();
}
// Use the tree's default foreground and background colors in the
// table.
LookAndFeel.installColorsAndFont(this, "Tree.background", "Tree.foreground", "Tree.font");
}
protected void installDefaults() {
group.setOpaque(true);
group.setBorder(createPaneBorder());
((JComponent)group.getContentPane()).setBorder(createContentPaneBorder());
LookAndFeel.installColorsAndFont(
group,
"TaskPaneGroup.background",
"TaskPaneGroup.foreground",
"TaskPaneGroup.font");
LookAndFeel.installColorsAndFont(
(JComponent)group.getContentPane(),
"TaskPaneGroup.background",
"TaskPaneGroup.foreground",
"TaskPaneGroup.font");
}
/**
* Overridden to message super and forward the method to the tree.
* Since the tree is not actually in the component hieachy it will
* never receive this unless we forward it in this manner.
**/
@Override
public void updateUI()
{
super.updateUI();
if (tree != null)
{
tree.updateUI();
}
// Use the tree's default foreground and background
// colors in the table
LookAndFeel.installColorsAndFont(this, "Tree.background", //$NON-NLS-1$
"Tree.foreground", //$NON-NLS-1$
"Tree.font"); //$NON-NLS-1$
}
public JScrollableToolTip(final int width, final int height) {
setPreferredSize(new Dimension(width, height));
setLayout(new BorderLayout());
textPane = new JTextPane();
textPane.setEditable(false);
textPane.setContentType("text/html");
LookAndFeel.installColorsAndFont(textPane,
"ToolTip.background",
"ToolTip.foreground",
"ToolTip.font");
JScrollPane scrollpane = new JScrollPane(textPane);
scrollpane.setBorder(null);
scrollpane.getViewport().setOpaque(false);
add(scrollpane);
}
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);
}
/**
* Overridden to message super and forward the method to the tree.
* Since the tree is not actually in the component hieachy it will
* never receive this unless we forward it in this manner.
**/
@Override
public void updateUI()
{
super.updateUI();
if (tree != null)
{
tree.updateUI();
}
// Use the tree's default foreground and background
// colors in the table
LookAndFeel.installColorsAndFont(this, "Tree.background", //$NON-NLS-1$
"Tree.foreground", //$NON-NLS-1$
"Tree.font"); //$NON-NLS-1$
}
/**
* Overridden to message super and forward the method to the tree. Since
* the tree is not actually in the component hierarchy it will never receive
* this unless we forward it in this manner.
*/
//----------//
// updateUI //
//----------//
@Override
public void updateUI ()
{
super.updateUI();
if (tree != null) {
tree.updateUI();
}
// Use the tree's default foreground and background colors in the
// table.
LookAndFeel.installColorsAndFont(
this,
"Tree.background",
"Tree.foreground",
"Tree.font");
}
@Override
public void installUI(JComponent component) {
grid = (JGrid) component;
rendererPane = new CellRendererPane();
grid.add(rendererPane);
// gridHeader = (JGrid) component;
component.setOpaque(false);
LookAndFeel.installColorsAndFont(
component,
"TableHeader.background",
"TableHeader.foreground",
"TableHeader.font");
installDefaults();
installListeners();
installKeyboardActions();
}
/**
* 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"));
}
}
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);
}
protected void installDefaults(JComponent c)
{
LookAndFeel.installColorsAndFont(c, "Viewport.background",
"Viewport.foreground", "Viewport.font");
LookAndFeel.installProperty(c, "opaque", Boolean.FALSE);
}
/**
* Overridden to message super and forward the method to the tree.
* Since the tree is not actually in the component hieachy it will
* never receive this unless we forward it in this manner.
*/
public void updateUI() {
super.updateUI();
if(tree != null) {
tree.updateUI();
}
// Use the tree's default foreground and background colors in the
// table.
LookAndFeel.installColorsAndFont(this, "Tree.background",
"Tree.foreground", "Tree.font");
}
protected void installDefaults(JComponent c){
LookAndFeel.installColorsAndFont(c, "ToolTip.background",
"ToolTip.foreground",
"ToolTip.font");
LookAndFeel.installProperty(c, "opaque", Boolean.TRUE);
componentChanged(c);
}
protected void installDefaults() {
LookAndFeel.installBorder(lizziePane, "LizziePane.border");
LookAndFeel.installColorsAndFont(
lizziePane, "LizziePane.background", "LizziePane.foreground", "LizziePane.font");
}
/**
* Install the default panel background, foreground, and font.
*/
protected void installColorsAndFont(JPanel p) {
LookAndFeel.installColorsAndFont(p, "Panel.background",
"Panel.foreground", "Panel.font");
}
public void installUI(JComponent c) {
LookAndFeel.installColorsAndFont(c, "ToolTip.background", "ToolTip.foreground", "ToolTip.font");
LookAndFeel.installBorder(c, "ToolTip.border");
}