예제 #1
0
  private void createGUI() {

    dataSourcePanel = new DataSourcePanel(app, mode);

    lblTitle = new JLabel();
    lblTitle.setIconTextGap(10);

    btnOK = new JButton();
    btnOK.addActionListener(this);

    btnCancel = new JButton();
    btnCancel.addActionListener(this);

    JPanel titlePanel = LayoutUtil.flowPanel(lblTitle);
    // titlePanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));

    JPanel mainPanel = new JPanel(new BorderLayout());
    mainPanel.add(titlePanel, BorderLayout.NORTH);
    mainPanel.add(dataSourcePanel, BorderLayout.CENTER);
    mainPanel.add(LayoutUtil.flowPanelRight(5, 0, 0, btnCancel, btnOK), BorderLayout.SOUTH);

    mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(mainPanel, BorderLayout.CENTER);
    setLabels();
  }
예제 #2
0
  private JPanel createRegressionPanel() {

    // components
    String[] orders = {"2", "3", "4", "5", "6", "7", "8", "9"};
    cbPolyOrder = new JComboBox(orders);
    cbPolyOrder.setSelectedIndex(0);
    cbPolyOrder.addActionListener(this);
    cbPolyOrder.setFocusable(false);

    regressionLabels = new String[Regression.values().length];
    setRegressionLabels();
    cbRegression = new JComboBox(regressionLabels);
    cbRegression.addActionListener(this);
    cbRegression.setFocusable(false);

    lblRegEquation = new JLabel();
    lblEqn = new JLabel();

    // regression combo panel
    JPanel cbPanel = new JPanel();
    cbPanel.setLayout(new BoxLayout(cbPanel, BoxLayout.Y_AXIS));
    cbPanel.add(LayoutUtil.flowPanel(cbRegression));
    cbPanel.add(LayoutUtil.flowPanel(cbPolyOrder));

    // regression label panel
    JPanel eqnPanel = new JPanel(new BorderLayout());
    eqnPanel.add(lblRegEquation, BorderLayout.CENTER);
    JScrollPane scroller = new JScrollPane(eqnPanel);
    scroller.setBorder(BorderFactory.createEmptyBorder());

    // prediction panel
    createPredictionPanel();

    // model panel: equation + prediction
    JPanel modelPanel = new JPanel();
    modelPanel.setLayout(new BoxLayout(modelPanel, BoxLayout.Y_AXIS));
    modelPanel.add(scroller);
    modelPanel.add(predictionPanel);

    // put it all together
    regressionPanel = new JPanel(new BorderLayout(30, 0));
    regressionPanel.add(modelPanel, BorderLayout.CENTER);
    regressionPanel.add(cbPanel, loc.borderWest());
    regressionPanel.setBorder(BorderFactory.createTitledBorder(loc.getMenu("RegressionModel")));

    JPanel mainPanel = new JPanel(new BorderLayout());
    mainPanel.add(regressionPanel, BorderLayout.CENTER);

    return mainPanel;
  }
예제 #3
0
  private void createBarChartPanel() {

    // create components
    ckAutoBarWidth = new JCheckBox();
    ckAutoBarWidth.addActionListener(this);
    lblBarWidth = new JLabel();
    fldBarWidth = new MyTextFieldD(app, fieldWidth);
    fldBarWidth.setEditable(true);
    fldBarWidth.addActionListener(this);
    fldBarWidth.addFocusListener(this);

    // barChartWidthPanel
    barChartWidthPanel = new JPanel();
    barChartWidthPanel.setLayout(new BoxLayout(barChartWidthPanel, BoxLayout.Y_AXIS));
    barChartWidthPanel.add(LayoutUtil.flowPanel(ckAutoBarWidth));
    barChartWidthPanel.add(LayoutUtil.flowPanel(tab, lblBarWidth, fldBarWidth));

    layoutBarChartPanel();
  }
예제 #4
0
  private void createBoxPlotPanel() {

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

    // layout
    Box p = Box.createVerticalBox();
    p.add(LayoutUtil.flowPanel(ckShowOutliers));

    boxPlotPanel = new JPanel(new BorderLayout());
    boxPlotPanel.add(p, BorderLayout.NORTH);
  }
예제 #5
0
  /**
   * Bind this view to a dock manager. Also initializes the whole GUI as just at this point the
   * application is available.
   *
   * @param dockManager1 dock manager
   */
  public void register(DockManagerD dockManager1) {
    this.dockManager = dockManager1;
    setApp(dockManager1.getLayout().getApplication());
    // create buttons for the panels
    createButtons();

    // create button panel
    buttonPanel = new JPanel();
    buttonPanel.setLayout(new FlowLayout(app.flowRight(), 0, 1));
    if (app.getLocalization().isRightToLeftReadingOrder()) {
      buttonPanel.add(closeButton);
      buttonPanel.add(Box.createHorizontalStrut(4));
      buttonPanel.add(windowButton);
      buttonPanel.add(unwindowButton);
      buttonPanel.add(Box.createHorizontalStrut(4));
      buttonPanel.add(maximizeButton);
    } else {
      buttonPanel.add(maximizeButton);
      buttonPanel.add(Box.createHorizontalStrut(4));
      buttonPanel.add(unwindowButton);
      buttonPanel.add(windowButton);
      buttonPanel.add(Box.createHorizontalStrut(4));
      buttonPanel.add(closeButton);
    }

    // Custom border for the major panels (title, stylebar and toolbar)
    Border panelBorder =
        BorderFactory.createCompoundBorder(
            BorderFactory.createMatteBorder(0, 0, 1, 0, SystemColor.controlShadow),
            BorderFactory.createEmptyBorder(0, 2, 0, 2));

    // create style bar panel
    styleBarPanel = new JPanel(new BorderLayout(1, 2));
    styleBarPanel.setBorder(panelBorder);
    styleBarPanel.addMouseListener(this);

    styleBarButtonPanel = new JPanel(new BorderLayout());
    JPanel p = new JPanel(new FlowLayout(0, 0, app.flowLeft()));
    if (this.hasStyleBar) {
      p.add(toggleStyleBarButton2);
    }
    p.add(Box.createHorizontalStrut(4));

    styleBarButtonPanel.add(p, BorderLayout.NORTH);
    styleBarPanel.add(styleBarButtonPanel, loc.borderWest());
    styleBarPanel.add(LayoutUtil.flowPanelRight(0, 0, 4, unwindowButton2), loc.borderEast());

    // construct the title panel and add all elements
    titlePanel = new JPanel();
    titlePanel.setBorder(panelBorder);
    titlePanel.setLayout(new BorderLayout());

    titlePanel.add(createFocusPanel(), loc.borderWest());
    titlePanel.add(buttonPanel, loc.borderEast());
    titlePanel.addMouseListener(this); // dragging to reconfigure
    titlePanel.addMouseListener(new MyButtonHider());

    // create toolbar panel
    if (hasToolbar()) {
      toolbarPanel = new JPanel(new BorderLayout());
      toolbarPanel.setBorder(panelBorder);
    }

    // construct a meta panel to hold the title, tool bar and style bar
    // panels

    JPanel titleBar = new JPanel(new BorderLayout());
    titleBar.add(styleBarPanel, BorderLayout.SOUTH);
    titleBar.add(titlePanel, BorderLayout.NORTH);

    JPanel metaPanel = new JPanel(new BorderLayout());
    metaPanel.add(titleBar, BorderLayout.SOUTH);
    if (hasToolbar()) metaPanel.add(toolbarPanel, BorderLayout.CENTER);

    // make titlebar visible if necessary
    updatePanel();

    add(metaPanel, BorderLayout.NORTH);
  }