
Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
Thanks for the quick reply, Roedy.
> 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.
> Your fiddlings perhaps require some repainting elsewhere?
I presume the code handling the JScrollPane should handle
the repainting of any componenets inside itself.
> Are you tying up the Swing thread?
What do you mean tying the thread?
> Are you poking Swing components with the wrong thread?
My application doesn't not use thread.
> 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
> --
> Canadian Mind Products, Roedy Green.
> http://mindprod.com Again taking new Java programming contracts.
Roedy Green - 30 Sep 2005 07:20 GMT
>> 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.

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