I have an application which shows a window. Instead of closing window when user presses on "Close" button I want just to hide this window, how can I do this?
Here is my code (it does not work, the app is closed on click):
  object UxMonitor {
  def main(args: Array[String]) {
    val frame = new MainScreen()
    frame.peer.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE)
    initTrayIcon(frame.peer)
  }
....
class MainScreen extends MainFrame {
      private val HEADERS = Array[Object]("Security", "Last Price", "Amount", "Cost")
      private val quotes = new Quotes()
      private val tableModel = new DefaultTableModel()
      title = "UX Monitor"
      tableModel.setColumnIdentifiers(HEADERS)
      private val table = new Table {
        model = tableModel
      }
      contents = new ScrollPane {
        contents = table
      }
      quotes.setListener(onQuotesUpdated)
      quotes.startUpdating
      peer.addWindowListener(new WindowAdapter{
        def windowClosing(e : WindowEvent){
            self.setVisible(false)
        }
      })
      pack
 
    