![]() |
|
|
|
#1 |
|
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 |
|
|
|
|
#2 |
|
Posts: n/a
|
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 |
|
|
|
#3 |
|
Posts: n/a
|
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 |
|
|
|
#4 |
|
Posts: n/a
|
I found the solution.
Anabolik |
|
|
|
#5 |
|
Posts: n/a
|
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 |
|
|
|
#6 |
|
Posts: n/a
|
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 |
|
|
|
#7 |
|
Posts: n/a
|
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 |
|
|
|
#8 |
|
Posts: n/a
|
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 |
|
|
|
#9 |
|
Posts: n/a
|
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 |
|
|
|
#10 |
|
Posts: n/a
|
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 |
|
![]() |
| Thread Tools | Search this Thread |
|
|
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 |