The text in txDiv0
is supposed to show up when division by 0 is attempled. It is set to NOT visible initially. The code works correctly BUT THE TEXT ONLY SHOWS WHEN I click the frame border as if to make it larger. Making the frame literally one pixel taller makes the field show up.
Code produced by GUIbuilder:
private javax.swing.JTextField txDiv0;
...
txDiv0 = new javax.swing.JTextField();
...
txDiv0.setText("Division by 0 is undefined");
...
javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
jPanel6.setLayout(jPanel6Layout);
jPanel6Layout.setHorizontalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(txDiv0, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
jPanel6Layout.setVerticalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
.addGap(0, 11, Short.MAX_VALUE)
.addComponent(txDiv0, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
);
...
pack();
And here's how I try to make it show up:
txDiv0.setVisible(true);
System.out.println();
(The println is there to show me that the code DID execute.)
The textfield NEVER shows up unless I barely wiggle an edge of the frame.