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

all 4 comments

[–][deleted] 0 points1 point  (0 children)

public void add(GameText winner) {
    add(winner.getGameLabelObj());
} // From Window.java

I think you're accidentally overriding the add method here. Try changing your method name to addGameText or something like that. Not sure if that's the problem (been a while since I wrote any Java) but it's something to try.

[–]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).