Hello,
I have a Computer Science project for school. I am done writing the full code but I am missing one of the requirements. Some of the text have to be aligned to the right.
Here's an excerpt from my code which I want to change the alignment:
System.out.print (subj1 + "\t"); // Subject Name
System.out.print (gradesubj1 + "%\n"); //Mark for Subject 1
In my code, I want the second line to be align to the right.
I did my search on google and found out that I can use this:
JTextField.setHorizontalAlignment(JTextField.RIGHT);
So, I try it in my code:
System.out.print (subj1 + "\t"); // Subject Name
JTextField.setHorizontalAlignment(JTextField.RIGHT);
System.out.print (gradesubj1 + "%\n"); //Mark for Subject 1
But, I get an error that says:
Error: Cannot find symbol
I am currently using Dr.Java as my IDE.
What am I doing wrong here?
Should I import a package? Which one?
If you need my full code, you can find it here:
Thanks in advance.
Shifat Taushif
shifat.tk