Go Back   Velocity Reviews > Newsgroups > Java
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

Java - show JDialog every 30 seconds

 
Thread Tools Search this Thread
Old 11-04-2009, 09:19 AM   #1
Default show JDialog every 30 seconds


For JDialog it exists the function toFront. How to implement the logic
to show the JDialog in the front of desktop every 30 seconds?


Anabolik
  Reply With Quote
Old 11-04-2009, 10:38 AM   #2
RedGrittyBrick
 
Posts: n/a
Default Re: show JDialog every 30 seconds

Anabolik wrote:
> For JDialog it exists the function toFront. How to implement the logic
> to show the JDialog in the front of desktop every 30 seconds?


Maybe you could use a java.util.Timer.

This feature is likely to be very annoying for users isn't it? There are
more conventional and platform-specific means of drawing the user's
attention to applications that are awaiting their attention. In the case
of Windows that might be blinking the application's icon in the tool bar.

--
RGB


RedGrittyBrick
  Reply With Quote
Old 11-04-2009, 10:45 AM   #3
Anabolik
 
Posts: n/a
Default Re: show JDialog every 30 seconds
I made in Timer. Here the code:

int delay = 30000;
Timer timer = new Timer();
timer.schedule(new TimerTask() {
public void run() {
myDialog.toFront();
myDialog.repaint();}
}, delay);

but my dialog did not appear on the front of all windows.


Anabolik
  Reply With Quote
Old 11-04-2009, 12:48 PM   #4
Anabolik
 
Posts: n/a
Default Re: show JDialog every 30 seconds
I found the solution.


Anabolik
  Reply With Quote
Old 11-04-2009, 01:51 PM   #5
Lew
 
Posts: n/a
Default Re: show JDialog every 30 seconds
Anabolik wrote:
> I found the solution.


And thank you ever so much for sharing it with us instead of treating us like
your private, unpaid support staff.

This is a discussion group, not a help desk.

--
Lew


Lew
  Reply With Quote
Old 11-04-2009, 07:15 PM   #6
Jim Janney
 
Posts: n/a
Default Re: show JDialog every 30 seconds
Anabolik <> writes:

> I made in Timer. Here the code:
>
> int delay = 30000;
> Timer timer = new Timer();
> timer.schedule(new TimerTask() {
> public void run() {
> myDialog.toFront();
> myDialog.repaint();}
> }, delay);
>
> but my dialog did not appear on the front of all windows.


Your code is running on the wrong thread. See SwingUtilities.invokeLater.

--
Jim Janney


Jim Janney
  Reply With Quote
Old 11-04-2009, 07:46 PM   #7
Bent C Dalager
 
Posts: n/a
Default Re: show JDialog every 30 seconds
On 2009-11-04, Jim Janney <> wrote:
> Anabolik <> writes:
>
>> I made in Timer. Here the code:
>>
>> int delay = 30000;
>> Timer timer = new Timer();
>> timer.schedule(new TimerTask() {
>> public void run() {
>> myDialog.toFront();
>> myDialog.repaint();}
>> }, delay);
>>
>> but my dialog did not appear on the front of all windows.

>
> Your code is running on the wrong thread. See SwingUtilities.invokeLater.


Or use javax.swing.Timer instead of java.util.Timer.

Cheers,
Bent D
--
Bent Dalager - - http://www.pvv.org/~bcd
powered by emacs


Bent C Dalager
  Reply With Quote
Old 11-05-2009, 01:31 AM   #8
Knute Johnson
 
Posts: n/a
Default Re: show JDialog every 30 seconds
Jim Janney wrote:
> Anabolik <> writes:
>
>> I made in Timer. Here the code:
>>
>> int delay = 30000;
>> Timer timer = new Timer();
>> timer.schedule(new TimerTask() {
>> public void run() {
>> myDialog.toFront();
>> myDialog.repaint();}
>> }, delay);
>>
>> but my dialog did not appear on the front of all windows.

>
> Your code is running on the wrong thread. See SwingUtilities.invokeLater.
>


Probably not necessary. repaint() certainly not and toFront() is a
method of Window and probably doesn't need to be called on the EDT.

--

Knute Johnson
email s/nospam/knute2009/

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access


Knute Johnson
  Reply With Quote
Old 11-05-2009, 04:32 AM   #9
Lew
 
Posts: n/a
Default Re: show JDialog every 30 seconds
Knute Johnson wrote:
> Jim Janney wrote:
>> Anabolik <> writes:
>>
>>> I made in Timer. Here the code:
>>>
>>> int delay = 30000;
>>> Timer timer = new Timer();
>>> timer.schedule(new TimerTask() {
>>> public void run() {
>>> myDialog.toFront();
>>> myDialog.repaint();}
>>> }, delay);
>>>
>>> but my dialog did not appear on the front of all windows.

>>
>> Your code is running on the wrong thread. See
>> SwingUtilities.invokeLater.
>>

>
> Probably not necessary. repaint() certainly not and toFront() is a
> method of Window and probably doesn't need to be called on the EDT.


Why would it not need to be called on the EDT?

There isn't anything in the Javadocs to indicate that Window is thread safe.

--
Lew


Lew
  Reply With Quote
Old 11-05-2009, 04:47 AM   #10
Knute Johnson
 
Posts: n/a
Default Re: show JDialog every 30 seconds
Lew wrote:
> Knute Johnson wrote:
>> Jim Janney wrote:
>>> Anabolik <> writes:
>>>
>>>> I made in Timer. Here the code:
>>>>
>>>> int delay = 30000;
>>>> Timer timer = new Timer();
>>>> timer.schedule(new TimerTask() {
>>>> public void run() {
>>>> myDialog.toFront();
>>>> myDialog.repaint();}
>>>> }, delay);
>>>>
>>>> but my dialog did not appear on the front of all windows.
>>>
>>> Your code is running on the wrong thread. See
>>> SwingUtilities.invokeLater.
>>>

>>
>> Probably not necessary. repaint() certainly not and toFront() is a
>> method of Window and probably doesn't need to be called on the EDT.

>
> Why would it not need to be called on the EDT?
>
> There isn't anything in the Javadocs to indicate that Window is thread
> safe.
>


Window is an AWT component. No requirement to use the EDT on AWT
components that I know of.

--

Knute Johnson
email s/nospam/knute2009/

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access


Knute Johnson
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How To Turn On Your PC In Just 10 Seconds John Napzter Computer Support 9 12-07-2007 03:53 AM
heat sink fan comes on for 2 seconds, stops plaidthermos@hotmail.com Computer Information 5 08-06-2007 02:31 AM
CPU Usage spikes to 76 percent and freezes computer for 3 seconds Mike Computer Support 0 12-30-2006 06:11 AM
Lag every 60 seconds on wireless network dw5f7qz4@googlemail.com Computer Support 19 12-12-2006 05:18 PM
Core 2 Duo PC keeps shutting down itself after 2 seconds and booting up nonstop ss6nn1@googlemail.com Computer Support 19 08-16-2006 10:59 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46