예제 #1
0
  public EmployeeCUDialog(JFrame owner, String title) {
    super(owner);
    this.setTitle(title);
    this.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
    this.setLocation(500, 250);
    this.setSize(200, 300);
    this.setLayout(null);
    this.setModal(true);

    lblName = new JLabel("Name:");
    this.add(lblName);
    lblName.setLocation(20, 10);
    lblName.setSize(100, 25);

    txfName = new JTextField();
    this.add(txfName);
    txfName.setLocation(20, 35);
    txfName.setSize(150, 25);

    lblWage = new JLabel("Wage:");
    this.add(lblWage);
    lblWage.setLocation(20, 70);
    lblWage.setSize(100, 25);

    txfWage = new JTextField();
    this.add(txfWage);
    txfWage.setLocation(20, 95);
    txfWage.setSize(150, 25);

    lblCompany = new JLabel("Company:");
    this.add(lblCompany);
    lblCompany.setLocation(20, 130);
    lblCompany.setSize(100, 25);

    cbxCompanies = new JComboBox<Company>();
    this.add(cbxCompanies);
    cbxCompanies.setLocation(20, 155);
    cbxCompanies.setSize(150, 25);
    cbxCompanies.setMaximumRowCount(4);

    btnOk = new JButton("Ok");
    this.add(btnOk);
    btnOk.setLocation(15, 225);
    btnOk.setSize(70, 25);
    btnOk.addActionListener(controller);

    btnCancel = new JButton("Cancel");
    this.add(btnCancel);
    btnCancel.setLocation(95, 225);
    btnCancel.setSize(80, 25);
    btnCancel.addActionListener(controller);

    // initialise this view
    controller.fillCbxCompanies();
  }
예제 #2
0
  @Override
  public Pane getVisSettings() {

    GridPane pane = new GridPane();
    pane.setPadding(new Insets(10, 0, 0, 0));
    pane.setHgap(5);
    pane.setVgap(5);

    // Dimension selection box
    ComboBox<String> dimCombo = new ComboBox<>();
    ObservableList<String> dimensions = FXCollections.observableArrayList();
    dimensions.add("X");
    dimensions.add("Y");
    dimensions.add("Z");
    dimCombo.setItems(dimensions);
    dimCombo.setValue(dimensions.get(2));
    dimCombo
        .valueProperty()
        .addListener(
            (ov, oldStr, newStr) -> {
              if (newStr.equals("X")) {
                renderer.setViewingDimension(0);
              } else if (newStr.equals("Y")) {
                renderer.setViewingDimension(1);
              } else {
                renderer.setViewingDimension(2);
              }
              renderer.render();
              Controller.getInstance().updateHistogram();
            });

    Label dimLabel = new Label();
    dimLabel.setText("Projection dimension: ");
    dimLabel.setLabelFor(dimCombo);

    pane.add(dimLabel, 0, 0);
    pane.add(dimCombo, 1, 0);

    // Scale checkbox
    CheckBox scaleBox = new CheckBox("Scale: ");
    scaleBox.setSelected(true);
    scaleBox
        .selectedProperty()
        .addListener(
            (ov, old_val, new_val) -> {
              renderer.setScaling(new_val);
              renderer.render();
            });
    pane.add(scaleBox, 0, 1);

    return pane;
  }
예제 #3
0
 public void setEmployee(Employee employee) {
   controller.employee = employee;
   controller.updateView();
 }