FAQ
Cover
\
Build
\
Source
\
Bugs
\
Reference
\
Libraries
\
Tools
The bugs database has moved
here
.
Bug 1558 : Lost cursor()
Last modified: 2010-05-07 08:24
P
roject:
processing
trash
Version:
unspecified
Co
m
ponent:
android
book
core
libraries
pde
reference
tools
web
Status:
RESOLVED
Resolution:
INVALID -
Pr
i
ority:
P2
Severity:
normal
Platform
All
O
S:
All
Windows
Mac OS
Linux
Other
Reporter:
jeffg
Assigned To:
fry
Attachment
Type
Created
Size
Actions
Description
: Opened: 2010-05-06 16:14
When I invokelater for a jfilechooser, I loose the ability to control the
cursor. I know swing is not supported, but I thought I would let you know
about this. Maybe it's something you can set a listener for or something.
It drives me crazy. ;-)
Originally posted in the forum, verified by PhiLho.
http://processing.org/discourse/yabb2/YaBB.pl?num=1270312442/0
//Processing Version 1.1
//OSX 10.6.3 (Also tested on XP)
import javax.swing.JFileChooser;
final JFileChooser fc = new JFileChooser();
void draw() {
cursor(WAIT);
}
void mouseClicked() {
if (mouseEvent.getClickCount() == 2) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
try{
int returnVal = fc.showOpenDialog(null);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File[] openfiles = fc.getSelectedFiles();
}
}
catch(Exception e) {
javax.swing.JOptionPane.showMessageDialog(null, e);
}
}
});
}
}
Additional Comment
#1 From jeffg 2010-05-06 17:50
Figured it out...
Basically, if you create a JDialog (e.g. using JOptionPane.showMessage())
without a non-null, visible parent, then your custom cursors will not be
respected. You must have a non-null, visible parent for the dialog.
So I just replaced "null" with "frame".
import javax.swing.JFileChooser;
final JFileChooser fc = new JFileChooser();
void draw() {
cursor(WAIT);
}
void mouseClicked() {
if (mouseEvent.getClickCount() == 2) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
try{
int returnVal = fc.showOpenDialog(frame); //Note the Frame Here
if (returnVal == JFileChooser.APPROVE_OPTION) {
File[] openfiles = fc.getSelectedFiles();
}
}
catch(Exception e) {
javax.swing.JOptionPane.showMessageDialog(null, e);
}
}
});
}
}
Additional Comment
#2 From fry 2010-05-07 07:49
how is this a processing bug? am i missing something?
Additional Comment
#3 From jeffg 2010-05-07 08:04
Nope.. it's not.. but I didn't know how to close the bug after I realized
the error. Sorry
(In reply to
comment #2
)
>
>
>
> Additional
Comment #2
From
> fry
> 2010-05-07 07:49
>
> <!--
> addReplyLink(2); //-->[reply]
>
>
>
>
>
>
> how is this a processing bug? am i missing something?
>
>
Additional Comment
#4 From fry 2010-05-07 08:05
gotcha, thanks.
and why not just use selectInput()?
Additional Comment
#5 From jeffg 2010-05-07 08:24
Doesn't support selecting multiple files.