diff --git a/libjava/ChangeLog b/libjava/ChangeLog index bed53ea01af1..793e410a3496 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -2,6 +2,12 @@ * java/awt/Window.java (addNotify): Remove peer casting hack now that gcj/312 is fixed. + * java/awt/Button.java (addNotify): Likewise. + * java/awt/Label.java (addNotify): Likewise. + * java/awt/Panel.java (addNotify): Likewise. + * java/awt/Scrollbar.java (addNotify): Likewise. + * java/awt/Component.java (processPaintEvent): Use peer not getPeer. + Remove redundant null checks. 2000-12-18 Joseph S. Myers diff --git a/libjava/java/awt/Button.java b/libjava/java/awt/Button.java index cee3ae753583..2544e9e4bea6 100644 --- a/libjava/java/awt/Button.java +++ b/libjava/java/awt/Button.java @@ -38,7 +38,7 @@ public class Button extends Component public void addNotify () { if (peer == null) - peer = (ComponentPeer) getToolkit ().createButton (this); + peer = getToolkit ().createButton (this); super.addNotify(); } diff --git a/libjava/java/awt/Component.java b/libjava/java/awt/Component.java index 3614b2b5a301..09b724470715 100644 --- a/libjava/java/awt/Component.java +++ b/libjava/java/awt/Component.java @@ -1306,8 +1306,6 @@ public abstract class Component implements ImageObserver, MenuContainer, private void processPaintEvent(PaintEvent event) { - ComponentPeer peer = getPeer(); - // Can't do graphics without peer if (peer == null) return; @@ -1319,10 +1317,10 @@ public abstract class Component implements ImageObserver, MenuContainer, switch (event.id) { case PaintEvent.PAINT: - if (peer != null) paint(gfx); + paint(gfx); break; case PaintEvent.UPDATE: - if (peer != null) update(gfx); + update(gfx); break; default: throw new IllegalArgumentException("unknown paint event"); diff --git a/libjava/java/awt/Label.java b/libjava/java/awt/Label.java index 840456db74fe..c184dce03b96 100644 --- a/libjava/java/awt/Label.java +++ b/libjava/java/awt/Label.java @@ -42,7 +42,7 @@ public class Label extends Component public void addNotify () { if (peer == null) - peer = (ComponentPeer) getToolkit ().createLabel (this); + peer = getToolkit ().createLabel (this); } public int getAlignment () diff --git a/libjava/java/awt/Panel.java b/libjava/java/awt/Panel.java index a6e4f3e39f26..871969584821 100644 --- a/libjava/java/awt/Panel.java +++ b/libjava/java/awt/Panel.java @@ -32,8 +32,8 @@ public class Panel extends Container public void addNotify() { - if (getPeer() == null) - peer = (ComponentPeer) getToolkit().createPanel(this); + if (peer == null) + peer = getToolkit().createPanel(this); super.addNotify(); } } diff --git a/libjava/java/awt/Scrollbar.java b/libjava/java/awt/Scrollbar.java index 2a65a814e2a7..88a8d1fec5a4 100644 --- a/libjava/java/awt/Scrollbar.java +++ b/libjava/java/awt/Scrollbar.java @@ -54,7 +54,7 @@ public class Scrollbar extends Component implements Adjustable public void addNotify () { if (peer == null) - peer = (ComponentPeer) getToolkit ().createScrollbar (this); + peer = getToolkit ().createScrollbar (this); } public int getOrientation ()