[skinlf-dev] Bug correction
<[email protected]> Fri, 22 Dec 2006 12:37:11 +0100 (CET)
| Newsgroups | gmane.comp.java.skinlf.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello!
I recently used skinlf to provide a better look to my
app.
Unfortunately i got troubles with the menu items.
so i corrected some little things.
it's working but not for everything, especially with
transparent skins like whistler.
Here is the code fragment:
GtkPersonality.java
...
/**
* Description of the Method
*
* @param g Description of Parameter
* @param c Description of Parameter
* @return Description of the Returned Value
*/
public boolean paintMenuItem(java.awt.Graphics g,
javax.swing.JMenuItem c) {
if (menuitemSelected != null) {
// FIXME: bug correction or skin
if (c.isArmed() || (c instanceof JMenu &&
c.getModel().isSelected())) {
if(c.isOpaque()) {
paintOpaqueMenuItem( g, c );
} else {
menuitemSelected.paint(g, c);
}
} else
if( c.isOpaque() ) {
paintOpaqueMenuItem( g, c );
}
else {
return false;
}
/*
* else {
* paintDialog(g, c);
* }
*/
return true;
}
else {
return false;
}
}
/**
* paints an opaque menu item
* @param g the graphic where to paint
* @param c the menu item to paint
*/
private void paintOpaqueMenuItem( java.awt.Graphics
g, javax.swing.JMenuItem c ) {
if( background != null ) {
ImageUtils.paint(c, g, background,
backgroundPaintMode);
} else {
Rectangle rect = c.getVisibleRect();
Color old = g.getColor();
g.setColor( c.getBackground() );
// for the whistler theme pack
Composite oldComposite = ((Graphics2D)
g).getComposite();
((Graphics2D)
g).setComposite(AlphaComposite.SrcOver);
g.fillRect( rect.x, rect.y, rect.width,
rect.height );
g.setColor( old );
((Graphics2D) g).setComposite(oldComposite);
}
}
...
I would like to get your comments about this stuff.
And if it's working, maybe you can include it in a
next release :)
Oh by the way, i post you from a tricky address,
please follow-up to fredREMOVEisfree AT users .
sourceforge .net
Happy Christmas!
___________________________________________________________________________
Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire.
http://fr.mail.yahoo.com