Displaying text in a JPanel
I've just about finished my first GUI, but I'm having a problem displaying text. I've been putting some drawString() calls in my GUI's main repaint() method as a placeholder, but I'd like to have some control over the text's color, font, etc. I figured clever use of a JTextArea would get me what I wanted, so in the initialization I made one called "message", then put the following modifiers on it:
I'm able to edit the contents just fine, and the text shows up, but it's always in the JPanel's top-left corner and is always covered over by the game's graphics. I tried to remedy this by using message's setAlignmentX and setAlignmentY methods, but these don't seem to help. Adding "message.repaint();" to the end of the GUI's main repaint method didn't fix the problem of the game graphics burying the text area, either.
Could someone explain what I'm doing wrong and what a good way to display text is?
to display contents from vector to jpanel
how to display contents from a vector onto a jpanel?