File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes JFrame blink with JNA Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JFrame blink with JNA" Watch "JFrame blink with JNA" New topic
Author

JFrame blink with JNA

Rodrigo Cabrera Pliego
Greenhorn

Joined: Feb 19, 2013
Posts: 2
Hi everyone, here is my question!.
I'm trying to make a java chat from some big company blah blah, i have all the chat working great, the big problem is that when some one gets a new message i want the jframe to blink like msn,
Ok I now what you're going to say, why don't you use toFront() method it does the work for you etc,
I've allready done that, and yes it works, for some Windows distribution, yes i hear about jniwrapper, and i allready use it, and work great, but is a problem for the company to buy the license, and the boss is like no you do it... so i use JNA and i have done this:
Interface User32:


Class Flasher2.java


and the jframe trying to blink!



The result i get is:
User32$FLASHWINFO$PFLASHWINFO(allocated@0x8a60d8 (20 bytes))
{ int cbSize@0=1f4
WinNT$HANDLE hWnd@4=native@0xde0232
int dwFlags@8=3
int uCount@c=64
int dwTimeout@10=fa }
Rats! It failed!


PLEAASSEEEEE HELP!!
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
if you just want the frame to 'flash' have you thought about using a swing timer
to change the frame.rootPane's border between normal and (say) a wide red.
a new message starts the timer.

just tested it - certainly looks like it's flashing (I don't use msn, so cannot compare)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: JFrame blink with JNA