Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Flashing application in taskbar

Posted on 2006-07-17
19
Medium Priority
?
1,218 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses

610 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