-
Bug
-
Resolution: Fixed
-
P4
-
1.0, 1.1, 1.1.3
-
b01
-
unknown, x86, sparc
-
solaris_2.5, solaris_2.5.1, windows_95
-
Not verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2013372 | 1.2.0 | Erik Larsen | P4 | Resolved | Fixed | 1.2beta4 |
label.repaint() in the following code fails on Solaris/Motif awt1.1:
import java.applet.*;
import java.awt.*;
public class Test extends Applet implements Runnable {
Label label = new Label("Hi There!");
Button button = new Button("Swap Text");
public void init() {
setLayout(new BorderLayout());
add("Center", label);
add("South", button);
validate();
}
public void run() {
}
public boolean action(Event evt, Object arg) {
if (evt.target instanceof Button) {
if (arg.equals("Swap Text")) {
if (label.getText().equals("Hi There!")) {
label.setText("This Label's Text Should Have Changed");
label.repaint();
} else {
label.setText("Hi There!");
label.repaint();
}
}
}
return true;
}
}
[sheri.good@Eng 1997-03-17] Another report of this bug but for the
TextField component.
Category: java
Subcategory: classes_awt
Bug/rfe/eou: bug
Synopsis: Solaris TextField.repaint Not Correct
Severity Impact: (internal)
Severity Functionality: (internal)
Priority: (internal)
Description: On Solaris, the following code causes the independent_variable_field
to be "blanked" out. Click on "time" in the Available names list.
Then click on the "<-" button. The independent_variable_field gets
blanked out.
The cause of the problem appears to be the repaint of the field which
follows the "setText" invocation for the field. While it turns out
that the repaint is unnecessary, I still feel that it should work
correctly, even in this context.
import java.awt.event.*;
import java.awt.*;
public final class listprob extends Dialog
implements ActionListener {
String independent_variable = null;
Button ok, setIndependentVariable;
List available_list;
TextField independent_variable_field;
TextField start_field, end_field;
TextField run_number_field;
public listprob (Frame parent) {
super (parent, "Data Selection", true);
Label l;
Panel p, panel_button;
setLayout (new BorderLayout ());
p = new Panel ();
p.setLayout (new GridBagLayout ());
l = new Label ("Run Number");
constrain (p, l, 0, 0, GridBagConstraints.EAST);
run_number_field = new TextField ();
constrain (p, run_number_field, 1, 0,
GridBagConstraints.WEST);
l = new Label (" ");
constrain (p, l, 0, 1, GridBagConstraints.WEST);
l = new Label ("Independent Variable");
constrain (p, l, 0, 2,
GridBagConstraints.WEST);
independent_variable_field = new TextField (12);
constrain (p, independent_variable_field, 0, 3,
GridBagConstraints.WEST);
setIndependentVariable = new Button ("<-");
setIndependentVariable.addActionListener (this);
constrain (p, setIndependentVariable, 1, 3,
GridBagConstraints.CENTER);
l = new Label ("Available Names");
constrain (p, l, 2, 3, GridBagConstraints.CENTER);
l = new Label ("Dependent Variables");
available_list = new List (5, true);
constrain (p, available_list, 2, 4,
GridBagConstraints.CENTER);
l = new Label (" ");
constrain (p, l, 0, 9, GridBagConstraints.WEST);
l = new Label ("Input Range");
constrain (p, l, 0, 10, GridBagConstraints.EAST);
l = new Label ("(optional)");
constrain (p, l, 1, 10, GridBagConstraints.WEST);
add ("North", p);
p = new Panel ();
p.setLayout (new FlowLayout ());
l = new Label ("Range Start");
p.add (l);
start_field = new TextField ();
p.add (start_field);
l = new Label (" Range End");
p.add (l);
end_field = new TextField ();
p.add (end_field);
add ("Center", p);
p = new Panel ();
p.setLayout (new FlowLayout ());
ok = new Button ("Ok");
ok.addActionListener (this);
p.add (ok);
add ("South", p);
pack ();
available_list.add("time");
available_list.add("X");
}
public void constrain (Container container, Component component,
int grid_x, int grid_y, int anchor) {
GridBagConstraints c = new GridBagConstraints ();
c.gridx = grid_x;
c.gridy = grid_y;
c.anchor = anchor;
if (grid_x == 2 && grid_y == 4)
c.gridheight = 3;
if (grid_x == 0 && grid_y == 5)
c.gridheight = 3;
((GridBagLayout)container.getLayout()).setConstraints (component,
c);
container.add (component);
}
public void actionPerformed (ActionEvent e) {
int i;
int [] iselections;
if (e.getActionCommand().equals("Ok"))
System.exit (0);
else if (e.getSource() == setIndependentVariable) {
iselections = available_list.getSelectedIndexes();
if (iselections.length <= 0)
return;
if (iselections.length > 1) {
System.out.println (
"Independent variable may only have 1 selection");
}
available_list.deselect (iselections[0]);
independent_variable_field.setText (
available_list.getItem(iselections[0]));
// Problem statement follows:
independent_variable_field.repaint ();
}
}
public static void main (String[] args) {
Frame f = new Frame ("Test listprob");
listprob d = new listprob (f);
d.show ();
}
}
company - Cummins Engine Company , email - ###@###.###
Work around: Don't repaint. setText updates the field for you.
Comments:
customer_rec: new
Company: other
Employee:Rob Janes
Release: jdk11
Hardware Version: sun4u
O/S version: sol2.5.1
User Role: D
User Type: E
Sun Contact: (internal)
end_customer_rec:
BUG_END
import java.applet.*;
import java.awt.*;
public class Test extends Applet implements Runnable {
Label label = new Label("Hi There!");
Button button = new Button("Swap Text");
public void init() {
setLayout(new BorderLayout());
add("Center", label);
add("South", button);
validate();
}
public void run() {
}
public boolean action(Event evt, Object arg) {
if (evt.target instanceof Button) {
if (arg.equals("Swap Text")) {
if (label.getText().equals("Hi There!")) {
label.setText("This Label's Text Should Have Changed");
label.repaint();
} else {
label.setText("Hi There!");
label.repaint();
}
}
}
return true;
}
}
[sheri.good@Eng 1997-03-17] Another report of this bug but for the
TextField component.
Category: java
Subcategory: classes_awt
Bug/rfe/eou: bug
Synopsis: Solaris TextField.repaint Not Correct
Severity Impact: (internal)
Severity Functionality: (internal)
Priority: (internal)
Description: On Solaris, the following code causes the independent_variable_field
to be "blanked" out. Click on "time" in the Available names list.
Then click on the "<-" button. The independent_variable_field gets
blanked out.
The cause of the problem appears to be the repaint of the field which
follows the "setText" invocation for the field. While it turns out
that the repaint is unnecessary, I still feel that it should work
correctly, even in this context.
import java.awt.event.*;
import java.awt.*;
public final class listprob extends Dialog
implements ActionListener {
String independent_variable = null;
Button ok, setIndependentVariable;
List available_list;
TextField independent_variable_field;
TextField start_field, end_field;
TextField run_number_field;
public listprob (Frame parent) {
super (parent, "Data Selection", true);
Label l;
Panel p, panel_button;
setLayout (new BorderLayout ());
p = new Panel ();
p.setLayout (new GridBagLayout ());
l = new Label ("Run Number");
constrain (p, l, 0, 0, GridBagConstraints.EAST);
run_number_field = new TextField ();
constrain (p, run_number_field, 1, 0,
GridBagConstraints.WEST);
l = new Label (" ");
constrain (p, l, 0, 1, GridBagConstraints.WEST);
l = new Label ("Independent Variable");
constrain (p, l, 0, 2,
GridBagConstraints.WEST);
independent_variable_field = new TextField (12);
constrain (p, independent_variable_field, 0, 3,
GridBagConstraints.WEST);
setIndependentVariable = new Button ("<-");
setIndependentVariable.addActionListener (this);
constrain (p, setIndependentVariable, 1, 3,
GridBagConstraints.CENTER);
l = new Label ("Available Names");
constrain (p, l, 2, 3, GridBagConstraints.CENTER);
l = new Label ("Dependent Variables");
available_list = new List (5, true);
constrain (p, available_list, 2, 4,
GridBagConstraints.CENTER);
l = new Label (" ");
constrain (p, l, 0, 9, GridBagConstraints.WEST);
l = new Label ("Input Range");
constrain (p, l, 0, 10, GridBagConstraints.EAST);
l = new Label ("(optional)");
constrain (p, l, 1, 10, GridBagConstraints.WEST);
add ("North", p);
p = new Panel ();
p.setLayout (new FlowLayout ());
l = new Label ("Range Start");
p.add (l);
start_field = new TextField ();
p.add (start_field);
l = new Label (" Range End");
p.add (l);
end_field = new TextField ();
p.add (end_field);
add ("Center", p);
p = new Panel ();
p.setLayout (new FlowLayout ());
ok = new Button ("Ok");
ok.addActionListener (this);
p.add (ok);
add ("South", p);
pack ();
available_list.add("time");
available_list.add("X");
}
public void constrain (Container container, Component component,
int grid_x, int grid_y, int anchor) {
GridBagConstraints c = new GridBagConstraints ();
c.gridx = grid_x;
c.gridy = grid_y;
c.anchor = anchor;
if (grid_x == 2 && grid_y == 4)
c.gridheight = 3;
if (grid_x == 0 && grid_y == 5)
c.gridheight = 3;
((GridBagLayout)container.getLayout()).setConstraints (component,
c);
container.add (component);
}
public void actionPerformed (ActionEvent e) {
int i;
int [] iselections;
if (e.getActionCommand().equals("Ok"))
System.exit (0);
else if (e.getSource() == setIndependentVariable) {
iselections = available_list.getSelectedIndexes();
if (iselections.length <= 0)
return;
if (iselections.length > 1) {
System.out.println (
"Independent variable may only have 1 selection");
}
available_list.deselect (iselections[0]);
independent_variable_field.setText (
available_list.getItem(iselections[0]));
// Problem statement follows:
independent_variable_field.repaint ();
}
}
public static void main (String[] args) {
Frame f = new Frame ("Test listprob");
listprob d = new listprob (f);
d.show ();
}
}
company - Cummins Engine Company , email - ###@###.###
Work around: Don't repaint. setText updates the field for you.
Comments:
customer_rec: new
Company: other
Employee:Rob Janes
Release: jdk11
Hardware Version: sun4u
O/S version: sol2.5.1
User Role: D
User Type: E
Sun Contact: (internal)
end_customer_rec:
BUG_END
- backported by
-
JDK-2013372 Solaris: Label.repaint() and TextField.repaint() both fail
-
- Resolved
-
- duplicates
-
JDK-4023483 Solaris: Label.repaint() works fine under Netscape, but not under HotJava.
-
- Closed
-
-
JDK-4029182 Motif TextItem colors not handled properly
-
- Closed
-