integrate kisitomomo patch

[ 1612136 ] checkbox look and feel improved
https://sourceforge.net/tracker/index.php?func=detail&aid=1612136&group_id=176962&atid=879334
This commit is contained in:
Carlos Ruiz 2006-12-09 18:09:02 +00:00
parent 197331478e
commit a682ce98c5
2 changed files with 59 additions and 4 deletions

View File

@ -13,20 +13,30 @@
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
* Contributor(s): kisitomomo *
*****************************************************************************/
package org.compiere.plaf;
import javax.swing.AbstractButton;
import javax.swing.JCheckBox;
import javax.swing.JComponent;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.*;
import javax.swing.plaf.metal.MetalCheckBoxUI;
import java.awt.Color;
import java.awt.Graphics;
import org.adempiere.plaf.*;
import com.jgoodies.looks.plastic.PlasticLookAndFeel;
/**
* Check Box UI
*
* @author Jorg Janke
* @version $Id: AdempiereCheckBoxUI.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $
*
* globalqss: integrate kisitomomo patch
* [ 1612136 ] checkbox look and feel improved
* https://sourceforge.net/tracker/index.php?func=detail&aid=1612136&group_id=176962&atid=879334
*/
public class CompiereCheckBoxUI extends MetalCheckBoxUI
{
@ -37,6 +47,7 @@ public class CompiereCheckBoxUI extends MetalCheckBoxUI
*/
public static ComponentUI createUI (JComponent b)
{
return s_checkBoxUI;
} // createUI
@ -64,4 +75,36 @@ public class CompiereCheckBoxUI extends MetalCheckBoxUI
return new CompiereButtonListener(b);
} // createButtonListener
//kisito code
@Override
protected Color getDisabledTextColor() {
return AdempiereTheme.DARKEN_STOP;
}
private static void drawCheck(Graphics g, int x, int y) {
g.translate(x, y);
g.drawLine(3, 5, 3, 5);
g.fillRect(3, 6, 2, 2);
g.drawLine(4, 8, 9, 3);
g.drawLine(5, 8, 9, 4);
g.drawLine(5, 9, 9, 5);
g.translate(-x, -y);
}
public synchronized void paint(java.awt.Graphics g, JComponent c) {
super.paint(g,c);
JCheckBox chk=(JCheckBox)c;
if(!chk.isEnabled()) {
g.setColor(PlasticLookAndFeel.getControlDarkShadow());
g.drawRect(0, 3, 11, 11);
if(chk.getModel().isSelected())
{
drawCheck(g,0,4);
}
}
}
// end kisito
} // AdempiereCheckBoxUI

View File

@ -13,6 +13,7 @@
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
* Contributor(s): kisitomomo *
*****************************************************************************/
package org.compiere.swing;
@ -21,14 +22,17 @@ import java.awt.Color;
import javax.swing.Action;
import javax.swing.Icon;
import javax.swing.JCheckBox;
import org.adempiere.plaf.AdempierePLAF;
import org.compiere.plaf.*;
/**
* Adempiere CheckBox
*
* @author Jorg Janke
* @version $Id: CCheckBox.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $
*
* globalqss: integrate kisitomomo patch
* [ 1612136 ] checkbox look and feel improved
* https://sourceforge.net/tracker/index.php?func=detail&aid=1612136&group_id=176962&atid=879334
*/
public class CCheckBox extends JCheckBox implements CEditor
{
@ -39,6 +43,7 @@ public class CCheckBox extends JCheckBox implements CEditor
{
super ();
init();
setUI(new CompiereCheckBoxUI()); //kisito code
}
/**
@ -199,6 +204,7 @@ public class CCheckBox extends JCheckBox implements CEditor
* Set Background
* @param bg
*/
@Override
public void setBackground (Color bg)
{
if (bg.equals(getBackground()))
@ -293,6 +299,12 @@ public class CCheckBox extends JCheckBox implements CEditor
}
return text;
} // createMnemonic
/* @Override
public Icon getIcon() {
return null;
}
*/
} // CCheckBox