AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problem with glasspane on JScrollPane

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java GUI Toolkits
View previous topic :: View next topic  
Author Message
Anthony Mak
Guest





PostPosted: Thu Sep 29, 2005 5:56 am    Post subject: Problem with glasspane on JScrollPane Reply with quote



I have a JApplet inside a JScrollPane and I am drawing on the glasspane
which I get from the JApplet,

glasspane
Quote:

V

JApplet
Quote:

V

JScrollPane

The problem is, sometimes my scrollbars are not visible, and sometimes
when I scroll on either the vertical or horizontal scrollbar, the other
one is covered by the glasspane. And sometimes the glasspane covers
part of the toolbar at the top. I don't understand why the glasspane
can cover the scrollpane or the toolbar because my glasspane is gotten
from the japplet which is INSIDE my scrollpane which is inside my
JFrame.

Please help.
Merci. Arigatou.

Anthony Mak


Back to top
Roedy Green
Guest





PostPosted: Thu Sep 29, 2005 6:37 am    Post subject: Re: Problem with glasspane on JScrollPane Reply with quote



On 28 Sep 2005 22:56:08 -0700, "Anthony Mak" <anthony.mak (AT) iname (DOT) com>
wrote or quoted :

Quote:
The problem is, sometimes my scrollbars are not visible, and sometimes
when I scroll on either the vertical or horizontal scrollbar, the other
one is covered by the glasspane. And sometimes the glasspane covers
part of the toolbar at the top. I don't understand why the glasspane
can cover the scrollpane or the toolbar because my glasspane is gotten
from the japplet which is INSIDE my scrollpane which is inside my
JFrame.

I have no glasspane experience, but perhaps you want to get the
glasspane of the JScrollPane instead.

Your fiddlings perhaps require some repainting elsewhere?

Are you tying up the Swing thread?

Are you poking Swing components with the wrong thread?

Without code it is hard to tell what the matter could be.

--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.

Back to top
Anthony Mak
Guest





PostPosted: Fri Sep 30, 2005 4:52 am    Post subject: Re: Problem with glasspane on JScrollPane Reply with quote



Thanks for the quick reply, Roedy.

Roedy Green wrote:
Quote:

I have no glasspane experience, but perhaps you want to get the
glasspane of the JScrollPane instead.

The problem is JScrollPane doesn't have a getglasspane() method.
So I am creating a dummy JApplet (which has getglasspane() ), and
putting it inside my JScrollPane.

Quote:

Your fiddlings perhaps require some repainting elsewhere?

I presume the code handling the JScrollPane should handle
the repainting of any componenets inside itself.

Quote:

Are you tying up the Swing thread?

What do you mean tying the thread?

Quote:

Are you poking Swing components with the wrong thread?

My application doesn't not use thread.

Quote:

Without code it is hard to tell what the matter could be.

CODE:

This shows how I put a graph object inside an japplet inside a
jscrollpane inside a jframe. And I get a glasspane from the japplet for
painting purpose.

dummy_container = new JApplet(); //Need to put graph into a dummy
applet to get a glasspane. So that can draw custom tooltip onto this
glasspane.
dummy_container.getContentPane().add(graph); //Put jgraph inside an
applet in order to get a glasspane to draw custom tooltip
glasspane = (JPanel) dummy_container.getGlassPane();
glasspane.setVisible(true);
glasspane.setLayout(null);
scrollpane = new JScrollPane(new JPanel().add(dummy_container));

scrollpane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);

scrollpane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
main_pane.add(scrollpane, BorderLayout.CENTER);

I know using a dummy japplet in order to get a glasspane is not very
clean. :)

Anthony

Quote:

--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.


Back to top
Roedy Green
Guest





PostPosted: Fri Sep 30, 2005 6:20 am    Post subject: Re: Problem with glasspane on JScrollPane Reply with quote

On 29 Sep 2005 21:52:20 -0700, "Anthony Mak" <anthony.mak (AT) iname (DOT) com>
wrote or quoted :

Quote:
Are you tying up the Swing thread?

What do you mean tying the thread?

see http://mindprod.com/jgloss/thread.html
http://mindprod.com/jgloss/threadsafe.html
http://mindprod.com/jgloss/swing.html

Basically there two errors can make that will tie up the Swing thread
so it can't attend to painting, events, keystrokes etc.

1. sleep

2. do some lengthy task in an event handler. Instead spin it off as
its own Thread, being careful to poke any Swing components via
invokeLater on your new thread. see SwingWorker in the Thread entry to
do that neatly.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.

Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java GUI Toolkits All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.