ch.randelshofer.quaqua.QuaquaMenuBarUI Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Quaqua Show documentation
Show all versions of Quaqua Show documentation
A Mavenisation of the Quaqua Mac OSX Swing Look and Feel (Java library)
Quaqua Look and Feel (C) 2003-2010, Werner Randelshofer.
Mavenisation by Matt Gumbley, DevZendo.org - for problems with
Mavenisation, see Matt; for issues with Quaqua, see the Quaqua home page.
For full license details, see http://randelshofer.ch/quaqua/license.html
The newest version!
/*
* @(#)QuaquaMenuBarUI.java
*
* Copyright (c) 2004-2010 Werner Randelshofer, Immensee, Switzerland.
* All rights reserved.
*
* You may not use, copy or modify this file, except in compliance with the
* license agreement you entered into with Werner Randelshofer.
* For details see accompanying license terms.
*/
package ch.randelshofer.quaqua;
import ch.randelshofer.quaqua.border.BackgroundBorder;
import ch.randelshofer.quaqua.color.PaintableColor;
import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.plaf.*;
import javax.swing.plaf.basic.*;
/**
* QuaquaMenuBarUI.
*
* @author Werner Randelshofer
* @version $Id: QuaquaMenuBarUI.java 361 2010-11-21 11:19:20Z wrandelshofer $
*/
public class QuaquaMenuBarUI extends BasicMenuBarUI {
/** Creates a new instance. */
public QuaquaMenuBarUI() {
}
public static ComponentUI createUI(JComponent x) {
return new QuaquaMenuBarUI();
}
@Override
public void paint(Graphics gr, JComponent c) {
Graphics2D g = (Graphics2D) gr;
int w = c.getWidth();
int h = c.getHeight();
g.setPaint(PaintableColor.getPaint(c.getBackground(), c));
g.fillRect(0, 0, w, h);
if (c.getBorder() instanceof BackgroundBorder) {
Border bb = ((BackgroundBorder) c.getBorder()).getBackgroundBorder();
bb.paintBorder(c, gr, 0, 0, w, h);
}
Color shadow = UIManager.getColor("MenuBar.shadow");
if (shadow != null) {
g.setColor(shadow);
g.fillRect(0, h - 1, w, 1);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy