Beispiel #1
0
  /**
   * Displays the applications window and starts service tracking; everything is done on the Swing
   * event thread to avoid synchronization and repainting issues.
   *
   * @param context The context of the bundle.
   */
  public void start(final BundleContext context) {
    javax.swing.SwingUtilities.invokeLater(
        new Runnable() {
          // This creates of the application window.
          public void run() {
            m_frame = new DrawingFrame();
            m_frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
            m_frame.addWindowListener(
                new WindowAdapter() {
                  public void windowClosing(WindowEvent evt) {
                    try {
                      context.getBundle(0).stop();
                    } catch (BundleException ex) {
                      ex.printStackTrace();
                    }
                  }
                });

            m_frame.setVisible(true);

            m_shapetracker = new ShapeTracker(context, m_frame);
            m_shapetracker.open();
          }
        });
  }