I'm creating Swing project, but I'm wondering if there's any way to print text without using JLabel
or JTextField
.
I found out text field could be the one but it isn't as tidy as JLabel
. (there's a border around the text).
Can a border in the text field be removed? Or are there other methods I can use?
"I'm wondering if there's any way to print text without using JLable or JtextField"
You could always draw the text in a JPanel. Takes a lot more work, but you can do a lot more with your text.
public class TextPanel extends JPanel{
protected void paintComponent(Graphics g){
super.paintComponent(g);
g.drawString("Hello, Stackoverflow!", xLocation, yLocation);
}
}