?
Solved

Flashing application in taskbar

Posted on 2006-07-17
19
Medium Priority
?
1,208 Views
Last Modified: 2011-10-03
I don't really know how to explain this... When you're MSN is minimised and you get a new message, the MSN window flashes in the main app and in the taskbar at the bottom of the screen.

Does anybody know how to do this for a java app? It will be triggered by a dialog that opens which is triggered by a change in the database, and this same dialog will trigger an event to stop flashing, So there is no problem with that part of it.

Thanks
0
Comment
Question by:riaancornelius
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 3
  • 3
  • +5
19 Comments
 
LVL 1

Expert Comment

by:sree032397
ID: 17128166
You can achieve it programmatically.
create a new field in database called status, By default it should be false

Then in your program create a thread. In thread continuously check(using while(true)) for databse for false in status. If you got it then process it and make it true. But dont forget to give a delay(5 seconds prefered using Thread.sleep(5000) ). This is to prevet crashing of database(Since connecting continuously may crash it)

Hope it works Since I am useing this technique now.
0
 
LVL 9

Author Comment

by:riaancornelius
ID: 17128244
You misunderstood. I already have a dialog which opens when the db field changes. This is not the problem. The problem is with the actual flashing of the window. I have no idea how to do it. Is there some library that will enable me to do it - I know it needs to be native code, but I'm not writing it :)
0
 
LVL 35

Expert Comment

by:girionis
ID: 17128311
Hi riaancornelius

what version of java are you using? In Mustang there is a default library to do it: http://java.sun.com/developer/technicalArticles/J2SE/Desktop/mustang/systemtray/ and http://www.devx.com/Java/Article/30861/0/page/4. If you are using an earlier version you need something like the following: http://systray.sourceforge.net/, or maybe this is a good start: http://today.java.net/pub/a/today/2003/12/08/swing.html (go to the section "Native User Alerts for Windows").

Cheers
0
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 
LVL 9

Author Comment

by:riaancornelius
ID: 17128369
Thanks girionis, will have a look at those links later. We're sticking with Tiger for the moment.
0
 
LVL 2

Expert Comment

by:frube
ID: 17128475
Hi, if you only plan on using this feature on the windows platform there is a much simpler answer, (I'm only assuming this based on you mentioning the MSN program.) Using the toFront() method calls the Win32 SetWindowPos and SetForegroundWindow APIs. SetForegroundWindow will flash the taskbar if the calling application is not the foreground app. Calling toFront() on other platforms will not have the desired effect.

Hope this helps.
0
 
LVL 9

Author Comment

by:riaancornelius
ID: 17128599
Thanks frube, I'll have a look at that. You are correct about it being only on windows platform.
0
 
LVL 1

Expert Comment

by:pthorson
ID: 17133279
Yes toFront has this effect for apps that are not in the foreground. The functionality is slightly different based on the version of Java and Windows. You should only need to call it once. The flashing is on the windows side of things so I don't think it will stop until the user brings the app to front. In an app we were calling toFront in a loop. After a minor windows update, this prevented the user from doing anything else so we modified it to only call toFront once.
0
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 17135866
0
 
LVL 9

Author Comment

by:riaancornelius
ID: 17136082
Ajay-Singh, that's only for non commercial use. Afraid I can't use it.
0
 
LVL 1

Expert Comment

by:Trooper80
ID: 17139414
If you can't wait for J2SE 6.0 and you know a bit of C++ then try JNI yourself
http://www.javaworld.com/javaworld/jw-10-1999/jw-10-jni.html
0
 
LVL 9

Author Comment

by:riaancornelius
ID: 17144026
>> what version of java are you using? In Mustang there is a default library to do it: http://java.sun.com/developer/technicalArticles/J2SE/Desktop/mustang/systemtray/ and http://www.devx.com/Java/Article/30861/0/page/4.

Mustang seems awesome, but we can't risk using it until final release. The product I need this for is a commercial app of about 500 000 lines which is distributed to thousands of users all around the world.

>> If you are using an earlier version you need something like the following: http://systray.sourceforge.net/,
That will only let you do menu's in systray.

>> or maybe this is a good start: http://today.java.net/pub/a/today/2003/12/08/swing.html (go to the section "Native User Alerts for Windows").
>> If you can't wait for J2SE 6.0 and you know a bit of C++ then try JNI yourself
http://www.javaworld.com/javaworld/jw-10-1999/jw-10-jni.html
Err, no. I'm not going down that road again... Me and JNI is not friends...
0
 
LVL 35

Expert Comment

by:girionis
ID: 17144061
> Err, no. I'm not going down that road again... Me and JNI is not friends...

I am afraid there is no other way to do it then, in the current versions of JDK.
0
 
LVL 30

Accepted Solution

by:
Mayank S earned 2000 total points
ID: 17144085
If you don't like JNI that much you can try to use JNI wrapper which will abstract some of the JNI intricacies from you:

http://www.jniwrapper.com
0
 
LVL 9

Author Comment

by:riaancornelius
ID: 17144125
mayankeagle, Do you know if there's anything in there that can do the flashing of the window. I'm sure winpack must have something?
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 17144145
No, sorry never tried flashing of the window using it but you can definitely use it wherever JNI is applicable :)
0
 
LVL 35

Expert Comment

by:girionis
ID: 17144224
Winpack does have some tray icon windows applications, have a look here: http://www.jniwrapper.com/jniwrapper_downloads/demo/winpackdemo.jnlp for a webstart demo. But even if you find something liek this you will need a licence to use it.
0
 
LVL 9

Author Comment

by:riaancornelius
ID: 17144396
>> Winpack does have some tray icon windows applications, have a look here: http://www.jniwrapper.com/jniwrapper_downloads/demo/winpackdemo.jnlp for a webstart demo.
I say that. Looks pretty usefull.
>> But even if you find something liek this you will need a licence to use it.
Turns out we actually have a license for that, so no prob :)
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 17144507
That sounds great, JNI wrapper is anyway worth a buy I would say :)
0
 
LVL 9

Author Comment

by:riaancornelius
ID: 17144604
Looking at it, I have to agree with you :)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month12 days, 14 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question