My question is: WHY the same rocking procedure - the usual picture is almost 16 times faster when drawing a JPanel compared to directly on a JFrame? Is it just double buffering? It can not be, of course?
Reference Information. I had a problem with the fact that the user picture was not updated when the JFrame was invisible (especially, only partially shaded). After searching for SO, I decided to bite the bullet and figure out how to connect the JPanel subclass to the bluddy-NetBeans-form-designer form.
For those in the same situation: in NetBeans, you need to create a new standard class (not a JPanel form) that simply extends JPanel, and manually coordinate everything there (without a GUI designer, for example, a good day, sigh). Then you add a standard JPanel to your form, set its size; then right-click and select "Customize Code" and select "custom creation" in the combo box ... where it creates a new javax.swing.JPanel, replace it with a subclass.
So ... This allowed me to "do it right" and draw the component, not directly on the form. In addition, the key-listener panel offers a much faster solution than hi-expanding the key-event-dispatcher frame.
In any case, the profiler now says EXACTLY that the same drawing code runs about 16 times faster in JPanel paintComponent () as a JFrame paint () application ... and I was wondering if anyone could explain why.
Thanks in advance. Whale.
EDIT: This question is based on MISINTERPRETED METRICS. The profiler does not include / does not report the JPanel paintComponent () method in the AWT-EventQueue stream, where since my base profile includes JFrame paint (). I should have looked more carefully before asking a stupid question. My bad.
java swing
corlettk
source share