From a682ce98c560efffb0e29da8aedc78d62bf9dab9 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sat, 9 Dec 2006 18:09:02 +0000 Subject: [PATCH] integrate kisitomomo patch [ 1612136 ] checkbox look and feel improved https://sourceforge.net/tracker/index.php?func=detail&aid=1612136&group_id=176962&atid=879334 --- .../org/compiere/plaf/CompiereCheckBoxUI.java | 45 ++++++++++++++++++- looks/src/org/compiere/swing/CCheckBox.java | 18 ++++++-- 2 files changed, 59 insertions(+), 4 deletions(-) diff --git a/looks/src/org/compiere/plaf/CompiereCheckBoxUI.java b/looks/src/org/compiere/plaf/CompiereCheckBoxUI.java index e155355995..3d091e7a5c 100644 --- a/looks/src/org/compiere/plaf/CompiereCheckBoxUI.java +++ b/looks/src/org/compiere/plaf/CompiereCheckBoxUI.java @@ -1,5 +1,5 @@ /****************************************************************************** - * Product: Adempiere ERP & CRM Smart Business Solution * + * Product: Adempiere ERP & CRM Smart Business Solution * * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it * * under the terms version 2 of the GNU General Public License as published * @@ -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 + + diff --git a/looks/src/org/compiere/swing/CCheckBox.java b/looks/src/org/compiere/swing/CCheckBox.java index 24646bac32..7bfc55704e 100644 --- a/looks/src/org/compiere/swing/CCheckBox.java +++ b/looks/src/org/compiere/swing/CCheckBox.java @@ -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 + +