[EMAIL PROTECTED] wrote:
Thanks for the tip. I have added methods to check property changes to the size and text. I also read somewhere that I should not override the paintComponent method but that I should use the paint method instead. The clip is normally set in the paint method of JComponent.

  I'll leave that to Swing experts (you may wan to
  confirm this on the Swing forum).

If I do that it also works and gives the following method. /**
 */
        public void paint(final Graphics g) {
                if (isEnabled()) {
                        super.paint(g);
                        return;

                }
                if (redraw) {
                        final BufferedImage buf = new BufferedImage(getWidth(), 
getHeight(),
                                        BufferedImage.TYPE_INT_RGB);
                        final Graphics2D g2 = (Graphics2D) buf.getGraphics();
                        super.paint(g2);
                        final float f = 0.18f;
                        final int heightWidth = 3;
                        final float[] myKernel = { 0, f, 0, f, f, f, 0, f, 0 };

                        final ConvolveOp op = new ConvolveOp(new 
Kernel(heightWidth, heightWidth, myKernel));
                        img = op.filter(buf, null);
                        g2.dispose();
                        redraw = false;
                }
                g.drawImage(img, 0, 0, null);
        }

  Looks pretty good to me.
  I assume redraw is updated when the size or text changes, right?

PS. How can I post nicely formatted code?

  I believe you need to use [ code ] and [ / code ] (w/o spaces) tags.

  Thanks,
    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".

Reply via email to