The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

This topic is READ ONLY
import-bot (20211) [Avatar] Offline
#1
[Originally posted by manis]

> That didn't work? Can you post your BusyPane implementation so we can take a
> look?
public class BusyGlassPanel extends com.sun.java.swing.JPanel implements
java.awt.event.MouseListener {
}
public BusyGlassPanel() {
super();
this.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));


this.setVisible(true);

}


Then the above BusyGlassPanel is used as follows :-
if (busy)
{
BusyGlassPanel aBusyPane = new BusyGlassPanel();
java.awt.Component aDefaultGP =
((TimeEntryApplet)getParentApplet)).getGlassPane();
((TimeEntryApplet)getParentApplet()).setMyDefaultGlassPane(aDefaultGP);
((TimeEntryApplet)getParentApplet()).setGlassPane(aBusyPane);
System.out.println ("Setting Busy Cursor on Applet");
}
else
{
java.awt.Component aDefaultGP = ((TimeEntryApplet)
getParentApplet)).getMyDefaultGlassPane();
((TimeEntryApplet)getParentApplet()).setGlassPane(aDefaultGP);
System.out.println ("Setting Free Cursor on Applet");
}
Thanks again. Matt
import-bot (20211) [Avatar] Offline
#2
SUCCESS!: Follow-up Busy Cursor - GlassPane code frag.
[Originally posted by manis]

Thanks Matt. I experimented with glasspane and by trying not to create
a new one but using the applets existing glasspane and that seems to work.
Let me know if this is fool-proof to a good degree :-

java.awt.Component aDefaultGP =
((TimeEntryApplet)getParentApplet)).getGlassPane();
if (aDefaultGP != null)
{
aDefaultGP.addMouseListener( new java.awt.event.MouseAdapter() { } );
aDefaultGP.setCursor
(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
aDefaultGP.setVisible(true);
}
else
{
aDefaultGP.setCursor
(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
aDefaultGP.setVisible(false);
}
import-bot (20211) [Avatar] Offline
#3
SUCCESS!: Follow-up Busy Cursor - GlassPane code frag.
[Originally posted by matt]

The first part is ok... but you should remove your else { } block.
If aDefaultGP is null, then there will be a null pointer exception
(although you probably haven't ran into this yet because you would
have to set it to null explicitly in order for this to happen).
..glad it works for you now though!