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.
problems with paintComponent
I want to draw many shapes in my application.I used JFrame,JMenubar,JMenu and JToolbar.I first drew many shapes on a JPanel object with paint method. But every time the application initiates, The menubar,menu,toolbar and buttons on the toolbar buttons appears twice.Then,I used paintComponent method instead of paint, and it successfully displayed the shapes on the panel.and the menubars,menus and toobar worked well.
But,when and dialog(JOptionPane.showConfirmDialog) appears and then disappears,the locale where the dialog located shows a shadow area.
Is there a method to refresh the panel?Or are there any other solutions to this problem?
Thanks in advance!
0 · ·