public void setLabels() {

    // TODO --- finish set labels

    // tab titles
    tabbedPane.setTitleAt(0, app.getMenu("Properties.Basic"));
    tabbedPane.setTitleAt(1, app.getPlain("xAxis"));
    tabbedPane.setTitleAt(2, app.getPlain("yAxis"));
    tabbedPane.setTitleAt(3, app.getMenu("Grid"));

    // window dimension panel
    dimLabel[0].setText("X " + app.getPlain("min") + ":");
    dimLabel[1].setText("X " + app.getPlain("max") + ":");
    dimLabel[2].setText("Y " + app.getPlain("min") + ":");
    dimLabel[3].setText("Y " + app.getPlain("max") + ":");
    axesRatioLabel.setText(app.getPlain("xAxis") + " : " + app.getPlain("yAxis") + " = ");
    //	dimPanelTitle = "ttt";

    cbView.removeActionListener(this);
    cbView.removeAllItems();
    cbView.addItem(app.getPlain("DrawingPad"));
    cbView.addItem(app.getPlain("DrawingPad2"));
    cbView.removeActionListener(this);

    cbShowMouseCoords.setText(app.getMenu("ShowMouseCoordinates"));
  }
Exemplo n.º 2
0
  /**
   * Update the labels of this dialog.
   *
   * <p>TODO Create "Apply Defaults" phrase (F.S.)
   */
  public void setLabels() {
    setTitle(app.getPlain("Properties"));
    geoTree.root.setUserObject(app.getPlain("Objects"));

    delButton.setText(app.getPlain("Delete"));
    closeButton.setText(app.getMenu("Close"));
    defaultsButton.setText(app.getMenu("ApplyDefaults"));

    geoTree.setLabels();
    propPanel.setLabels();
  }
Exemplo n.º 3
0
  public EditMenu(Application app) {
    super(app, app.getMenu("Edit"));

    initActions();
    initItems();

    update();
  }
Exemplo n.º 4
0
  private void populateDataTable(ArrayList<GeoElement> dataArray) {

    if (dataArray == null || dataArray.size() < 1) {
      return;
    }

    TableModel dataModel = null;
    GeoPoint2 geo = null;
    String[] titles = statDialog.getDataTitles();

    switch (statDialog.getMode()) {
      case StatDialog.MODE_ONEVAR:
        dataModel = new DefaultTableModel(dataArray.size(), 1);
        for (int row = 0; row < dataArray.size(); ++row) {
          dataModel.setValueAt(dataArray.get(row).toDefinedValueString(), row, 0);
        }

        dataTable.setModel(dataModel);
        dataTable.getColumnModel().getColumn(0).setHeaderValue(titles[0]);

        updateSelectionList(dataArray);

        break;

      case StatDialog.MODE_REGRESSION:
        dataModel = new DefaultTableModel(dataArray.size(), 2);
        for (int row = 0; row < dataArray.size(); ++row) {
          dataModel.setValueAt(((GeoPoint2) (dataArray.get(row))).getInhomX(), row, 0);
          dataModel.setValueAt(((GeoPoint2) (dataArray.get(row))).getInhomY(), row, 1);
        }

        dataTable.setModel(dataModel);
        dataTable
            .getColumnModel()
            .getColumn(0)
            .setHeaderValue(app.getMenu("Column.X") + ": " + titles[0]);
        dataTable
            .getColumnModel()
            .getColumn(1)
            .setHeaderValue(app.getMenu("Column.Y") + ": " + titles[1]);

        updateSelectionList(dataArray);

        break;
    }
  }
Exemplo n.º 5
0
  /** Update the labels of the components (e.g. if the language changed). */
  public void setLabels() {
    setTitle(app.getMenu("Settings"));

    closeButton.setText(app.getMenu("Close"));
    saveButton.setText(app.getMenu("Settings.Save"));

    tabbedPane.setTitleAt(TAB_DEFAULTS, app.getPlain("Defaults"));
    tabbedPane.setTitleAt(TAB_EUCLIDIAN, app.getPlain("DrawingPad"));
    tabbedPane.setTitleAt(TAB_SPREADSHEET, app.getPlain("Spreadsheet"));
    tabbedPane.setTitleAt(TAB_CAS, app.getMenu("CAS"));
    tabbedPane.setTitleAt(TAB_ADVANCED, app.getMenu("Advanced"));

    euclidianPanel.setLabels();
    defaultsPanel.setLabels();
    spreadsheetPanel.setLabels();
    casPanel.setLabels();
    advancedPanel.setLabels();
  }
Exemplo n.º 6
0
  public void setPanel(int plotType) {

    this.plotType = plotType;
    tabbedPane.removeAll();
    String tabTitle = StatComboPanel.plotMap.get(plotType);
    tabbedPane.insertTab(tabTitle, null, new JScrollPane(mainPanel), null, 0);
    tabbedPane.addTab(app.getMenu("Graph"), new JScrollPane(graphPanel));
    showYSettings = true;

    switch (plotType) {
      case StatComboPanel.PLOT_HISTOGRAM:
        classesPanel.setVisible(true);
        histogramPanel.setVisible(true);
        graphPanel.setVisible(true);
        scatterplotPanel.setVisible(false);
        break;

      case StatComboPanel.PLOT_DOTPLOT:
      case StatComboPanel.PLOT_BOXPLOT:
      case StatComboPanel.PLOT_NORMALQUANTILE:
        tabbedPane.removeTabAt(0);
        showYSettings = true;
        classesPanel.setVisible(false);
        histogramPanel.setVisible(false);
        graphPanel.setVisible(true);
        scatterplotPanel.setVisible(false);
        break;

      case StatComboPanel.PLOT_SCATTERPLOT:
        showYSettings = true;
        classesPanel.setVisible(false);
        histogramPanel.setVisible(false);
        graphPanel.setVisible(true);
        scatterplotPanel.setVisible(true);
        break;

      case StatComboPanel.PLOT_RESIDUAL:
        tabbedPane.removeTabAt(0);
        showYSettings = true;
        classesPanel.setVisible(false);
        histogramPanel.setVisible(false);
        graphPanel.setVisible(true);
        scatterplotPanel.setVisible(false);
        break;
    }

    setLabels();
    updateGUI();
  }
Exemplo n.º 7
0
  public void updateRegressionPanel() {

    String[] columnLabels = {
      app.getMenu("Coefficient"),
      app.getMenu("StandardError.short"),
      app.getMenu("TStatistic"),
      app.getMenu("Pvalue"),
    };

    String[] rowLabels = {
      app.getMenu("Intercept"), app.getMenu("Slope"),
    };

    model.setColumnCount(0);
    for (int i = 0; i < columnLabels.length; i++) model.addColumn(columnLabels[i]);

    model.setRowCount(rowLabels.length);
    headerModel.setSize(0);
    for (int i = 0; i < rowLabels.length; i++) {
      headerModel.addElement(rowLabels[i]);
    }
  }
Exemplo n.º 8
0
  private void createGUI() {
    setTitle(textField ? app.getPlain("TextField") : app.getPlain("Button"));
    setResizable(false);

    // create caption panel
    JLabel captionLabel = new JLabel(app.getMenu("Button.Caption") + ":");
    String initString = button == null ? "" : button.getCaption();
    InputPanel ip = new InputPanel(initString, app, 1, 15, true);
    tfCaption = ip.getTextComponent();
    if (tfCaption instanceof AutoCompleteTextField) {
      AutoCompleteTextField atf = (AutoCompleteTextField) tfCaption;
      atf.setAutoComplete(false);
    }

    captionLabel.setLabelFor(tfCaption);
    JPanel captionPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    captionPanel.add(captionLabel);
    captionPanel.add(ip);

    // combo box to link GeoElement to TextField
    comboModel = new DefaultComboBoxModel();
    TreeSet sortedSet = app.getKernel().getConstruction().getGeoSetNameDescriptionOrder();

    final JComboBox cbAdd = new JComboBox(comboModel);

    if (textField) {
      // lists for combo boxes to select input and output objects
      // fill combobox models
      Iterator it = sortedSet.iterator();
      comboModel.addElement(null);
      FontMetrics fm = getFontMetrics(getFont());
      int width = (int) cbAdd.getPreferredSize().getWidth();
      while (it.hasNext()) {
        GeoElement geo = (GeoElement) it.next();
        if (!geo.isGeoImage() && !(geo.isGeoButton()) && !(geo.isGeoBoolean())) {
          comboModel.addElement(geo);
          String str = geo.toString();
          if (width < fm.stringWidth(str)) width = fm.stringWidth(str);
        }
      }

      // make sure it's not too wide (eg long GeoList)
      Dimension size =
          new Dimension(
              Math.min(app.getScreenSize().width / 2, width), cbAdd.getPreferredSize().height);
      cbAdd.setMaximumSize(size);
      cbAdd.setPreferredSize(size);

      if (comboModel.getSize() > 1) {

        // listener for the combobox
        MyComboBoxListener ac =
            new MyComboBoxListener() {
              public void doActionPerformed(Object source) {
                GeoElement geo = (GeoElement) cbAdd.getSelectedItem();
                // if (geo == null)
                // {
                //
                //	return;
                // }

                linkedGeo = geo;
                // ((GeoTextField)button).setLinkedGeo(geo);

                cbAdd.removeActionListener(this);

                // cbAdd.setSelectedItem(null);
                cbAdd.addActionListener(this);
              }
            };
        cbAdd.addActionListener(ac);
        cbAdd.addMouseListener(ac);

        captionPanel.add(cbAdd);
      }
    }

    // create script panel
    JLabel scriptLabel = new JLabel(app.getPlain("Script") + ":");
    initString = (button == null) ? "" : button.getClickScript();
    InputPanel ip2 = new InputPanel(initString, app, 10, 40, false);
    tfScript = ip2.getTextComponent();
    if (tfScript instanceof AutoCompleteTextField) {
      AutoCompleteTextField atf = (AutoCompleteTextField) tfScript;
      atf.setAutoComplete(false);
    }

    scriptLabel.setLabelFor(tfScript);
    JPanel scriptPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    scriptPanel.add(scriptLabel);
    scriptPanel.add(ip2);

    JPanel linkedPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    JLabel linkedLabel = new JLabel(app.getPlain("LinkedObject") + ":");
    linkedPanel.add(linkedLabel);
    linkedPanel.add(cbAdd);

    // buttons
    btApply = new JButton(app.getPlain("Apply"));
    btApply.setActionCommand("Apply");
    btApply.addActionListener(this);
    btCancel = new JButton(app.getPlain("Cancel"));
    btCancel.setActionCommand("Cancel");
    btCancel.addActionListener(this);
    btPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
    btPanel.add(btApply);
    btPanel.add(btCancel);

    // Create the JOptionPane.
    optionPane = new JPanel(new BorderLayout(5, 5));

    // create object list
    optionPane.add(captionPanel, BorderLayout.NORTH);
    if (textField) optionPane.add(linkedPanel, BorderLayout.CENTER);
    else optionPane.add(scriptPanel, BorderLayout.CENTER);
    optionPane.add(btPanel, BorderLayout.SOUTH);
    optionPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    // Make this dialog display it.
    setContentPane(optionPane);

    /*

    inputPanel = new InputPanel("ggbApplet.evalCommand('A=(3,4)');", app, 10, 50, false, true, false );
    inputPanel2 = new InputPanel("function func() {\n}", app, 10, 50, false, true, false );

    JPanel centerPanel = new JPanel(new BorderLayout());

    centerPanel.add(inputPanel, BorderLayout.CENTER);
    centerPanel.add(inputPanel2, BorderLayout.SOUTH);
    getContentPane().add(centerPanel, BorderLayout.CENTER);
    //centerOnScreen();

    setContentPane(centerPanel);
    pack();
    setLocationRelativeTo(app.getFrame());	*/
  }
  private JPanel buildGridPanel() {

    int hgap = 5;
    int vgap = 5;

    // ==================================================
    // create sub panels

    // -------------------------------------
    // show grid panel
    JPanel showGridPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, hgap, vgap));
    cbShowGrid = new JCheckBox(app.getPlain("Show") + " " + app.getMenu("Grid"));
    cbShowGrid.addActionListener(this);
    showGridPanel.add(cbShowGrid, BorderLayout.NORTH);

    // -------------------------------------
    // grid type panel

    JPanel typePanel = new JPanel(new FlowLayout(FlowLayout.LEFT, hgap, vgap));
    typePanel.setBorder(BorderFactory.createTitledBorder((app.getPlain("GridType"))));

    // type
    String[] gridTypeLabel = new String[3];
    gridTypeLabel[EuclidianView.GRID_CARTESIAN] = app.getMenu("Cartesian");
    gridTypeLabel[EuclidianView.GRID_ISOMETRIC] = app.getMenu("Isometric");
    gridTypeLabel[EuclidianView.GRID_POLAR] = app.getMenu("Polar");
    cbGridType = new JComboBox(gridTypeLabel);
    cbGridType.addActionListener(this);
    typePanel.add(cbGridType);

    // tick intervals
    JPanel tickPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, hgap, vgap));
    cbGridManualTick = new JCheckBox(app.getPlain("TickDistance") + ":");
    ncbGridTickX = new NumberComboBox(app);
    ncbGridTickY = new NumberComboBox(app);

    cbGridManualTick.addActionListener(this);
    ncbGridTickX.addItemListener(this);
    ncbGridTickY.addItemListener(this);

    // angleStep intervals for polar grid lines
    String PI_STRING = "\u03c0";
    String[] angleOptions = {
      PI_STRING + "/12", PI_STRING + "/6", PI_STRING + "/4", PI_STRING + "/3", PI_STRING + "/2",
    };

    cbGridTickAngle = new JComboBox(angleOptions);
    cbGridTickAngle.addItemListener(this);
    tickPanel.add(cbGridManualTick);

    gridLabel1 = new JLabel("x:");
    gridLabel1.setLabelFor(ncbGridTickX);
    tickPanel.add(gridLabel1);
    tickPanel.add(ncbGridTickX);

    gridLabel2 = new JLabel("y:");
    gridLabel2.setLabelFor(ncbGridTickY);
    tickPanel.add(gridLabel2);
    tickPanel.add(ncbGridTickY);

    gridLabel3 = new JLabel("\u0398" + ":"); // Theta
    gridLabel3.setLabelFor(cbGridTickAngle);
    tickPanel.add(gridLabel3);
    tickPanel.add(cbGridTickAngle);

    typePanel.add(tickPanel);

    // -------------------------------------
    // style panel
    JPanel stylePanel = new JPanel(new FlowLayout(FlowLayout.LEFT, hgap, vgap));
    stylePanel.setBorder(BorderFactory.createTitledBorder((app.getPlain("LineStyle"))));

    // line style
    DashListRenderer renderer = new DashListRenderer();
    renderer.setPreferredSize(new Dimension(130, app.getFontSize() + 6));
    cbGridStyle = new JComboBox(EuclidianView.getLineTypes());
    cbGridStyle.setRenderer(renderer);
    cbGridStyle.addActionListener(this);
    stylePanel.add(cbGridStyle);

    // color
    JLabel lblColor = new JLabel(app.getPlain("Color") + ":");
    lblColor.setLabelFor(btGridColor);
    // bold
    cbBoldGrid = new JCheckBox(app.getMenu("Bold"));
    cbBoldGrid.addActionListener(this);

    stylePanel.add(lblColor);
    stylePanel.add(btGridColor);
    stylePanel.add(cbBoldGrid);

    // ==================================================
    // create grid panel and add all the sub panels

    JPanel northPanel = new JPanel();
    northPanel.setLayout(new BoxLayout(northPanel, BoxLayout.Y_AXIS));
    northPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    northPanel.add(showGridPanel);
    northPanel.add(Box.createRigidArea(new Dimension(0, 16)));
    northPanel.add(typePanel);
    northPanel.add(Box.createRigidArea(new Dimension(0, 16)));
    northPanel.add(stylePanel);

    JPanel gridPanel = new JPanel(new BorderLayout());
    gridPanel.add(northPanel, BorderLayout.NORTH);

    return gridPanel;
  }
  private JPanel buildBasicPanel() {

    JLabel label;

    // ===================================
    // create sub panels

    // -------------------------------------
    // window dimensions panel

    dimLabel = new JLabel[4]; // "Xmin", "Xmax" etc.
    for (int i = 0; i < 4; i++) dimLabel[i] = new JLabel("");

    JPanel xDimPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 5));
    tfMinX = new MyTextField(app.getGuiManager(), 8);
    tfMaxX = new MyTextField(app.getGuiManager(), 8);
    tfMinX.addActionListener(this);
    tfMaxX.addActionListener(this);
    tfMinX.addFocusListener(this);
    tfMaxX.addFocusListener(this);

    xDimPanel.add(dimLabel[0]);
    xDimPanel.add(tfMinX);
    xDimPanel.add(dimLabel[1]);
    xDimPanel.add(tfMaxX);

    JPanel yDimPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 5));
    tfMinY = new MyTextField(app.getGuiManager(), 8);
    tfMaxY = new MyTextField(app.getGuiManager(), 8);
    tfMinY.addActionListener(this);
    tfMaxY.addActionListener(this);
    tfMinY.addFocusListener(this);
    tfMaxY.addFocusListener(this);

    yDimPanel.add(dimLabel[2]);
    yDimPanel.add(tfMinY);
    yDimPanel.add(dimLabel[3]);
    yDimPanel.add(tfMaxY);

    JPanel axesRatioPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 5));
    tfAxesRatioX = new MyTextField(app.getGuiManager(), 6);
    tfAxesRatioY = new MyTextField(app.getGuiManager(), 6);
    tfAxesRatioX.addActionListener(this);
    tfAxesRatioY.addActionListener(this);
    tfAxesRatioX.addFocusListener(this);
    tfAxesRatioY.addFocusListener(this);
    axesRatioLabel = new JLabel("");
    axesRatioPanel.add(axesRatioLabel);
    axesRatioPanel.add(tfAxesRatioX);
    axesRatioPanel.add(new JLabel(" : "));
    axesRatioPanel.add(tfAxesRatioY);

    dimPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 5));
    dimPanel.setLayout(new BoxLayout(dimPanel, BoxLayout.Y_AXIS));
    dimPanel.add(xDimPanel);
    dimPanel.add(yDimPanel);
    dimPanel.add(axesRatioPanel);
    dimPanel.setBorder(BorderFactory.createTitledBorder(app.getPlain("Dimensions")));

    // -------------------------------------
    // axes options panel
    JPanel axesOptionsPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 5));
    axesOptionsPanel.setBorder(BorderFactory.createTitledBorder(app.getMenu("Axes")));

    // show axes
    cbShowAxes = new JCheckBox(app.getMenu(app.getPlain("Show") + " " + "Axes"));
    axesOptionsPanel.add(cbShowAxes);
    axesOptionsPanel.add(Box.createRigidArea(new Dimension(10, 0)));

    // color
    label = new JLabel(app.getPlain("Color") + ":");
    label.setLabelFor(btAxesColor);
    axesOptionsPanel.add(label);
    axesOptionsPanel.add(btAxesColor);
    axesOptionsPanel.add(Box.createRigidArea(new Dimension(10, 0)));

    // axes style
    cbAxesStyle = new JComboBox();
    label = new JLabel(app.getPlain("LineStyle") + ":");
    label.setLabelFor(cbAxesStyle);
    cbAxesStyle.addItem("\u2014"); // line
    cbAxesStyle.addItem("\u2192"); // arrow
    cbAxesStyle.addItem("\u2014" + " " + app.getPlain("Bold")); // bold line
    cbAxesStyle.addItem("\u2192" + " " + app.getPlain("Bold")); // bold arrow
    cbAxesStyle.setEditable(false);
    axesOptionsPanel.add(label);
    axesOptionsPanel.add(cbAxesStyle);

    // -------------------------------------
    // background color panel
    JPanel bgPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 5));
    label = new JLabel(app.getPlain("BackgroundColor") + ":");
    bgPanel.add(label);
    bgPanel.add(btBackgroundColor);
    label.setLabelFor(btBackgroundColor);

    cbShowMouseCoords = new JCheckBox();
    cbShowMouseCoords.addActionListener(this);
    bgPanel.add(cbShowMouseCoords);

    // ==========================================
    // create basic panel and add all sub panels

    JPanel northPanel = new JPanel();
    northPanel.setLayout(new BoxLayout(northPanel, BoxLayout.Y_AXIS));
    northPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 2, 5));

    northPanel.add(dimPanel);
    northPanel.add(Box.createRigidArea(new Dimension(0, 16)));
    northPanel.add(axesOptionsPanel);
    northPanel.add(Box.createRigidArea(new Dimension(0, 16)));
    northPanel.add(bgPanel);

    // use a BorderLayout to keep sub panels together
    JPanel basicPanel = new JPanel(new BorderLayout());
    basicPanel.add(northPanel, BorderLayout.NORTH);

    return basicPanel;
  }
  public void keyPressed(KeyEvent e) {
    int keyCode = e.getKeyCode();

    // we don't want to trap AltGr
    // as it is used eg for entering {[}] is some locales
    // NB e.isAltGraphDown() doesn't work
    if (e.isAltDown() && e.isControlDown()) return;

    // swallow eg ctrl-a ctrl-b ctrl-p on Mac
    if (Application.MAC_OS && e.isControlDown()) e.consume();

    ctrlC = false;

    switch (keyCode) {
      case KeyEvent.VK_Z:
      case KeyEvent.VK_Y:
        if (Application.isControlDown(e)) {
          app.getGlobalKeyDispatcher().handleGeneralKeys(e);
          e.consume();
        }
        break;

      case KeyEvent.VK_0:
      case KeyEvent.VK_1:
      case KeyEvent.VK_2:
      case KeyEvent.VK_3:
      case KeyEvent.VK_4:
      case KeyEvent.VK_5:
      case KeyEvent.VK_6:
      case KeyEvent.VK_7:
      case KeyEvent.VK_8:
      case KeyEvent.VK_9:
        if (Application.isControlDown(e) && e.isShiftDown())
          app.getGlobalKeyDispatcher().handleGeneralKeys(e);
        break;

        // process input
      case KeyEvent.VK_C:
        if (Application.isControlDown(e)) // workaround for MAC_OS
        {
          ctrlC = true;
        }

        break;

      case KeyEvent.VK_ESCAPE:
        if (!handleEscapeKey) {
          break;
        }

        Component comp = SwingUtilities.getRoot(this);
        if (comp instanceof JDialog) {
          ((JDialog) comp).setVisible(false);
          return;
        }

        setText(null);
        break;

      case KeyEvent.VK_LEFT_PARENTHESIS:
        break;

      case KeyEvent.VK_UP:
        if (!handleEscapeKey) {
          break;
        }
        if (historyPopup == null) {
          String text = getPreviousInput();
          if (text != null) setText(text);
        } else if (!historyPopup.isDownPopup()) {
          historyPopup.showPopup();
        }
        break;

      case KeyEvent.VK_DOWN:
        if (!handleEscapeKey) {
          break;
        }
        if (historyPopup != null && historyPopup.isDownPopup()) historyPopup.showPopup();
        else setText(getNextInput());
        break;

      case KeyEvent.VK_F9:
        // needed for applets
        if (app.isApplet()) app.getGlobalKeyDispatcher().handleGeneralKeys(e);
        break;

      case KeyEvent.VK_RIGHT:
        if (moveToNextArgument(false)) {
          e.consume();
        }
        break;

      case KeyEvent.VK_TAB:
        if (moveToNextArgument(true)) {
          e.consume();
        }
        break;

      case KeyEvent.VK_F1:
        if (autoComplete) {
          if (getText().equals("")) {

            Object[] options = {app.getPlain("OK"), app.getPlain("ShowOnlineHelp")};
            int n =
                JOptionPane.showOptionDialog(
                    app.getMainComponent(),
                    app.getPlain("InputFieldHelp"),
                    app.getPlain("ApplicationName") + " - " + app.getMenu("Help"),
                    JOptionPane.YES_NO_OPTION,
                    JOptionPane.QUESTION_MESSAGE,
                    null, // do not use a custom Icon
                    options, // the titles of buttons
                    options[0]); // default button title

            if (n == 1) app.getGuiManager().openHelp(Application.WIKI_MANUAL);

          } else {
            int pos = getCaretPosition();
            while (pos > 0 && getText().charAt(pos - 1) == '[') {
              pos--;
            }
            String word = getWordAtPos(getText(), pos);
            String lowerCurWord = word.toLowerCase();
            String closest = dict.lookup(lowerCurWord);

            if (closest != null) // && lowerCurWord.equals(closest.toLowerCase()))		
            showCommandHelp(app.getInternalCommand(closest));
            else app.getGuiManager().openHelp(Application.WIKI_MANUAL);
          }
        } else app.getGuiManager().openHelp(Application.WIKI_MANUAL);

        e.consume();
        break;
      default:
    }
  }
Exemplo n.º 12
0
  private void createHistogramPanel() {

    // create components
    ckCumulative = new JCheckBox();
    ckCumulative.addActionListener(this);

    lblFreqType = new JLabel();
    rbFreq = new JRadioButton();
    rbFreq.addActionListener(this);

    rbNormalized = new JRadioButton();
    rbNormalized.addActionListener(this);

    rbRelative = new JRadioButton();
    rbRelative.addActionListener(this);

    ButtonGroup g = new ButtonGroup();
    g.add(rbFreq);
    g.add(rbNormalized);
    g.add(rbRelative);

    lblOverlay = new JLabel();
    ckOverlayNormal = new JCheckBox();
    ckOverlayNormal.addActionListener(this);

    ckOverlayPolygon = new JCheckBox();
    ckOverlayPolygon.addActionListener(this);

    ckShowFrequencyTable = new JCheckBox();
    ckShowFrequencyTable.addActionListener(this);

    ckManual = new JCheckBox();
    ckManual.addActionListener(this);

    lblClassRule = new JLabel();
    rbLeftRule = new JRadioButton();
    rbLeftRule.addActionListener(this);
    rbRightRule = new JRadioButton();
    rbRightRule.addActionListener(this);

    ButtonGroup g2 = new ButtonGroup();
    g2.add(rbLeftRule);
    g2.add(rbRightRule);

    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    c.weightx = 1;
    c.anchor = GridBagConstraints.LINE_START;

    // tab = tab-like constraint
    GridBagConstraints tab = (GridBagConstraints) c.clone();
    tab.insets = new Insets(0, 20, 0, 0);

    // create frequency type panel
    freqPanel = new JPanel(new GridBagLayout());
    freqPanel.add(ckCumulative, c);
    freqPanel.add(rbFreq, tab);
    freqPanel.add(rbRelative, tab);
    freqPanel.add(rbNormalized, tab);

    // create show panel
    showPanel = new JPanel(new GridBagLayout());
    showPanel.add(ckShowFrequencyTable, c);
    showPanel.add(ckOverlayPolygon, c);
    showPanel.add(ckOverlayNormal, c);

    // create classes panel
    classesPanel = new JPanel(new GridBagLayout());
    classesPanel.setBorder(BorderFactory.createTitledBorder(app.getMenu("FrequencyType")));
    classesPanel.add(ckManual, c);
    c.insets.top += 8; // vertical gap
    classesPanel.add(lblClassRule, c);
    c.insets.top -= 8; // undo vertical gap
    classesPanel.add(rbLeftRule, tab);
    classesPanel.add(rbRightRule, tab);

    // put the sub-panels together
    Box vBox = Box.createVerticalBox();
    vBox.add(classesPanel);
    vBox.add(freqPanel);
    vBox.add(showPanel);

    histogramPanel = new JPanel(new BorderLayout());
    histogramPanel.add(vBox, BorderLayout.NORTH);
    histogramPanel.setBorder(BorderFactory.createEmptyBorder());
  }
Exemplo n.º 13
0
 public void setLabels() {
   lblHeader.setText(app.getMenu("Data"));
 }
Exemplo n.º 14
0
  /**
   * Creates new ZoomMenu
   *
   * @param app
   * @param px
   * @param py
   */
  public ContextMenuGraphicsWindow(Application app, double px, double py) {
    this(app);

    iconZoom = app.getImageIcon("zoom16.gif");

    // zoom point
    this.px = px;
    this.py = py;

    EuclidianViewInterfaceCommon ev = app.getActiveEuclidianView();
    if (ev.getEuclidianViewNo() == 2) {
      setTitle("<html>" + app.getPlain("DrawingPad2") + "</html>");
    } else {
      setTitle("<html>" + app.getPlain("DrawingPad") + "</html>");
    }

    addAxesAndGridCheckBoxes();

    addSeparator();

    // zoom for both axes
    JMenu zoomMenu = new JMenu(app.getMenu("Zoom"));
    zoomMenu.setIcon(iconZoom);
    zoomMenu.setBackground(getBackground());
    addZoomItems(zoomMenu);
    add(zoomMenu);

    // zoom for y-axis
    JMenu yaxisMenu = new JMenu(app.getPlain("xAxis") + " : " + app.getPlain("yAxis"));
    yaxisMenu.setIcon(app.getEmptyIcon());
    yaxisMenu.setBackground(getBackground());
    addAxesRatioItems(yaxisMenu);
    add(yaxisMenu);

    JMenuItem miShowAllObjectsView = new JMenuItem(app.getPlain("ShowAllObjects"));
    miShowAllObjectsView.setIcon(app.getEmptyIcon());
    miShowAllObjectsView.setActionCommand("showAllObjects");
    miShowAllObjectsView.addActionListener(this);
    miShowAllObjectsView.setBackground(bgColor);
    add(miShowAllObjectsView);

    JMenuItem miStandardView = new JMenuItem(app.getPlain("StandardView"));
    setMenuShortCutAccelerator(miStandardView, 'M');
    miStandardView.setIcon(app.getEmptyIcon());
    miStandardView.setActionCommand("standardView");
    miStandardView.addActionListener(this);
    miStandardView.setBackground(bgColor);
    add(miStandardView);

    addSeparator();
    if (!ev.isZoomable()) {
      zoomMenu.setEnabled(false);
      yaxisMenu.setEnabled(false);
      miShowAllObjectsView.setEnabled(false);
      miStandardView.setEnabled(false);
    }

    if (ev.isUnitAxesRatio()) {
      yaxisMenu.setEnabled(false);
    }

    addMiProperties();
  }
Exemplo n.º 15
0
  public void setLabels() {

    // titled borders
    classesPanel.setBorder(BorderFactory.createTitledBorder(app.getMenu("Classes")));
    showPanel.setBorder(BorderFactory.createTitledBorder(app.getMenu("Show")));
    freqPanel.setBorder(BorderFactory.createTitledBorder(app.getMenu("FrequencyType")));
    dimPanel.setBorder(BorderFactory.createTitledBorder(app.getPlain("Dimensions")));

    // histogram options
    ckManual.setText(app.getMenu("SetClasssesManually"));
    lblFreqType.setText(app.getMenu("FrequencyType") + ":");

    rbFreq.setText(app.getMenu("Count"));
    rbNormalized.setText(app.getMenu("Normalized"));
    rbRelative.setText(app.getMenu("Relative"));

    ckCumulative.setText(app.getMenu("Cumulative"));
    lblOverlay.setText(app.getMenu("Overlay"));
    ckOverlayNormal.setText(app.getMenu("NormalCurve"));
    ckOverlayPolygon.setText(app.getMenu("FrequencyPolygon"));
    ckShowFrequencyTable.setText(app.getMenu("FrequencyTable"));

    lblClassRule.setText(app.getMenu("ClassRule") + ":");
    rbRightRule.setText(app.getMenu("RightClassRule"));
    rbLeftRule.setText(app.getMenu("LeftClassRule"));

    // graph options
    ckAutoWindow.setText(app.getMenu("AutoDimension"));
    ckShowGrid.setText(app.getPlain("ShowGrid"));
    lblXMin.setText(app.getPlain("xmin") + ":");
    lblXMax.setText(app.getPlain("xmax") + ":");
    lblYMin.setText(app.getPlain("ymin") + ":");
    lblYMax.setText(app.getPlain("ymax") + ":");

    lblXInterval.setText(app.getPlain("xstep") + ":");
    lblYInterval.setText(app.getPlain("ystep") + ":");

    ckShowLines.setText(app.getMenu("LineGraph"));

    repaint();
  }
Exemplo n.º 16
0
  public static final String[][] basicSymbolsMap(Application app) {

    String[][] array = {
      {"\u03B1", app.getPlain("GreekCharacterA", "\u03B1")}, // lowercaseGreekALPHA
      {"\u03B2", app.getPlain("GreekCharacterA", "\u03B2")}, // lowercaseGreekBETA
      {"\u03B3", app.getPlain("GreekCharacterA", "\u03B3")}, // lowercaseGreekGAMMA
      {"\u03B4", app.getPlain("GreekCharacterA", "\u03B4")}, // lowercaseGreekDELTA
      {"\u03B5", app.getPlain("GreekCharacterA", "\u03B5")}, // lowercaseGreekEPSILON
      {"\u03B6", app.getPlain("GreekCharacterA", "\u03B6")}, // lowercaseGreekZETA
      {"\u03B7", app.getPlain("GreekCharacterA", "\u03B7")}, // lowercaseGreekETA
      {"\u03B8", app.getPlain("GreekCharacterA", "\u03B8")}, // lowercaseGreekTHETA
      //	{ "\u03B9" , app.getMenu("Symbol.GreekCharacter" ) + ":  " +   "\u03B9"},
      // //lowercaseGreekIOTA
      {"\u03BA", app.getPlain("GreekCharacterA", "\u03BA")}, // lowercaseGreekKAPPA
      {"\u03BB", app.getPlain("GreekCharacterA", "\u03BB")}, // lowercaseGreekLAMDA
      {"\u03BC", app.getPlain("GreekCharacterA", "\u03BC")}, // lowercaseGreekMU
      //	{ "\u03BD" , app.getMenu("Symbol.GreekCharacter" ) + ":  " +   "\u03BD"},
      // //lowercaseGreekNU
      {"\u03BE", app.getPlain("GreekCharacterA", "\u03BE")}, // lowercaseGreekXI
      //	{ "\u03BF" , app.getMenu("Symbol.GreekCharacter" ) + ":  " +   "\u03BF"},
      // //lowercaseGreekOMICRON
      //	{ "\u03C0" , app.getMenu("Symbol.GreekCharacter" ) + ":  " +   "\u03C0"},
      // //lowercaseGreekPI
      {"\u03C1", app.getPlain("GreekCharacterA", "\u03C1")}, // lowercaseGreekRHO
      //	{ "\u03C2" , app.getMenu("Symbol.GreekCharacter" ) + ":  " +   "\u03C2"},
      // //lowercaseGreekFINALSIGMA
      {"\u03C3", app.getPlain("GreekCharacterA", "\u03C3")}, // lowercaseGreekSIGMA
      {"\u03C4", app.getPlain("GreekCharacterA", "\u03C4")}, // lowercaseGreekTAU
      //	{ "\u03C5" , app.getMenu("Symbol.GreekCharacter" ) + ":  " +   "\u03C5"},
      // //lowercaseGreekUPSILON
      {
        "\u03C6", app.getPlain("GreekCharacterA", "\u03C6")
      }, // lowercaseGreekPHI (\varPhi the "loopy" phi)
      {
        "\u03D5", app.getPlain("GreekCharacterA", "\u03D5")
      }, // lowercaseGreekPHI \phi the "straight" math phi
      {"\u03C7", app.getPlain("GreekCharacterA", "\u03C7")}, // lowercaseGreekCHI
      {"\u03C8", app.getPlain("GreekCharacterA", "\u03C8")}, // lowercaseGreekPSI
      {"\u03C9", app.getPlain("GreekCharacterA", "\u03C9")}, // lowercaseGreekOMEGA
      {"\u0393", app.getPlain("GreekCharacterA", "\u0393")}, // uppercaseGreekGAMMA
      {"\u0394", app.getPlain("GreekCharacterA", "\u0394")}, // uppercaseGreekDELTA
      {"\u0398", app.getPlain("GreekCharacterA", "\u0398")}, // uppercaseGreekTHETA
      // removed - too similar to logical 'and'
      // { "\u039b" , app.getPlain("GreekCharacterA", "\u039b" ) },  //uppercaseGreekLAMBDA
      {"\u039e", app.getPlain("GreekCharacterA", "\u039e")}, // uppercaseGreekXI
      {"\u03a0", app.getPlain("GreekCharacterA", "\u03a0")}, // uppercaseGreekPI
      {"\u03a3", app.getPlain("GreekCharacterA", "\u03a3")}, // uppercaseGreekSIGMA
      {"\u03a6", app.getPlain("GreekCharacterA", "\u03a6")}, // uppercaseGreekPHI
      // { "\u03a8" , app.getPlain("GreekCharacterA", "\u03a8" ) },  //uppercaseGreekPSI
      {"\u03a9", app.getPlain("GreekCharacterA", "\u03a9")}, // uppercaseGreekOMEGA
      {"\u221e", app.getMenu("Symbol.Infinity")},
      {ExpressionNode.strVECTORPRODUCT, app.getMenu("Symbol.VectorProduct")},
      {ExpressionNode.strEQUAL_BOOLEAN, app.getMenu("Symbol.BooleanEqual")},
      {ExpressionNode.strNOT_EQUAL, app.getMenu("Symbol.NotEqual")},
      {ExpressionNode.strLESS_EQUAL, app.getMenu("Symbol.LessThanEqualTo")},
      {ExpressionNode.strGREATER_EQUAL, app.getMenu("Symbol.GreaterThanEqualTo")},
      {ExpressionNode.strNOT, app.getMenu("Symbol.Negation")},
      {ExpressionNode.strAND, app.getMenu("Symbol.And")},
      {ExpressionNode.strOR, app.getMenu("Symbol.Or")},
      {ExpressionNode.strPARALLEL, app.getMenu("Symbol.Parallel")},
      {ExpressionNode.strPERPENDICULAR, app.getMenu("Symbol.Perpendicular")},
      {ExpressionNode.strIS_ELEMENT_OF, app.getMenu("Symbol.ElementOf")},
      {ExpressionNode.strIS_SUBSET_OF, app.getMenu("Symbol.Subset")},
      {ExpressionNode.strIS_SUBSET_OF_STRICT, app.getMenu("Symbol.StrictSubset")},
      // { "\u2220" , app.getMenu("Symbol.Angle" )},
      {"\u2221", app.getMenu("Symbol.AngleMeasure")},
      {Unicode.Superscript_2 + "", app.getMenu("Symbol.Square")}, // exponents^2
      {Unicode.Superscript_3 + "", app.getMenu("Symbol.Cube")}, // exponents^3
      {Unicode.degree, app.getMenu("Symbol.Degree")}, // degree
      {Unicode.IMAGINARY, Unicode.IMAGINARY}, // sqrt(-1)
      {Unicode.PI_STRING, Unicode.PI_STRING}, // pi
      {Unicode.EULER_STRING, Unicode.EULER_STRING}, // e
      {Unicode.NBSP, app.getMenu("Symbol.NBSP")}, // e
    };

    return array;
  };
Exemplo n.º 17
0
  public FileMenu(Application app) {
    super(app, app.getMenu("File"));

    initActions();
    update();
  }