[kaffe] CVS kaffe (riccardo): removed the painting of a border if label begun and ended with a space

Kaffe CVS cvs-commits at kaffe.org
Fri May 5 07:49:38 PDT 2006


PatchSet 7282 
Date: 2006/05/05 14:40:41
Author: riccardo
Branch: HEAD
Tag: (none) 
Log:
removed the painting of a border if label begun and ended with a space

Members: 
	ChangeLog:1.4786->1.4787 
	libraries/javalib/awt-implementations/kaffe/java/awt/Label.java:1.1->1.2 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4786 kaffe/ChangeLog:1.4787
--- kaffe/ChangeLog:1.4786	Thu May  4 16:04:55 2006
+++ kaffe/ChangeLog	Fri May  5 14:40:41 2006
@@ -1,3 +1,8 @@
+2006-05-05  Riccardo Mottola <riccardo at kaffe.org>
+
+	* libraries/javalib/awt-implementations/kaffe/java/awt/Label.java:
+	removed the painting of a border if label begun and ended with a space
+
 2006-05-04  Riccardo Mottola <riccardo at kaffe.org>
 
 	* libraries/javalib/awt-implementations/kaffe/java/awt/Canvas.java:
Index: kaffe/libraries/javalib/awt-implementations/kaffe/java/awt/Label.java
diff -u kaffe/libraries/javalib/awt-implementations/kaffe/java/awt/Label.java:1.1 kaffe/libraries/javalib/awt-implementations/kaffe/java/awt/Label.java:1.2
--- kaffe/libraries/javalib/awt-implementations/kaffe/java/awt/Label.java:1.1	Thu Jul 22 19:19:32 2004
+++ kaffe/libraries/javalib/awt-implementations/kaffe/java/awt/Label.java	Fri May  5 14:40:44 2006
@@ -30,7 +30,6 @@
 
 	int align;
 	String label;
-	boolean hasBorder;
 	FontMetrics fm;
 
 public Label() {
@@ -67,7 +66,6 @@
 
 public void paint( Graphics g) {
 	int sw = fm.stringWidth( label);
-	int db = hasBorder ? BORDER_WIDTH : 0;
 	int y0 = height - (height-fm.getHeight())/2 - fm.getDescent();
 	int x0;
 
@@ -76,20 +74,17 @@
 		x0 = (width - sw)/2;
 		break;
 	case RIGHT:
-		x0 = width - sw - db;
+		x0 = width - sw;
 		break;
 	case LEFT:
 	default:
-		x0 = db + 1;
+		x0 = 0;
 		break;
 	}
 
 	g.setColor( getBackground() );
 	g.fillRect( 0, 0, width, height);
 
-	if ( hasBorder )
-		kaffePaintBorder( g);
-			
 	if ( Defaults.LabelTxtCarved ) {
 		g.setColor( Color.white);
 		g.drawString( label, x0+1, y0+1 );
@@ -118,11 +113,11 @@
 	return new Dimension( cx, cy);
 }
 
-public void setAlignment( int align) {
-	if ( align < LEFT || align > RIGHT ) {
+public void setAlignment( int alignP) {
+	if ( alignP < LEFT || alignP > RIGHT ) {
 		throw new IllegalArgumentException();
 	}
-	this.align = align;
+	align = alignP;
 	if ( isShowing() ) {
 		repaint();
 	}
@@ -136,13 +131,12 @@
 	}
 }
 
-public void setText( String label) {
-	if ( label == null ) {
-		label = "";
-	}
-	if ( (this.label == null ) || ! (this.label.equals( label)) ){
-		this.label = label;
-		hasBorder = label.startsWith(" ") && label.endsWith( " ");
+public void setText( String labelP) {
+	if ( labelP == null ) {
+		labelP = "";
+	}
+	if ( (label == null ) || ! (label.equals( labelP)) ){
+		label = labelP;
 		if ( (flags & IS_SHOWING) == IS_SHOWING ) {
 			Graphics g = getGraphics();
 			if ( g != null ) {




More information about the kaffe mailing list