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

The following examples show how to use javax.swing.LookAndFeel#installColorsAndFont() . 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: JTreeTable.java    From audiveris with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * 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");
}
 
Example 2
Source File: BasicTaskPaneGroupUI.java    From orbit-image-analysis with GNU General Public License v3.0 6 votes vote down vote up
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");    
}
 
Example 3
Source File: JTreeTable.java    From pcgen with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * 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$
}
 
Example 4
Source File: JScrollableToolTip.java    From WorldGrower with GNU General Public License v3.0 6 votes vote down vote up
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);
}
 
Example 5
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 6
Source File: JTreeTable.java    From pcgen with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * 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$
}
 
Example 7
Source File: JTreeTable.java    From libreveris with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * 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");
}
 
Example 8
Source File: BasicGridHeaderUI.java    From nextreports-designer with Apache License 2.0 6 votes vote down vote up
@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();
	}
 
Example 9
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 10
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 11
Source File: LuckViewportUI.java    From littleluck with Apache License 2.0 5 votes vote down vote up
protected void installDefaults(JComponent c)
{
    LookAndFeel.installColorsAndFont(c, "Viewport.background",
            "Viewport.foreground", "Viewport.font");

    LookAndFeel.installProperty(c, "opaque", Boolean.FALSE);
}
 
Example 12
Source File: JTreeTable.java    From opensim-gui with Apache License 2.0 5 votes vote down vote up
/**
    * 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");
   }
 
Example 13
Source File: PToolTipUI.java    From PolyGlot with MIT License 5 votes vote down vote up
protected void installDefaults(JComponent c){
    LookAndFeel.installColorsAndFont(c, "ToolTip.background",
                                     "ToolTip.foreground",
                                     "ToolTip.font");
    LookAndFeel.installProperty(c, "opaque", Boolean.TRUE);
    componentChanged(c);
}
 
Example 14
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 15
Source File: AbstractPanelUI.java    From pumpernickel with MIT License 4 votes vote down vote up
/**
 * Install the default panel background, foreground, and font.
 */
protected void installColorsAndFont(JPanel p) {
	LookAndFeel.installColorsAndFont(p, "Panel.background",
			"Panel.foreground", "Panel.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");
}