how to erase the contents in the JPanel before repainting????
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
how to erase the contents in the JPanel before repainting????
JPanel has a removeAll() function. Does that not meet your needs?
Writing code is your job, helping you fix and understand it is mine.
<-- Be sure to thank and REP (Star icon) those who have helped you. They appreciate it!
Or if you are talking about using the paintComponent() method for drawing, call super.paintComponent() to erase what was previously drawn on the JPanel.
If you don't understand my answer, don't ignore it, ask a question.
thnks agn admin u r a saviour!!!
--- Update ---
cn u help me out wid dis one!!!
hw do go about using the up,down,left and right keys in the keypress event!!!
tr r cpl ws 2 use ky lstnrs. key binding nd ky lstnrs. use if stmt to dtct wht ky nd pt lgc insd da if.
If you don't understand my answer, don't ignore it, ask a question.