-
Bug
-
Resolution: Cannot Reproduce
-
P2
-
None
-
1.1.1
-
sparc
-
solaris_2.5.1
The following program shows that resizing this GridLayout does not redraw the Panel/Lists correctly. Actually, if you resize once its draws correctly, resize again, it does not draw correctly (removes the bottom border of the left List), resize again, draws correctly, ..., toggles between correct and incorrect drawing behaviour with each resize.
Here is the layout of the frame:
List 1 List2
Label 1 TextField 1
Label 2 TextField 2
Button1 Button2
GridLayout contains 3 Panels, with the middle Panel containing the 2 Lists.
(In Xerox's application, using GridBagLayout has others issues so they would like to use GridLayout. Further, they say it used to work with JDK1.0.2)
TestFrame.java
--------------
package GenEvent.Common;
import java.awt.*;
public class TestFrame extends Frame {
public static void main(String args[]) {
TestFrame cl = new TestFrame();
cl.setVisible(true);
}
public TestFrame() {
setTitle( "Grid Layout Problem Demo");
Panel topPanel;
setLayout(new BorderLayout());
// Font myFont = new Font("Helvetica", Font.BOLD, 14);
// setFont( myFont );
topPanel = new Panel();
topPanel.setLayout(new GridLayout( 1, 2));
topPanel.add(new Label("Available Events:"));
topPanel.add(new Label("Event Catalog:"));
Panel listPanel = new Panel ();
listPanel.setLayout( new GridLayout(1, 2, 1, 1) );
List eventList = new List ( 50, false);
for (int i=0; i<50;++i) eventList.addItem( "Xerox Event " + i);
List catalogList = new List( 50, false);
for (int i=0; i<50;++i) catalogList.addItem( "Xerox Catalog " + i);
listPanel.add ( eventList );
listPanel.add ( catalogList );
Panel buttonPanel = new Panel();
buttonPanel.add( new Button("OK"));
buttonPanel.add( new Button("Cancel"));
add("North",topPanel);
add("Center",listPanel);
add("South",buttonPanel);
setSize(806,410);
}
}
Here is the layout of the frame:
List 1 List2
Label 1 TextField 1
Label 2 TextField 2
Button1 Button2
GridLayout contains 3 Panels, with the middle Panel containing the 2 Lists.
(In Xerox's application, using GridBagLayout has others issues so they would like to use GridLayout. Further, they say it used to work with JDK1.0.2)
TestFrame.java
--------------
package GenEvent.Common;
import java.awt.*;
public class TestFrame extends Frame {
public static void main(String args[]) {
TestFrame cl = new TestFrame();
cl.setVisible(true);
}
public TestFrame() {
setTitle( "Grid Layout Problem Demo");
Panel topPanel;
setLayout(new BorderLayout());
// Font myFont = new Font("Helvetica", Font.BOLD, 14);
// setFont( myFont );
topPanel = new Panel();
topPanel.setLayout(new GridLayout( 1, 2));
topPanel.add(new Label("Available Events:"));
topPanel.add(new Label("Event Catalog:"));
Panel listPanel = new Panel ();
listPanel.setLayout( new GridLayout(1, 2, 1, 1) );
List eventList = new List ( 50, false);
for (int i=0; i<50;++i) eventList.addItem( "Xerox Event " + i);
List catalogList = new List( 50, false);
for (int i=0; i<50;++i) catalogList.addItem( "Xerox Catalog " + i);
listPanel.add ( eventList );
listPanel.add ( catalogList );
Panel buttonPanel = new Panel();
buttonPanel.add( new Button("OK"));
buttonPanel.add( new Button("Cancel"));
add("North",topPanel);
add("Center",listPanel);
add("South",buttonPanel);
setSize(806,410);
}
}