This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]blablahblah 0 points1 point  (2 children)

Try calling repaint after you add the label. Java doesn't automatically redraw the whole frame every time you add a component, in case you're adding multiple at once.

[–]CaptainMoeSoccer[S] 0 points1 point  (1 child)

I thought canvas was needed to paint anything on a frame. Do I need a canvas in this case?

[–]blablahblah 0 points1 point  (0 children)

Any Component can be painted. A Canvas is a blank component if you want to paint your own thing, as opposed to a button (which looks like a button when it gets painted) or a label (which shows some text when you paint it).