Results 1 to 4 of 4
  1. #1
    kcakir is offline Member
    Join Date
    Apr 2009
    Posts
    7
    Rep Power
    0

    Default Jpanel painting problem

    I am developing a gui application and i have a frame which includes two panel. One of them includes some buttons and textfields and a combobox and the other panel paints something over itself. I use timer and overrided paintcomponent method but it always draws the other panel's view on this panel also. Clearly i see over my frame two panels both have same look but one of them is drawn the other is not. why my drawing panel gets the other panel's view and draw it.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    You've got a bug in your code. Your best bet is to present your code to us in a way that will make it easy for us to analyze it and figure out what's wrong. I recommend that you simplify your code as much as possible so that it is very small but still compilable and runnable on our boxes, and then post it here. This will offer your best chances of getting prompt useful help. For more information on how to create this short program, please check out this site: Short, Self Contained, Correct Example

    Best of luck!

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    Also, when posting code here, please use code tags so that your code will retain its formatting and thus will be readable -- after all, your goal is to get as many people to read your post and understand your code as possible, right?

    To do this, highlight your pasted code (please be sure that it is already formatted when you paste it into the forum; the code tags don't magically format unformatted code) and then press the code button, and your code will have tags.

    Another way to do this is to manually place the tags into your code by placing the tag [code] above your pasted code and the tag [/code] below your pasted code like so:

    Java Code:
    [code]
      // your code goes here
      // notice how the top and bottom tags are different
    [/code]

  4. #4
    kcakir is offline Member
    Join Date
    Apr 2009
    Posts
    7
    Rep Power
    0

    Default

    I found the solution i override paint method instead of paintcomponent it is okay now .

Similar Threads

  1. Not another Jpanel Scrollbar problem!
    By jiexx in forum AWT / Swing
    Replies: 3
    Last Post: 03-18-2009, 02:09 AM
  2. Problem on adding JButton on JPanel NEED HELP
    By boisk in forum AWT / Swing
    Replies: 15
    Last Post: 03-15-2009, 02:27 PM
  3. Applets painting outside borders in web browsers
    By sirdori in forum New To Java
    Replies: 2
    Last Post: 11-20-2008, 06:14 PM
  4. Hovering mouse over a button and painting
    By gtraylo in forum AWT / Swing
    Replies: 2
    Last Post: 04-24-2008, 09:33 AM
  5. Problem with JPanel
    By ibanez270dx in forum New To Java
    Replies: 2
    Last Post: 11-09-2007, 05:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •