title: how to add listener to java dock icon on osx
body: <p>i have in my applications jframe Hide on close, but when i click the dock icon, i want it
  to setVisible(true);
  how do i add an action listener to the dock icon?
  i tried </p>
  
  <pre><code>Image im = Toolkit.getDefaultToolkit().getImage(this.getClass().getResource("SLogo.png"));
  final TrayIcon tri = new TrayIcon(im);
  tri.addActionListener(this);
  
  @Override
  public void actionPerformed(ActionEvent ae) {
       this.setVisible(true);
       System.out.print("ok");
  
  }
  </code></pre>
  
  <p>but its not triggered,
  and also, how will it affect the app on windows machine?</p>