yup! aren't anonymous classes neat? In this case, I wouldn't do it. I save it
for much lighter weight stuff.

David

Quoting Walter H Shirey <[EMAIL PROTECTED]>:

> Can I override the paintComponent() method during initialization of the
> JPanel object ?
>
> JPanel jp = new JPanel(){
>             public void paintComponent(Graphics g){
>                 super.paintComponent(g);
>                 // custom paint code;
>             }
>         };
>
> Thanks,
> Walter Shirey
>
>
>
>         -----Original Message-----
>         From: Dmitri Trembovetski [mailto:[EMAIL PROTECTED]
>         Sent: Fri 2/6/2004 12:46 PM
>         To: [EMAIL PROTECTED]
>         Cc:
>         Subject: Re: [JAVA2D] repainting JPanel
>
>
>
>           Hi Walter,
>
>         On Fri, Feb 06, 2004 at 12:42:15PM -0600, Walter H Shirey wrote:
>          > I'm having problems trying to figure out how to redraw a
> JPanel with
>          > custom graphics after a JDialog, displayed on top of the
> JPanel,  has
>          > been disposed of. Also having the same problem when the
> window has lost
>          > focus or been maximized after being minimized to toolbar.
>          >
>          > If I overwrite the paintComponent() method of the JPanel,
> will Java know
>          > to paint the JPanel after the JDialog has been disposed, or
> if focus has
>          > returned to the window? Or do I have to implement
> focusListeners with
>          > the paintComponent() method?
>
>           Swing/AWT will figure out which part needs to be redrawn and
> will
>           call paintComponent with the appropriate clip. So, all you
> need to
>           do is repaint your component in paintComponent (you might want
> to
>           check the clip bounds to optimize rendering).
>
>           Thank you,
>             Dmitri
>
>
> ========================================================================
> ===
>         To unsubscribe, send email to [EMAIL PROTECTED] and include
> in the body
>         of the message "signoff JAVA2D-INTEREST".  For general help,
> send email to
>         [EMAIL PROTECTED] and include in the body of the message
> "help".
>
>
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff JAVA2D-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to