Did you call super.paintComponent inside your paintComponent method?
A.
>From: janet <[EMAIL PROTECTED]>
>Reply-To: janet <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: how to show a tree component on an image as its background?
>Date: Wed, 10 May 2000 11:21:44 +0800
>
>Hello everyone.
>
> My problem is:
> I need to show a tree (javax.swing.JTree) on some image as its
>background.
>(the tree itself is on a JScrollPane)
>
> so I did the following:
>1: make the tree non-opaque:
> tree.setOpaque(false);
>2: write a class GraphicScrollPane which subclasses the JScrollPane.
>Override its "paintComponent( )" method to draw an image on it.
>3: put the tree on the GraphicScrollPane:
> graphicscrollpane.getViewport().setView(tree);
>
> But though you can see the image under the tree, the place where the
>nodes
>are won't be transparent. That is, you can see the white rectangle of the
>nodes preventing the image to show gracefully.
>
> I tried the following ways but none of them could work:
> ....
> (tree.getCellRenderer( ) ).setOpaque(false);
> or
> DefaultTreeCellRenderer
> cellrenderer=(DefaultTreeCellRenderer)tree.getCellRenderer();
> cellrenderer.setBackgroundNonSelectionColor(null);
> ...
> I know the DefaultTreeCellRenderer the JTree uses is subclassed from
>JLabel. So how can I achieve my goal?
>
> Any suggestions or hints are appreciated greatly!
> with my best regards:
> Janet
>
>===========================================================================
>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".
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
===========================================================================
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".