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 ian]


Hi,

Realy simple question; I checked what looks like the killer Swing book on
spinzine and can't find (my stupidity) anything about mouse cursors and
control. We need to change the cursor style and also disable the moust 'click'
events from being parsed to a swing application. Bit like the hour glass
wait-till-the-systems-ready thing we are used to.

Thanks again.
import-bot (20211) [Avatar] Offline
#2
Re: Mouse Cursors and Hourglass's
[Originally posted by matt]

Well, we don't explicitly cover cursor usage
in our book (although we definitely should in
a future edition)... but what you need to do is
set up a JPanel that implements MouseListener
with empty bodied methods. In the constructor
for this panel, set the cursor to the hourglass
cursor. Then, when you want your app to be in
hourglass mode and no mouse clicks to be captured,
use this panel as your glassPane. Assuming you
are using a JFrame, call setGlassPane(yourPanel).
When you want to get out of this waiting mode,
call setGlassPane(null)...

Chapter 15 at http://www.spindoczine.com/sbe
shows how to do this with our custom internal
frame component. Also see 'Call 911' at the
Swing Connection.