Merged gcj-eclipse branch to trunk.
From-SVN: r120621
This commit is contained in:
@@ -37,6 +37,8 @@ exception statement from your version. */
|
||||
|
||||
package gnu.java.awt.peer.swing;
|
||||
|
||||
import java.awt.Container;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Image;
|
||||
import java.awt.Label;
|
||||
import java.awt.Point;
|
||||
@@ -67,7 +69,14 @@ public class SwingLabelPeer
|
||||
extends JLabel
|
||||
implements SwingComponent
|
||||
{
|
||||
|
||||
Label label;
|
||||
|
||||
|
||||
SwingLabel(Label label)
|
||||
{
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns this label.
|
||||
*
|
||||
@@ -131,8 +140,8 @@ public class SwingLabelPeer
|
||||
public boolean isShowing()
|
||||
{
|
||||
boolean retVal = false;
|
||||
if (SwingLabelPeer.this.awtComponent != null)
|
||||
retVal = SwingLabelPeer.this.awtComponent.isShowing();
|
||||
if (label != null)
|
||||
retVal = label.isShowing();
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@@ -149,7 +158,19 @@ public class SwingLabelPeer
|
||||
{
|
||||
return SwingLabelPeer.this.createImage(w, h);
|
||||
}
|
||||
|
||||
|
||||
public Graphics getGraphics()
|
||||
{
|
||||
return SwingLabelPeer.this.getGraphics();
|
||||
}
|
||||
|
||||
public Container getParent()
|
||||
{
|
||||
Container par = null;
|
||||
if (label != null)
|
||||
par = label.getParent();
|
||||
return par;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -160,11 +181,11 @@ public class SwingLabelPeer
|
||||
public SwingLabelPeer(Label label)
|
||||
{
|
||||
super();
|
||||
SwingLabel swingLabel = new SwingLabel();
|
||||
SwingLabel swingLabel = new SwingLabel(label);
|
||||
swingLabel.setText(label.getText());
|
||||
swingLabel.setHorizontalAlignment(label.getAlignment());
|
||||
swingLabel.setOpaque(true);
|
||||
init(label, swingLabel);
|
||||
setAlignment(label.getAlignment());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -190,7 +211,20 @@ public class SwingLabelPeer
|
||||
*/
|
||||
public void setAlignment(int alignment)
|
||||
{
|
||||
((JLabel) swingComponent.getJComponent()).setHorizontalAlignment(alignment);
|
||||
JLabel swingLabel = (JLabel) swingComponent.getJComponent();
|
||||
switch (alignment)
|
||||
{
|
||||
case Label.RIGHT:
|
||||
swingLabel.setHorizontalAlignment(JLabel.RIGHT);
|
||||
break;
|
||||
case Label.CENTER:
|
||||
swingLabel.setHorizontalAlignment(JLabel.CENTER);
|
||||
break;
|
||||
case Label.LEFT:
|
||||
default:
|
||||
swingLabel.setHorizontalAlignment(JLabel.LEFT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user