AWT Textfield behaves weird with MicroSoft JVM
- by AKh
Hi,
I am facing a weird problem when using MicroSoft JVM to run my Applet. I have an AWT panel with 4 textfields which is added to a dialog box. Everything goes fine until I enter a decimal value into the textfield and close the dialog box. When i reopen the dialog box the textfield inside the panel with all the decimal digits (entered in the previous step) behaves weird. The decimal values along with the WHITE area inside the textfield moves to the left and hides the digits. When I click inside the textfield it becomes normal. The Panel earlier had gridlayout and I even tried changing it to gridbaylayout and still the problem persist.
NOTE: All Development are pertained to JRE1.1 to compatibility with MS JVM
If any can help me with this it would be a great help. Thanks in advance.
.
.
.
.
public MyPanel(Dialog myDialog)
{
Panel panel = new Panel();
this.dialog = myDialog;
//Previous code with grid layout
/* panel.setLayout(new GridLayout2(4,2,2,2));
panel.add(new Label("Symbol:"));
panel.add(symbolField = new TextField("",20));
panel.add(new Label("Quantity:"));
panel.add( qtyField = new TextField());
panel.add(new Label("Price per Share:"));
panel.add( costField = new TextField());
panel.add(new Label("Date Acquired:"));
panel.add( purchaseDate = new TextField() );*/
GridBagLayout gridbag = new GridBagLayout();
System.out.println("######## Created New GridBagLayout");
GridBagConstraints constraints = new GridBagConstraints();
panel.setLayout( gridbag );
constraints = buildConstraints( constraints, 0, 0, 1, 1, 1.5, 1 );
constraints.anchor = GridBagConstraints.WEST;
constraints.fill = GridBagConstraints.HORIZONTAL;
panel.add( new Label("Symbol:"), constraints);
constraints = buildConstraints( constraints, 1, 0, 1, 1, 1.5, 1 );
constraints.anchor = GridBagConstraints.WEST;
constraints.fill = GridBagConstraints.HORIZONTAL;
panel.add( symbolField = new TextField("",20), constraints);
constraints = buildConstraints( constraints, 0, 1, 1, 1, 1.5, 1 );
constraints.anchor = GridBagConstraints.WEST;
constraints.fill = GridBagConstraints.HORIZONTAL;
panel.add( new Label("Quantity:"), constraints);
constraints = buildConstraints( constraints, 1, 1, 1, 1, 1.5, 1 );
constraints.anchor = GridBagConstraints.WEST;
constraints.fill = GridBagConstraints.HORIZONTAL;
panel.add( qtyField = new TextField(), constraints);
constraints = buildConstraints( constraints, 0, 2, 1, 1, 1.5, 1 );
constraints.anchor = GridBagConstraints.WEST;
constraints.fill = GridBagConstraints.HORIZONTAL;
panel.add( new Label("Price per Share:"), constraints);
constraints = buildConstraints( constraints, 1, 2, 1, 1, 1.5, 1 );
constraints.anchor = GridBagConstraints.WEST;
constraints.fill = GridBagConstraints.HORIZONTAL;
panel.add( costField = new TextField(), constraints);
constraints = buildConstraints( constraints, 0, 3, 1, 1, 1.5, 1 );
constraints.anchor = GridBagConstraints.WEST;
constraints.fill = GridBagConstraints.HORIZONTAL;
panel.add( new Label("Date Acquired:"), constraints);
constraints = buildConstraints( constraints, 1, 3, 1, 1, 1.5, 1 );
constraints.anchor = GridBagConstraints.WEST;
constraints.fill = GridBagConstraints.HORIZONTAL;
panel.add( purchaseDate = new TextField(), constraints);
..............
.........
}