コード例 #1
0
ファイル: GuiUtility.java プロジェクト: dschachinger/colibri
  /**
   * This method starts the GUI.
   *
   * @throws CoapException Thrown, if the connection to obix via CoAP fails.
   */
  public void runGui() throws CoapException {
    this.lobby = obixChannel.getLobby(obixChannel.getLobbyUri());
    // Create and set up the window.
    mainFrame =
        new JFrame("ObixConnector at " + obixChannel.getBaseUri() + ": " + obixChannel.getPort());
    mainFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    mainFrame.setExtendedState(JFrame.MAXIMIZED_BOTH);
    mainFrame.setUndecorated(false);
    mainFrame.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent e) {
            close();
          }
        });

    Container contentPane = mainFrame.getContentPane();

    // Create and set up the content pane.
    this.addComponentToPane(contentPane);

    // Display the window.
    mainFrame.pack();
    executor.execute(updateThread);
    connector.addRunAndStopAble(updateThread);
    mainFrame.setVisible(true);
  }