private void createGUI() {
    optionsPanel = new FlowPanel();
    optionsPanel.setStyleName("algebraOptions");
    lblShow = new Label();
    lblShow.addStyleName("panelTitle");
    showAuxiliaryObjects = new CheckBox();
    showAuxiliaryObjects.addClickHandler(this);
    lblSortMode = new Label();
    lblSortMode.addStyleName("panelTitle");
    lblDescriptionMode = new Label();
    lblDescriptionMode.addStyleName("panelTitle");
    sortMode = new ListBox();
    description = new ListBox();

    optionsPanel.add(lblShow);
    optionsPanel.add(LayoutUtil.panelRowIndent(showAuxiliaryObjects));
    optionsPanel.add(lblSortMode);
    optionsPanel.add(LayoutUtil.panelRowIndent(sortMode));
    optionsPanel.add(lblDescriptionMode);
    optionsPanel.add(LayoutUtil.panelRowIndent(description));
    sortMode.addChangeHandler(this);
    description.addChangeHandler(
        new ChangeHandler() {

          public void onChange(ChangeEvent event) {
            app.getKernel().setAlgebraStyle(description.getSelectedIndex());
            app.getKernel().updateConstruction();
          }
        });
    // updateSortMode(); done by setLabels
    // updateDescription(); done by set labels
    setLabels();
  }
  public void updateScatterPlot() {
    if (!daModel.isRegressionMode()) {
      return;
    }
    metaPlotPanel.clear();
    plotPanelNorth.clear();
    plotPanelSouth.clear();

    plotPanelSouth.add(LayoutUtil.panelRow(lblTitleX, fldTitleX));
    plotPanelNorth.add(LayoutUtil.panelRow(lblTitleY, fldTitleY));

    metaPlotPanel.add(plotPanelNorth);
    metaPlotPanel.add(plotPanel.getComponent());
    metaPlotPanel.add(plotPanelSouth);
  }
  /** Creates a control panel to adjust the stem plot */
  private void createStemPlotAdjustmentPanel() {

    lblAdjust = new Label();
    minus = new MyToggleButton2("-1");
    none = new MyToggleButton2("0");
    plus = new MyToggleButton2("+1");

    minus.addClickHandler(
        new ClickHandler() {

          public void onClick(ClickEvent event) {
            actionPerformed(minus);
          }
        });

    none.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            actionPerformed(none);
          }
        });

    plus.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            actionPerformed(plus);
          }
        });

    none.setValue(true);

    stemAdjustPanel = new FlowPanel();
    stemAdjustPanel.add(LayoutUtil.panelRow(minus, none, plus));
  }
  /** Creates a control panel for manually setting classes */
  private void createManualClassesPanel() {

    lblStart = new Label();
    lblWidth = new Label();

    fldStart = new AutoCompleteTextFieldW(4, app);
    fldStart.setText("" + (int) getModel().getSettings().getClassStart());

    fldWidth = new AutoCompleteTextFieldW(4, app);
    fldStart.setColumns(4);
    fldWidth.setColumns(4);
    fldWidth.setText("" + (int) getModel().getSettings().getClassWidth());

    manualClassesPanel = new FlowPanel();
    manualClassesPanel.add(LayoutUtil.panelRow(lblStart, fldStart, lblWidth, fldWidth));
    fldStart.addBlurHandler(
        new BlurHandler() {

          public void onBlur(BlurEvent event) {
            actionPerformed(fldStart);
          }
        });

    fldStart.addKeyHandler(
        new KeyHandler() {

          public void keyReleased(KeyEvent e) {
            if (e.isEnterKey()) {
              actionPerformed(fldStart);
            }
          }
        });

    fldWidth.addBlurHandler(
        new BlurHandler() {

          public void onBlur(BlurEvent event) {
            actionPerformed(fldWidth);
          }
        });

    fldWidth.addKeyHandler(
        new KeyHandler() {

          public void keyReleased(KeyEvent e) {
            if (e.isEnterKey()) {
              actionPerformed(fldWidth);
            }
          }
        });
  }
  private void createGUI() {
    oldWidth = 0;
    oldHeight = 0;
    // create options button
    btnOptions =
        new MyToggleButton2(
            new NoDragImage(
                AppResources.INSTANCE.inputhelp_left_18x18().getSafeUri().asString(), 18));

    btnOptions.addClickHandler(
        new ClickHandler() {

          public void onClick(ClickEvent event) {
            actionPerformed(btnOptions);
          }
        });

    // create export button
    btnExport = new MenuBar();

    // create control panel
    if (hasControlPanel) {

      // create sub-control panels
      createDisplayTypeComboBox();
      createNumClassesPanel();
      createManualClassesPanel();
      createStemPlotAdjustmentPanel();
      FlowPanel emptyControl = new FlowPanel();
      emptyControl.add(new Label("  "));

      // put sub-control panels into a deck panel
      controlDecks = new DeckPanel();
      controlDecks.add(numClassesPanel);
      controlDecks.add(manualClassesPanel);
      controlDecks.add(stemAdjustPanel);
      controlDecks.add(emptyControl);

      FlowPanel buttonPanel = new FlowPanel();
      buttonPanel.setStyleName("daOptionButtons");
      buttonPanel.add(LayoutUtil.panelRow(btnOptions, btnExport));

      // control panel
      controlPanel = new FlowPanel();
      controlPanel.add(LayoutUtil.panelRow(lbDisplayType, controlDecks, buttonPanel));
    }

    createExportToEvAction();
    plotPanel = new PlotPanelEuclidianViewW(app.getKernel(), exportToEVAction);

    //		plotPanel.setPreferredSize(PLOTPANEL_WIDTH, PLOTPANEL_HEIGHT);
    //		plotPanel.updateSize();
    plotPanelNorth = new FlowPanel();
    plotPanelSouth = new FlowPanel();
    GColor bgColor = plotPanel.getBackgroundCommon();

    lblTitleX = new Label();
    lblTitleY = new Label();

    fldTitleX = (new InputPanelW(null, app, -1, false)).getTextComponent();
    fldTitleY = (new InputPanelW(null, app, -1, false)).getTextComponent();

    fldTitleX.setEditable(false);
    fldTitleY.setEditable(false);

    metaPlotPanel = new FlowPanel();
    metaPlotPanel.setStyleName("daDotPanel");
    metaPlotPanel.add(plotPanel.getComponent());

    createImagePanel();

    // put display panels into a deck panel

    displayDeckPanel = new DeckPanel();

    displayDeckPanel.add(metaPlotPanel);
    displayDeckPanel.add(new ScrollPanel(imagePanel));

    // create options panel
    optionsPanel = new OptionsPanelW(app, daModel, getModel());
    optionsPanel.setVisible(false);

    frequencyTable = new FrequencyTablePanelW(app);

    spFrequencyTable = new ScrollPanel();
    spFrequencyTable.add(frequencyTable);
    spFrequencyTable.setStyleName("spFrequencyTable");

    // =======================================
    // put all the panels together

    mainPanel = new FlowPanel();
    mainPanel.setStyleName("dataDisplayMain");
    if (hasControlPanel) {
      mainPanel.add(controlPanel);
    }
    mainPanel.add(LayoutUtil.panelRow(displayDeckPanel, optionsPanel));

    add(mainPanel);
    createExportMenu();
    resize();
  }