• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

reduce display frame SystemTray

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello everybody ,
I'm worth SystemTray created a how to do when I click miminse the frame reduce next ticon SystemTray
and when I click 2 times on the icon SystemTray next to the window displayed the frame.
thank you in advance.
 
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To show anything in the system tray you'll need java.awt.SystemTray and java.awt.TrayIcon. Read their API pages for more information.

Minimizing to system tray is little more than first minimizing, then hiding the frame using setVisible(false). You can use a WindowListener to listen to minimize events (called iconify in Java), and use setExtendedState to minimize the frame from code.

Restoring on double clicking isn't that hard either. Add an ActionListener or MouseListener to the TrayIcon. If you use a MouseListener you can use MouseEvent.getClickCount() to notice if it's a double click or not.
You'll need to restore the frame from code. The process is again simple: first call setVisible(true), then use setExtendedState to remove the iconified state:
By using the current state and "removing" the iconified part your frame will get its previous state - maximized, normal, or whatever it had before.
 
Nouf Nassri
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Thank you for your response i used a PopupMenu [MenuItem("view") ] and I leave the window reduced to the task bar.

code:




but the problem is reduced the first window and another window appears all but empty fields
 
Rob Spoor
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should call these methods on a new frame but on your existing one.
 
Nouf Nassri
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you how i can do code:

frame1



SystemTrayTest





Class Main






 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic