Paint() method interfering with Swing - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Paint() method interfering with Swing

cloudncalicloudncali Posts: 35Member
Hello

I have an applet I have been working on. The First part of it is a login screen made with swing. The second part uses images from the paint () method.

But when the pain method is there, even thought it is currently empty, it makes the swing components show funny. Like some times they will now be there until I put the mouse over them or some times only a few of them will show. If I remove the paint method it works fine. But I need the paint method in the future so what should I do?

Comments

  • zibadianzibadian Posts: 6,349Member
    : Hello
    :
    : I have an applet I have been working on. The First part of it is a login screen made with swing. The second part uses images from the paint () method.
    :
    : But when the pain method is there, even thought it is currently empty, it makes the swing components show funny. Like some times they will now be there until I put the mouse over them or some times only a few of them will show. If I remove the paint method it works fine. But I need the paint method in the future so what should I do?
    :
    :
    Do not override the JApplet.paint(), but place a JPanel onto the the applet and override the paint() of that instead. In Swing paint() handles the painting of the components.
  • cloudncalicloudncali Posts: 35Member
    Thanks for the reply but I had already solved this at the time you posted. Your solutions could have worked but this was my solution
    I just put:
    paintComponents(g);
    Into the Paint() method.

    Problem solved thanks for the help


Sign In or Register to comment.