Model JDialog setting wait cursor
In my Model JDialog when the cursor is wait cursor and when the mouse is moved out of the JDialog and came back in the cursor is different i.e the Default cursor.
I tried using the mouse enter event but doesn't seem to work. What else can I try? help me with an example. thanks.
Check out this recent article: http://www.javaspecialists.co.za/archive/Issue075.html
Similar Messages
-
Set wait Cursor allows cursor to Clicon on Button ?
Sometimes when i set my cursor to wait cursor still it allows me to click on Components Like JButton or Tree node 7 sometime it works perfectly (it doesn't allow to click which i am expecting)
I can assure you that it has nothing to do with you setting the wait cursor; you are only setting the graphic, it doesn't change the way your application behaves on mouse clicks. More likely is that "sometimes":
1) your application is doing a lot of work
2) it is doing this work on the Swing EDT
3) and such your application is unresponsive, giving you the idea that you cannot click buttons
If you want to prevent users from clicking buttons, you need to disable the buttons while you are doing whatever it is you are currently setting the wait cursor for. -
Wait Cursor issue in JFrame / JButton
Hi i am Creating some Archive which takes 2 to 3 min . I had set Wait Cursor
applet.getFrame().setCursor( new Cursor(Cursor.WAIT_CURSOR));
but after i Click Button (which shows Hand Cursor during Click) after that my wait Cursor is not shown.
The cursor remains as Hand Cursor??Following Code worked for Using JRE version 1.6.0_13 Java HotSpot(TM) Client VM
But not Fixed for 1.5.x or JRE version 1.6.0_10 Java HotSpot(TM) Client VM
Issue 1:
The hand Cursor still remain as it is.
myFrame.setWaitCursor();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
// business logic for Creating WAR (which takes around 5 min)
}Issue 2: When it takes take to create Archive , if we toggle different window 7 come back in my Application Window it shows Blank Window (or half Desktop Window / half my APplication title Window) till it doesnt creates WAR Generation. Is there some paint Issue ??
After my War is generated I am able to view my UI -
Wait cursors not set till end of AbstractAction.actionPerformed()
Hi.
Is there a problem setting the wait cursor in the actionPerformed method of Actions? I?m running Java 1.4.1_02.
I am finding that if I try and set a wait cursor in AbstractAction.actionPerformed() it never gets displayed until the very end of the method, which is a bit useless because this is usually when I want to set it back to the default cursor. The result is that I never see the wait cursor when I execute the action.
I don?t have the same problem with setting cursors in JComponent.actionPerformed().
Does anyone have a solution?
The following code fragment demonstrates the problem. It is from a class that extends the abstractAction class. It calls a method of my own to set the wait cursor ( on the root container and its child components ), then sleeps for a bit. The wait cursor is only shown after the sleep.
public void actionPerformed( java.awt.event.ActionEvent oActionEvent )
ESTrace.printMsg( ESTrace.LEVEL_3, "Start of ESAction_NEW.actionPerformed.");
ESValues.m_oUtils.setGlobalCursor( new Cursor( Cursor.WAIT_CURSOR ) );
ESTrace.printMsg( ESTrace.LEVEL_3, "ESAction_NEW.actionPerformed. Start Wait");
try
Thread oThread = Thread.currentThread();
oThread.sleep(15000);
catch(Exception e)
System.out.println("Wait exception");
e.printStackTrace();
ESTrace.printMsg( ESTrace.LEVEL_3, "End of ESAction_NEW.actionPerformed");If you set the Field 'Comb' value to show a specific number of characters, then you can use this in the Custom Format script:
if (event.target.comb) {
var l = event.value.length
var m = event.target.charLimit
var x = m - l
var s = ""
if (event.value != "") {
for (var i = 1; i < x; i++) { s = s + "." }
event.value = event.value + s
Note that this will space the characters out to fit the width of the field, and may not line up with other fields properly. Otherwise, without using a monospaced font, I don't know if there is a way for you to know how many periods are needed to fill out the field. -
Wait Cursor not showing while moving the Mouse
I have a JFrame application. In that JFrame i have a Jdialog (login screen). After entering user name and password, i am setting the Wait cursor (hour glass) for the JFrame and JDialog. When the mouse cursor is inside dialog, it is properly showing the wait cursor. I can able to move the mouse within dialog.
But When I move the mouse outside the dialog i.e inside JFrame, the wait cursor goes off. It shows default cursor. Even I have set the wait cursor to JFrame.
What may be the problems? If any body knows, please expaling.
Advance thanks for early reply.if any knows the solution, please post it.
-
After about 1 hour of use I am getting the "spinning wait cursor" in firefox when I do pretty much anything. Scrolling, link hovers, switching tabs, inspecting DOM tags in firebug, typing in textboxes, you name it. This only recently started happening on my MacPro, and has yet to rear its ugly head on my MacbookPro laptop. Not sure if its my RAM or something....regardless, basically makes firefox useless. In fact, im posting this question in Chrome.
Usually when firefox gets slow I run SQLite VACCUUM on the profile databases and it helps. This time, no dice. Basically just unusable.
Machine Specs:
OS X Version: 10.6.6
Model Name: Mac Pro
Model Identifier: MacPro1,1
Processor Name: Dual-Core Intel Xeon
Processor Speed: 2.66 GHz
Number Of Processors: 2
Total Number Of Cores: 4
L2 Cache (per processor): 4 MB
Memory: 11 GB
Bus Speed: 1.33 GHz
Memory Speed: 667 MHz DDR2 FB-DIMMAfter about 1 hour of use I am getting the "spinning wait cursor" in firefox when I do pretty much anything. Scrolling, link hovers, switching tabs, inspecting DOM tags in firebug, typing in textboxes, you name it. This only recently started happening on my MacPro, and has yet to rear its ugly head on my MacbookPro laptop. Not sure if its my RAM or something....regardless, basically makes firefox useless. In fact, im posting this question in Chrome.
Usually when firefox gets slow I run SQLite VACCUUM on the profile databases and it helps. This time, no dice. Basically just unusable.
Machine Specs:
OS X Version: 10.6.6
Model Name: Mac Pro
Model Identifier: MacPro1,1
Processor Name: Dual-Core Intel Xeon
Processor Speed: 2.66 GHz
Number Of Processors: 2
Total Number Of Cores: 4
L2 Cache (per processor): 4 MB
Memory: 11 GB
Bus Speed: 1.33 GHz
Memory Speed: 667 MHz DDR2 FB-DIMM -
Messages will open nothing appears(with wait cursor)
Since I upgraded to Mavericks, everytime i open Messages, it opens, and the top bar becomes Message settings but nothing appears and the wait cursor keeps turning forever so I have to force quit.
I have tried opening it from the applications folder and resetting keychain as i read in other threads but it still doesnt work.
I still get message notifications and the badge appears when i have a message. And the app and accounts are all working on my iphone.
I keep sending error report to apple every time i force quit but it seems not enough people have this issue...
Please help, it's bugging me so much.
Thank you.Hi,
Sending the reports is a silent thing and it may in fact be several Updates before anything makes it way to an update.
I would check two things first.
1) Open the Font Book from the Applications folder.
Top left set it to All Fonts if it is not already
Then use the Edit Menu > Look for Enabled Duplicates.
Follow this by checking the Helvetica and Lucida Grande are active (Some App will not launch if Helvetica is Off and Lucida Grande is used to display Buddy lists when they have groups active - you need the font before you open the app).
2) Open the Contacts App.
Use the Card Menu > Go to My Card
This should be your Card and show your details.
It should be marked with the Head and Shoulders icon.
If it is neither of these can you post the Log you are sending to Apple ?
If it is a Crash Log it may pay too be selective about how much you post.
We need to see the OS version number info at the top and the app info under that.
The info about the fault and the thread that crashed and those threads will help.
The Binary Images bit can be very long.
Limit this to the first 10 lines or so.
Messages and the Address Book should be listed near the top as involved items that have just been used by the app's processes.
8:52 pm Saturday; March 29, 2014
iMac 2.5Ghz i5 2011 (Mavericks 10.9)
G4/1GhzDual MDD (Leopard 10.5.8)
MacBookPro 2Gb (Snow Leopard 10.6.8)
Mac OS X (10.6.8),
Couple of iPhones and an iPad -
How do I reset the clock on a G4 that has a spinning wait cursor?
How do I reset the clock on a G4 that has a spinning wait cursor? Not sure of the OS, other than 10 something. This computer was initially set up to boot in either system 9 or 10, with 10 being the default. I just need it to run enough to get some old graphics files off if it. With the spinning cursor, I can't go into preferences to reset the clock. Suggestions?
If the machine can boot to either OS 9 or OS X, and each of those is installed on a separate volume (partition), then restart or boot the machine and immediately press the Option key, keep it held down. After a few moments (maybe up to a minute), Startup Manager will open - a bright blue screen with some icons on it. Click the icon representing the OS 9 install, then click the straight arrow on the right.
The machine should then boot into OS 9, and you may then be able to grab the files you need.
Note - if OS 9 and OS X are on the same volume, this won't work. -
Win32 SetCursor from other thread (Wait Cursor)
As soon as my application starts to decode a bitmap, i need to update two static text labels to show current progress. Updating them for every decoded pixel would be too overkill so I decided to make every update inside a timer every 150ms.
This obviously implies the use of a worker thread that leaves the main UI thread able to process WM_TIMER messages thus updating these two textlabels, and invalidate the possibility of just surrounding my work code in two SetCursor functions.
I googled a bit and found that handling WM_SETCURSOR could do the trick, and so I tested it this way :
case WM_SETCURSOR:
if (DecodingThreadRunning) SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_WAIT)));
else SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW)));
break;
Somehow the call gets executed with no errors but the cursor remain the same.
I also tried to surrond the working thread with the AttachThreadInput function but still no luck :
HWND hWnd = GetForegroundWindow();
DWORD foregroundThreadID = GetWindowThreadProcessId(hWnd, 0);
DWORD currentThreadID = GetCurrentThreadId();
AttachThreadInput(foregroundThreadID, currentThreadID, TRUE);
SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_WAIT)));
//Do the work
AttachThreadInput(foregroundThreadID, currentThreadID, FALSE);
Honestly I feel lost since i'm not even sure that the IDC_WAIT cursor was supposed to be used in this case, since the main GUI remains actually usable and stable (although few option gets disabled)
Thanks in advance for any help
PS: Running an update every nth pixel would not be as stable and fancy looking as the more accurate update of a timer
PPS: That's it I'm a retard. I forgot to return TRUE from WM_SETCURSOR.
I'll change the core of the question then : is the wait cursor supposed to be used in this case ? why attachthreadinput does not work ? Does it needs the thread to have a message queue ?Somehow the call gets executed with no errors but the cursor remain the same.
Set a breakpointer to check if SetCursor method is reached.
if (DecodingThreadRunning)
And how do you determine your thread is running? Do you use WaitForSingleObject method? We need some more information to reproduce this issue.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
File Filter with wait cursor/progress meter
Hi all:
In my application I'm doing some file filtering that not only looks at file extention, but also parses the file for information. As a result this can take quite a while if there are a lot of files to filter. Does anyone know if it's possible to change to a wait cursor during the filtering process? Or better yet, attach a progress meter to the filtering process?Correct, but Why, thank you, really ;-)
well, pass along a reference of the calling object to
the thread and have it provide a setBusy() and
setReady() method - that's what I did. I'd have the
FileFiltering thread provide a method
getCompletionRate() or sg like that and so the caller
can handle the progress meter.This all happens from within Sun's BasicDirectoryModel. I can't seem to find anyway to touch the thread from outside of the BasicDirectoryModel, and I can't seem to find a way to change the BasicDirectoryModel to a custom model of my own (One that would in the simple case put a wait cursor at the beginning of the filter loop, and normal cursor at the end) -
Changing wait cursor in netbeans.
Hi,
I'm having problems trying to change my cursor, I'm using netbeans and i want to change the cursor when a task is been doing.
I have a frameview and will show you the code. But i'm getting a error using setCursor().
I tried using a Jframe instead of a FrameView and this code works ok. Who knows why i can't use setCursor() with a FrameView?
Thanks for your help
public class ProgressBarDemo extends FrameView
private Task task;
class Task extends SwingWorker<Void, Void> {
@Override
public Void doInBackground() {
Random random = new Random();
int progress = 0;
//Initialize progress property.
setProgress(0);
while (progress < 100) {
//Sleep for up to one second.
try {
Thread.sleep(random.nextInt(1000));
} catch (InterruptedException ignore) {}
//Make random progress.
progress += random.nextInt(10);
setProgress(Math.min(progress, 100));
return null;
@Override
public void done() {
Toolkit.getDefaultToolkit().beep();
startButton.setEnabled(true);
setCursor(null); //turn off the wait cursor
taskOutput.append("Done!\n");
/** Creates new form ProgressBarDemo */
public ProgressBarDemo() {
initComponents();
private void startButtonActionPerformed(java.awt.event.ActionEvent evt) {
startButton.setEnabled(false);
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
//Instances of javax.swing.SwingWorker are not reusuable, so
//we create new instances as needed.
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new ProgressBarDemo().setVisible(true);
}So, you are talking about Swing application Framework???
It would certainly not work because 'FrameView' is neither a Frame, nor a Panel, etc. , I don't think NetBeans would allow you to compile such a code.
See you can use:
there is an '.........App' class,( for your case it may be ProgressBarDemoApp, but I doubt it), use its static method to obtain refrence to mainframe like this:
JFrame frm= ProgressBarDemoApp.getApplication().getMainFrame();
frm.setCursor(Cursor.WAIT_CURSOR);Another possibility is:
NetBeans make a default main panel in View named 'mainPanel', you can set its default cursor:
mainPanel.setCursor(Cursor.WAIT_CURSOR);hope it works............
Thanks! -
Automatic Wait Cursor -problems
I have implemented an automatic wait cursor "system" as decribed in Guide 1( http://www.roseindia.net/javatutorials/WaitCursorEventQueue.shtml)
The problem I have occurs at a specific moment:
- I have one Jframe opening another Jframe. This Jframe again (a customer registration form) displays a simple JOptionPane box. At the moment the JOptionPane box is displayed, the whole system goes down.
At all other times the wait cursor behaves exactly as intended.
Does anyone have:
- any experience with this (Guide 1) implementation of automatic wait cursor?
- any other experience with automatic wait cursors?
Regardsyes, i actually use a slightly modified version of that concept and it works very well...so far.
there is a known deadlock issue with it though which has been reported on many forums.
you can get easily around it though, without any implications as far as i can tell at least.
I have tried to reproduce your issue, but in the situation you describe i do not get any
problems. possibly you ran across the above deadlock problem?
the one thing i am not so sure about is that you call set/resetCursor not within the EDT.
however from the source of JComponent.setCursor() it looks as if the call would be done directly
on the native peer, so in theory it could be safe to do that call from within another thread.
Edited by: produggt on 20.08.2008 18:47 -
Wait Cursor inside SAP Business One
Hi All,
Just wanna know if there's a way to set my cursor to wait cursor (magnifying glass) without using a progress bar?
ThanksHello,
You can do only the wait cursor with the progressbar.
Regards
János -
Post Author: prashant
CA Forum: JAVA
I would like to display a wait cursor when report viewer is processing the report. I saw couple of post in .NET, but didnt find any solution in JAVA forum.
Does crystalreportviewer in java api has waitcursor property ?
Thanks in advance.
Regards,
PrashantPost Author: prashant
CA Forum: JAVA
Thanks Ted,
What I really want is to inform/show user some progress bar to indicate the report processing progress. As explained here http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2884297&SiteID=1 to set
When you start the report generation, set the Control.Cursor to the wait cursor:
reportViewer.Cursor = Cursors.WaitCursor;After the data is shown reset the cursor back to default: reportViewer.Cursor = Cursors.Default;
Is there anything in JRC that will be close to this functionality?
Thanks in advance.
Regards,
Prashant -
Wait cursor not working with short cut keys
Hi,
I have JButton in my application for which i have set the short cut key using
button.setMnemonic(char)
method of JButton. Also i have set the wait cursor for the same button using
button.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)) .
I am getting the wait cursor if i click on the button,but not when i use the shortcut key.
Why is it like that? Pls help me out.Why don't you use this class :
import java.awt.*;
import java.awt.event.*;
import javax.swing.SwingUtilities;
public class WaitCursorEventQueue extends EventQueue {
public WaitCursorEventQueue(int delay) {
this.delay = delay;
waitTimer = new WaitCursorTimer();
waitTimer.setDaemon(true);
waitTimer.start();
protected void dispatchEvent(AWTEvent event) {
waitTimer.startTimer(event.getSource());
try {
super.dispatchEvent(event);
finally {
waitTimer.stopTimer();
private int delay;
private WaitCursorTimer waitTimer;
private class WaitCursorTimer extends Thread {
synchronized void startTimer(Object source) {
this.source = source;
notify();
synchronized void stopTimer() {
if (parent == null)
interrupt();
else {
parent.setCursor(null);
parent = null;
public synchronized void run() {
while (true) {
try {
//wait for notification from startTimer()
wait();
//wait for event processing to reach the threshold, or
//interruption from stopTimer()
wait(delay);
if (source instanceof Component)
parent = SwingUtilities.getRoot((Component)source);
else if (source instanceof MenuComponent) {
MenuContainer mParent =
((MenuComponent)source).getParent();
if (mParent instanceof Component)
parent = SwingUtilities.getRoot(
(Component)mParent);
if (parent != null && parent.isShowing())
parent.setCursor(
Cursor.getPredefinedCursor(
Cursor.WAIT_CURSOR));
catch (InterruptedException ie) { }
private Object source;
private Component parent;
and then add to your application :
//Wait cursor
EventQueue waitQueue = new WaitCursorEventQueue(200);
Toolkit.getDefaultToolkit().getSystemEventQueue().push(waitQueue);
The number (200) specifies the milliseconds to activate the WaitCursor.
It will work anytime your app is busy for more than that time.
Maybe you are looking for
-
Unable to pass traffic between sites
I've read through dozens of posts and so far have had no luck getting any of the suggestions to work - combined with many of these posts being multiple years old...so I'm going to try posting something current and see if I get anywhere. Scenario: Sit
-
i cant use App store in my country Syria, and showing error 1004. kindly advice a solution?
-
Why can't I play videos? what's wrong?
I have windows vista home premium, using internet explorer, downloaded adobe flash player 11 activeX, am not getting any error messages, all tests say it's working properly, but can not play videos. I am not computer smart, and don't know what to do
-
Cisco 9201 Routing between interfaces
Done Thanks
-
I am trying to download photoshop 11 and cannot find the serial number on the package. There is a pn several bar codes and a scan to activate product but no serial number. I have looked at your help section for discovering the location of serial num