|
From: <de...@us...> - 2013-09-04 11:47:43
|
Revision: 8486
http://sourceforge.net/p/fudaa/svn/8486
Author: deniger
Date: 2013-09-04 11:47:40 +0000 (Wed, 04 Sep 2013)
Log Message:
-----------
maj bug
Modified Paths:
--------------
trunk/framework/ctulu-bu/src/main/java/com/memoire/bu/BuButton.java
Modified: trunk/framework/ctulu-bu/src/main/java/com/memoire/bu/BuButton.java
===================================================================
--- trunk/framework/ctulu-bu/src/main/java/com/memoire/bu/BuButton.java 2013-09-04 11:06:55 UTC (rev 8485)
+++ trunk/framework/ctulu-bu/src/main/java/com/memoire/bu/BuButton.java 2013-09-04 11:47:40 UTC (rev 8486)
@@ -1,14 +1,13 @@
/**
* @modification $Date: 2006-09-19 14:35:10 $
- * @statut unstable
- * @file BuButton.java
- * @version 0.43
- * @author Guillaume Desnoix
- * @email gui...@de...
- * @license GNU General Public License 2 (GPL2)
- * @copyright 1998-2005 Guillaume Desnoix
+ * @statut unstable
+ * @file BuButton.java
+ * @version 0.43
+ * @author Guillaume Desnoix
+ * @email gui...@de...
+ * @license GNU General Public License 2 (GPL2)
+ * @copyright 1998-2005 Guillaume Desnoix
*/
-
package com.memoire.bu;
import java.awt.Color;
@@ -31,25 +30,21 @@
* Like JButton but with better management of icons.
*/
public class BuButton
- extends JButton
-{
- public BuButton()
- {
- this((BuIcon)null,null);
+ extends JButton {
+
+ public BuButton() {
+ this((BuIcon) null, null);
}
- public BuButton(BuIcon _icon)
- {
- this(_icon,null);
+ public BuButton(BuIcon _icon) {
+ this(_icon, null);
}
- public BuButton(String _label)
- {
- this(null,_label);
+ public BuButton(String _label) {
+ this(null, _label);
}
- public BuButton(BuIcon _icon, String _label)
- {
+ public BuButton(BuIcon _icon, String _label) {
super();
setActionCommand("BUTTON_PRESSED");
@@ -59,21 +54,18 @@
setHorizontalAlignment(LEFT);
}
- public BuButton(Icon _icon)
- {
- this(null,_icon);
+ public BuButton(Icon _icon) {
+ this(null, _icon);
}
/*
- public BuButton(Action _action)
- {
- super(_action);
- setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
- }
- */
-
- public BuButton(String _text,Icon _icon)
- {
+ public BuButton(Action _action)
+ {
+ super(_action);
+ setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
+ }
+ */
+ public BuButton(String _text, Icon _icon) {
super();
setActionCommand("BUTTON_PRESSED");
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
@@ -82,110 +74,112 @@
}
// Anti-aliasing
-
- public void paint(Graphics _g)
- {
- BuLib.setAntialiasing(this,_g);
+ public void paint(Graphics _g) {
+ BuLib.setAntialiasing(this, _g);
super.paint(_g);
}
- public boolean isOpaque()
- {
- boolean r=super.isOpaque();
+ public boolean isOpaque() {
+ boolean r = super.isOpaque();
- Container parent=getParent();
+ Container parent = getParent();
- if(parent instanceof JComponent)
- {
- Object p=((JComponent)parent)
- .getClientProperty("JToolBar.isRollover");
- if(Boolean.TRUE.equals(p))
- r&=isEnabled()&&model.isRollover();
+ if (parent instanceof JComponent) {
+ Object p = ((JComponent) parent)
+ .getClientProperty("JToolBar.isRollover");
+ if (Boolean.TRUE.equals(p)) {
+ r &= isEnabled() && model.isRollover();
+ }
}
return r;
}
- public int getHorizontalAlignment()
- {
- int r=super.getHorizontalAlignment();
- if((r==CENTER)&&(getText()!=null))
- r=LEFT;
+ public int getHorizontalAlignment() {
+ int r = super.getHorizontalAlignment();
+ if ((r == CENTER) && (getText() != null)) {
+ r = LEFT;
+ }
return r;
}
- public void setText(String _text)
- {
- String text=_text;
- if("".equals(text)) text=null;
+ public void setText(String _text) {
+ String text = _text;
+ if ("".equals(text)) {
+ text = null;
+ }
super.setText(text);
- if(!BuPreferences.BU.getBooleanProperty("button.text",true)&&
- (getToolTipText()==null))
+ if (!BuPreferences.BU.getBooleanProperty("button.text", true)
+ && (getToolTipText() == null)) {
super.setToolTipText(text);
+ }
}
- public String getText()
- {
- if(BuPreferences.BU.getBooleanProperty("button.text",true)||
- (super.getIcon()==null)||
- !BuPreferences.BU.getBooleanProperty("button.icon",true))
+ @Override
+ public void setDisplayedMnemonicIndex(int index) throws IllegalArgumentException {
+ if (BuPreferences.BU.getBooleanProperty("button.text", true)) {
+ super.setDisplayedMnemonicIndex(index);
+ }
+ }
+
+ public String getText() {
+ if (BuPreferences.BU.getBooleanProperty("button.text", true)
+ || (super.getIcon() == null)
+ || !BuPreferences.BU.getBooleanProperty("button.icon", true)) {
return super.getText();
+ }
return null;
}
- public void setIcon(BuIcon _icon)
- {
- BuLib.setIcon(this,_icon);
+ public void setIcon(BuIcon _icon) {
+ BuLib.setIcon(this, _icon);
}
- public Icon getIcon()
- {
- if(BuPreferences.BU.getBooleanProperty("button.icon",true)||
- (super.getText()==null)||
- !BuPreferences.BU.getBooleanProperty("button.text",true))
+ public Icon getIcon() {
+ if (BuPreferences.BU.getBooleanProperty("button.icon", true)
+ || (super.getText() == null)
+ || !BuPreferences.BU.getBooleanProperty("button.text", true)) {
return super.getIcon();
+ }
return null;
}
- public Point getToolTipLocation(MouseEvent _evt)
- {
- Point r=super.getToolTipLocation(_evt);
- if(r==null) r=new Point(0,getHeight()+1);
+ public Point getToolTipLocation(MouseEvent _evt) {
+ Point r = super.getToolTipLocation(_evt);
+ if (r == null) {
+ r = new Point(0, getHeight() + 1);
+ }
return r;
}
+ private static final Insets REF = new Insets(2, 14, 2, 14);
+ private static final InsetsUIResource ALT = new InsetsUIResource(0, 8, 0, 8);
- private static final Insets REF=new Insets(2,14,2,14);
- private static final InsetsUIResource ALT=new InsetsUIResource(0,8,0,8);
-
- public void updateUI()
- {
+ public void updateUI() {
super.updateUI();
setRolloverEnabled(true);
- if(BuLib.isOcean())
- {
- Insets i=getMargin();
- if((i instanceof UIResource)&&REF.equals(i))
+ if (BuLib.isOcean()) {
+ Insets i = getMargin();
+ if ((i instanceof UIResource) && REF.equals(i)) {
setMargin(ALT);
+ }
}
}
- public Color getBackground()
- {
+ public Color getBackground() {
Color r;
- if(isEnabled()&&model.isRollover()&&BuLib.isMetal())
- r=new ColorUIResource(192,192,208);
- else
- r=super.getBackground();
+ if (isEnabled() && model.isRollover() && BuLib.isMetal()) {
+ r = new ColorUIResource(192, 192, 208);
+ } else {
+ r = super.getBackground();
+ }
return r;
}
// Focus
-
- protected void processFocusEvent(FocusEvent _evt)
- {
- BuLib.focusScroll(this,_evt);
+ protected void processFocusEvent(FocusEvent _evt) {
+ BuLib.focusScroll(this, _evt);
super.processFocusEvent(_evt);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|