Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.