Vote count:
0
I am a new student of java.This is a college project, a math test in a gui. I have problems with alignment.
I would like to do this in my gui when I run the program
Math Test - 10 exercises (this in the middle)
about 2 spaces here
- How much is one added to one? ( this is an example. the math problems are going to be word problems with several sentences.)
a space here
Your answer, please. here goes a JTextField (4)
about 2 spaces here
- here goes exercise number 2
etc. etc.
What do you think is better for the math word problems JLabel or JTextArea?
here I imported swing and awt
public class MathTest extends JPanel
{
public JTextField stu;
{
public MathTest()
JLabel m=new JLabel ();
m.setText ("Math Test - 10 exercises");
add(m);
JLabel exone= JLabel();
exone.setText("1. how much is one added to one?");
add(exone);
JLabel y= new JLabel();
y.setText ("Your answer, please.");
add(y);
stu= JTextField (4);
add(stu);
}
}
The programs works but I cannot align the labels and the JTextfield.
Thank you.
asked 47 secs ago
Aucun commentaire:
Enregistrer un commentaire