Exemplo n.º 1
0
 public void updateHelper() {
   if (model.GuessORHint == 0) {
     label1.setText("Entered:");
   }
   if (model.GuessORHint == 1) {
     label1.setText("Hints:");
   }
   DefaultListModel<String> listTemp = new DefaultListModel<String>();
   if (model.GuessORHint == 0) {
     for (String str : model.haveEntered) {
       listTemp.addElement(str);
     }
   } else {
     if (model.hintWords != null) {
       for (String MM : model.hintWords) {
         if (MM == null) {
           listTemp.addElement("APPLE");
         } else {
           listTemp.addElement(MM);
         }
       }
     }
   }
   list.setModel(listTemp);
   scroll.setViewportView(list);
 }
Exemplo n.º 2
0
  void initComponents() {
    JPanel mainPanel = new JPanel(new BorderLayout());
    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
    Color bgColor = Color.getHSBColor(0.58f, 0.17f, 0.95f);
    buttonPanel.setBackground(bgColor);
    Border empty = BorderFactory.createEmptyBorder(5, 5, 5, 5);
    buttonPanel.setBorder(empty);

    textField = new JTextField(75);
    buttonPanel.add(textField);

    buttonPanel.add(Box.createHorizontalStrut(10));
    searchPHI = new JButton("Search PHI");
    searchPHI.addActionListener(this);
    buttonPanel.add(searchPHI);

    buttonPanel.add(Box.createHorizontalStrut(10));
    searchTrial = new JButton("Search Trial IDs");
    searchTrial.addActionListener(this);
    buttonPanel.add(searchTrial);

    buttonPanel.add(Box.createHorizontalStrut(20));
    buttonPanel.add(Box.createHorizontalGlue());
    saveAs = new JCheckBox("Save As...");
    saveAs.setBackground(bgColor);
    buttonPanel.add(saveAs);

    mainPanel.add(buttonPanel, BorderLayout.NORTH);

    JScrollPane scrollPane = new JScrollPane();
    textPane = new ColorPane();
    // textPane.setEditable(false);
    scrollPane.setViewportView(textPane);
    mainPanel.add(scrollPane, BorderLayout.CENTER);

    JPanel footerPanel = new JPanel();
    footerPanel.setLayout(new BoxLayout(footerPanel, BoxLayout.X_AXIS));
    footerPanel.setBackground(bgColor);
    message = new JLabel("Ready...");
    footerPanel.add(message);
    mainPanel.add(footerPanel, BorderLayout.SOUTH);

    setTitle(windowTitle);
    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent evt) {
            System.exit(0);
          }
        });
    getContentPane().add(mainPanel, BorderLayout.CENTER);
    pack();
    centerFrame();
  }
Exemplo n.º 3
0
 /** Class constructor; creates a user interface and loads it with values from the props file. */
 public ControlPanel() {
   super();
   setLayout(new BorderLayout());
   Configuration config = Configuration.getInstance();
   config.setControlPanel(this);
   props = config.getProperties();
   profiles = new Profiles();
   profileLoader = new ProfileLoader();
   profileSaver = new ProfileSaver();
   profileDeleter = new ProfileDeleter();
   selectorPanel = new SelectorPanel();
   jsp = new JScrollPane();
   jsp.setViewportView(selectorPanel);
   this.add(jsp, BorderLayout.CENTER);
   footerPanel = new FooterPanel();
   this.add(footerPanel, BorderLayout.SOUTH);
   jsp.getVerticalScrollBar().setUnitIncrement(25);
   jsp.getVerticalScrollBar().setBlockIncrement(25);
 }
Exemplo n.º 4
0
  public prueba() {
    setBorder(new LineBorder(new Color(0, 0, 0), 2, true));

    setBounds(0, 0, 800, 600);
    setOpaque(false);

    setLayout(null);

    JScrollPane scrollPane_1 = new JScrollPane();
    scrollPane_1.setBounds(new Rectangle(500, 0, 250, 400));
    scrollPane_1.setBounds(50, 50, 650, 450);
    add(scrollPane_1);
    leftTable = new JTable(new SimpleColorTableModel());
    leftTable.setBackground(new Color(153, 204, 255));
    scrollPane_1.setViewportView(leftTable);

    setupTable(leftTable);

    populate((SimpleColorTableModel) leftTable.getModel());

    setSize(800, 600);
  }
Exemplo n.º 5
0
  private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Open Source Project license - unknown
    ResourceBundle bundle = ResourceBundle.getBundle("InformationDialog");
    JPanel dialogPane = new JPanel();
    JPanel contentPanel = new JPanel();
    iconLabel = new JLabel();
    pathLabel = new JLabel();
    JLabel labelFrom = new JLabel();
    fieldFrom = new JTextField();
    JLabel labelSize = new JLabel();
    fieldSize = new JTextField();
    JLabel labelDescription = new JLabel();
    JScrollPane scrollPane1 = new JScrollPane();
    descriptionArea = ComponentFactory.getTextArea();
    JPanel optionsPanel = new JPanel();
    JLabel saveToLabel = new JLabel();
    comboPath = new JComboBox();
    btnSelectPath = new JButton();
    progressBar = new JProgressBar();
    JLabel labelRemaining = new JLabel();
    remainingLabel = new JLabel();
    JLabel labelEstimateTime = new JLabel();
    estTimeLabel = new JLabel();
    JLabel labelCurrentSpeed = new JLabel();
    currentSpeedLabel = new JLabel();
    JLabel labelAverageSpeed = new JLabel();
    avgSpeedLabel = new JLabel();
    JXButtonPanel buttonBar = new JXButtonPanel();
    okButton = new JButton();
    cancelButton = new JButton();
    CellConstraints cc = new CellConstraints();

    // ======== this ========
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    // ======== dialogPane ========
    {
      dialogPane.setBorder(Borders.DIALOG);
      dialogPane.setLayout(new BorderLayout());

      // ======== contentPanel ========
      {

        // ---- iconLabel ----
        iconLabel.setText(bundle.getString("iconLabel.text"));

        // ---- pathLabel ----
        pathLabel.setText(bundle.getString("pathLabel.text"));
        pathLabel.setFont(new Font("Tahoma", Font.BOLD, 12));

        // ---- labelFrom ----
        labelFrom.setText(bundle.getString("labelFrom.text"));

        // ---- fieldFrom ----
        fieldFrom.setBorder(null);
        fieldFrom.setOpaque(false);
        fieldFrom.setText(bundle.getString("fieldFrom.text"));

        // ---- labelSize ----
        labelSize.setText(bundle.getString("labelSize.text"));

        // ---- fieldSize ----
        fieldSize.setBorder(null);
        fieldSize.setOpaque(false);

        // ---- labelDescription ----
        labelDescription.setText(bundle.getString("labelDescription.text"));

        // ======== scrollPane1 ========
        {
          scrollPane1.setViewportView(descriptionArea);
        }

        // ======== optionsPanel ========
        {

          // ---- saveToLabel ----
          saveToLabel.setText(bundle.getString("saveToLabel.text"));
          saveToLabel.setLabelFor(comboPath);

          // ---- comboPath ----
          comboPath.setEditable(true);

          // ---- btnSelectPath ----
          btnSelectPath.setText(bundle.getString("btnSelectPath.text"));

          PanelBuilder optionsPanelBuilder =
              new PanelBuilder(
                  new FormLayout(
                      new ColumnSpec[] {
                        FormSpecs.DEFAULT_COLSPEC,
                        FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
                        new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW),
                        FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
                        FormSpecs.DEFAULT_COLSPEC
                      },
                      RowSpec.decodeSpecs("default")),
                  optionsPanel);

          optionsPanelBuilder.add(saveToLabel, cc.xy(1, 1));
          optionsPanelBuilder.add(comboPath, cc.xy(3, 1));
          optionsPanelBuilder.add(btnSelectPath, cc.xy(5, 1));
        }

        // ---- progressBar ----
        progressBar.setFont(new Font("Tahoma", Font.BOLD, 16));

        // ---- labelRemaining ----
        labelRemaining.setText(bundle.getString("labelRemaining.text"));

        // ---- remainingLabel ----
        remainingLabel.setText(bundle.getString("remainingLabel.text"));
        remainingLabel.setFont(new Font("Tahoma", Font.BOLD, 12));

        // ---- labelEstimateTime ----
        labelEstimateTime.setText(bundle.getString("labelEstimateTime.text"));

        // ---- estTimeLabel ----
        estTimeLabel.setText(bundle.getString("estTimeLabel.text"));
        estTimeLabel.setFont(new Font("Tahoma", Font.BOLD, 12));

        // ---- labelCurrentSpeed ----
        labelCurrentSpeed.setText(bundle.getString("labelCurrentSpeed.text"));

        // ---- currentSpeedLabel ----
        currentSpeedLabel.setText(bundle.getString("currentSpeedLabel.text"));
        currentSpeedLabel.setFont(new Font("Tahoma", Font.BOLD, 12));

        // ---- labelAverageSpeed ----
        labelAverageSpeed.setText(bundle.getString("labelAverageSpeed.text"));

        // ---- avgSpeedLabel ----
        avgSpeedLabel.setText(bundle.getString("avgSpeedLabel.text"));
        avgSpeedLabel.setFont(new Font("Tahoma", Font.BOLD, 12));

        PanelBuilder contentPanelBuilder =
            new PanelBuilder(
                new FormLayout(
                    new ColumnSpec[] {
                      new ColumnSpec(Sizes.dluX(49)),
                      FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
                      FormSpecs.DEFAULT_COLSPEC,
                      FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
                      new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW),
                      FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
                      FormSpecs.DEFAULT_COLSPEC,
                      FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
                      ColumnSpec.decode("max(min;70dlu)")
                    },
                    new RowSpec[] {
                      FormSpecs.DEFAULT_ROWSPEC,
                      FormSpecs.LINE_GAP_ROWSPEC,
                      FormSpecs.DEFAULT_ROWSPEC,
                      FormSpecs.LINE_GAP_ROWSPEC,
                      FormSpecs.DEFAULT_ROWSPEC,
                      FormSpecs.LINE_GAP_ROWSPEC,
                      FormSpecs.DEFAULT_ROWSPEC,
                      FormSpecs.LINE_GAP_ROWSPEC,
                      new RowSpec(
                          RowSpec.FILL,
                          Sizes.bounded(Sizes.PREFERRED, Sizes.dluY(40), Sizes.dluY(50)),
                          FormSpec.DEFAULT_GROW),
                      FormSpecs.LINE_GAP_ROWSPEC,
                      FormSpecs.DEFAULT_ROWSPEC,
                      FormSpecs.LINE_GAP_ROWSPEC,
                      RowSpec.decode("fill:max(pref;20dlu)"),
                      FormSpecs.LINE_GAP_ROWSPEC,
                      FormSpecs.DEFAULT_ROWSPEC,
                      FormSpecs.LINE_GAP_ROWSPEC,
                      FormSpecs.DEFAULT_ROWSPEC
                    }),
                contentPanel);

        contentPanelBuilder.add(iconLabel, cc.xywh(1, 1, 1, 5));
        contentPanelBuilder.add(pathLabel, cc.xywh(3, 1, 7, 1));
        contentPanelBuilder.add(labelFrom, cc.xy(3, 3));
        contentPanelBuilder.add(fieldFrom, cc.xywh(5, 3, 5, 1));
        contentPanelBuilder.add(labelSize, cc.xy(3, 5));
        contentPanelBuilder.add(fieldSize, cc.xywh(5, 5, 3, 1));
        contentPanelBuilder.add(labelDescription, cc.xy(1, 7));
        contentPanelBuilder.add(scrollPane1, cc.xywh(1, 9, 9, 1));
        contentPanelBuilder.add(optionsPanel, cc.xywh(1, 11, 9, 1));
        contentPanelBuilder.add(progressBar, cc.xywh(1, 13, 9, 1));
        contentPanelBuilder.add(labelRemaining, cc.xy(1, 15));
        contentPanelBuilder.add(remainingLabel, cc.xywh(3, 15, 3, 1));
        contentPanelBuilder.add(labelEstimateTime, cc.xy(7, 15));
        contentPanelBuilder.add(estTimeLabel, cc.xy(9, 15));
        contentPanelBuilder.add(labelCurrentSpeed, cc.xy(1, 17));
        contentPanelBuilder.add(currentSpeedLabel, cc.xywh(3, 17, 3, 1));
        contentPanelBuilder.add(labelAverageSpeed, cc.xy(7, 17));
        contentPanelBuilder.add(avgSpeedLabel, cc.xy(9, 17));
      }
      dialogPane.add(contentPanel, BorderLayout.CENTER);

      // ======== buttonBar ========
      {
        buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0));

        // ---- okButton ----
        okButton.setText(bundle.getString("okButton.text"));

        // ---- cancelButton ----
        cancelButton.setText(bundle.getString("cancelButton.text"));

        PanelBuilder buttonBarBuilder =
            new PanelBuilder(
                new FormLayout(
                    new ColumnSpec[] {
                      new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW),
                      FormSpecs.UNRELATED_GAP_COLSPEC,
                      ColumnSpec.decode("max(pref;55dlu)"),
                      FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
                      FormSpecs.DEFAULT_COLSPEC
                    },
                    RowSpec.decodeSpecs("fill:pref")),
                buttonBar);
        ((FormLayout) buttonBar.getLayout()).setColumnGroups(new int[][] {{3, 5}});

        buttonBarBuilder.add(okButton, cc.xy(3, 1));
        buttonBarBuilder.add(cancelButton, cc.xy(5, 1));
      }
      dialogPane.add(buttonBar, BorderLayout.SOUTH);
    }
    contentPane.add(dialogPane, BorderLayout.CENTER);
    pack();
    setLocationRelativeTo(getOwner());
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
  }
Exemplo n.º 6
0
 public void reload() {
   this.remove(jsp);
   selectorPanel = new SelectorPanel();
   jsp.setViewportView(selectorPanel);
   this.add(jsp, BorderLayout.CENTER);
 }
Exemplo n.º 7
0
  /**
   * Create the train module GUI (the dynamic and static windows). Both windows are HIDE_ON_CLOSE so
   * that closing them does not cause the train module to close.
   */
  public TrainModelUI() {
    try {
      JPanel emptyJPanel = new JPanel();
      emptyJPanel.add(new JLabel("            "));
      isPaused = true;

      // Setup the dynamicWindow.

      btnShowStaticValues = buildJButton("Show Static Values");
      btnSelectTrain = buildJButton("Select Train");
      btnPauseResume = buildJButton("Pause");
      btnPauseResume.setEnabled(false);
      btnSetManRecPower = buildJButton("Set Manual Received Power");
      btnToggleManRecPower = buildJButton("Toggle Manual Received Power");
      btnSetManDesSpdLmt = buildJButton("Set Manual Desired Speed Limit");
      btnToggleManDesSpdLmt = buildJButton("Toggle Manual Desired Speed Limit");
      btnToggleSignalPickupFailure = buildJButton("Toggle Signal Pickup Failure");
      btnToggleEngineFailure = buildJButton("Toggle Engine Failure");
      btnToggleBrakeFailure = buildJButton("Toggle Brake Failure");
      btnToggleServiceBrake = buildJButton("Toggle Service Brake");
      btnToggleEmergencyBrake = buildJButton("Toggle Emergency Brake");
      btnSetManLights = buildJButton("Set Manual Lights Status");
      btnToggleManLights = buildJButton("Toggle Manual Lights Status");
      btnSetManDoors = buildJButton("Set Manual Doors Status");
      btnToggleManDoors = buildJButton("Toggle Manual Doors Status");
      btnSetManTarTemperature = buildJButton("Set Manual Target Temp.");
      btnToggleManTarTemperature = buildJButton("Toggle Manual Target Temp.");

      jlTime = new JLabel("XX:XX:XX", JLabel.CENTER);
      jlCurVel = new JLabel("", JLabel.CENTER);
      jlCurAccel = new JLabel("", JLabel.CENTER);
      jlRecPowerTNC = new JLabel("", JLabel.CENTER);
      jlManRecPower = new JLabel("", JLabel.CENTER);
      jlToggleManRecPower = new JLabel("", JLabel.CENTER);
      jlPostedSpdLmt = new JLabel("", JLabel.CENTER);
      jlManDesSpdLmt = new JLabel("", JLabel.CENTER);
      jlToggleManDesSpdLmt = new JLabel("", JLabel.CENTER);
      jlGrade = new JLabel("", JLabel.CENTER);
      jlTotalMass = new JLabel("", JLabel.CENTER);
      jlPassengerCount = new JLabel("", JLabel.CENTER);
      jlCrewCount = new JLabel("", JLabel.CENTER);
      jlPosition = new JLabel("", JLabel.CENTER);
      jlToggleSignalPickupFailure = new JLabel("", JLabel.CENTER);
      jlToggleEngineFailure = new JLabel("", JLabel.CENTER);
      jlToggleBrakeFailure = new JLabel("", JLabel.CENTER);
      jlToggleServiceBrake = new JLabel("", JLabel.CENTER);
      jlToggleEmergencyBrake = new JLabel("", JLabel.CENTER);
      jlLights = new JLabel("", JLabel.CENTER);
      jlManLights = new JLabel("", JLabel.CENTER);
      jlToggleManLights = new JLabel("", JLabel.CENTER);
      jlDoors = new JLabel("", JLabel.CENTER);
      jlManDoors = new JLabel("", JLabel.CENTER);
      jlToggleManDoors = new JLabel("", JLabel.CENTER);
      jlCurTemperature = new JLabel("", JLabel.CENTER);
      jlTarTemperature = new JLabel("", JLabel.CENTER);
      jlManTarTemperature = new JLabel("", JLabel.CENTER);
      jlToggleManTarTemperature = new JLabel("", JLabel.CENTER);
      jlAnnouncement = new JLabel("", JLabel.CENTER);

      JPanel dwPanel1 = new JPanel();
      dwPanel1.setLayout(new GridLayout(18, 2));
      dwPanel1.add(buildJPanel(new JLabel("Current Velocity (m/s)", JLabel.CENTER)));
      dwPanel1.add(buildJPanel(jlCurVel));
      dwPanel1.add(buildJPanel(new JLabel("Current Acceleration (m/s^2)", JLabel.CENTER)));
      dwPanel1.add(buildJPanel(jlCurAccel));
      dwPanel1.add(buildJPanel(new JLabel("Received Power from TNC (W)", JLabel.CENTER)));
      dwPanel1.add(buildJPanel(jlRecPowerTNC));
      dwPanel1.add(buildJPanel(btnSetManRecPower));
      dwPanel1.add(buildJPanel(jlManRecPower));
      dwPanel1.add(buildJPanel(btnToggleManRecPower));
      dwPanel1.add(buildJPanel(jlToggleManRecPower));
      dwPanel1.add(buildJPanel(new JLabel("Speed Limit Posted on Signs (m/s)", JLabel.CENTER)));
      dwPanel1.add(buildJPanel(jlPostedSpdLmt));
      dwPanel1.add(buildJPanel(btnSetManDesSpdLmt));
      dwPanel1.add(buildJPanel(jlManDesSpdLmt));
      dwPanel1.add(buildJPanel(btnToggleManDesSpdLmt));
      dwPanel1.add(buildJPanel(jlToggleManDesSpdLmt));
      dwPanel1.add(buildJPanel(new JLabel("Relative Grade from TKM (%)", JLabel.CENTER)));
      dwPanel1.add(buildJPanel(jlGrade));
      dwPanel1.add(
          buildJPanel(new JLabel("Total Mass (inc. passengers/crew) (kg)", JLabel.CENTER)));
      dwPanel1.add(buildJPanel(jlTotalMass));
      dwPanel1.add(buildJPanel(new JLabel("Passenger Count", JLabel.CENTER)));
      dwPanel1.add(buildJPanel(jlPassengerCount));
      dwPanel1.add(buildJPanel(new JLabel("Crew Count", JLabel.CENTER)));
      dwPanel1.add(buildJPanel(jlCrewCount));
      dwPanel1.add(
          buildJPanel(new JLabel("Position from Onboard GPS ([block], m)", JLabel.CENTER)));
      dwPanel1.add(buildJPanel(jlPosition));
      dwPanel1.add(buildJPanel(btnToggleSignalPickupFailure));
      dwPanel1.add(buildJPanel(jlToggleSignalPickupFailure));
      dwPanel1.add(buildJPanel(btnToggleEngineFailure));
      dwPanel1.add(buildJPanel(jlToggleEngineFailure));
      dwPanel1.add(buildJPanel(btnToggleBrakeFailure));
      dwPanel1.add(buildJPanel(jlToggleBrakeFailure));
      dwPanel1.add(buildJPanel(btnToggleServiceBrake));
      dwPanel1.add(buildJPanel(jlToggleServiceBrake));
      dwPanel1.add(buildJPanel(btnToggleEmergencyBrake));
      dwPanel1.add(buildJPanel(jlToggleEmergencyBrake));
      JPanel dwPanel2 = new JPanel();
      dwPanel2.setLayout(new GridLayout(18, 2));
      dwPanel2.add(buildJPanel(new JLabel("Lights Status", JLabel.CENTER)));
      dwPanel2.add(buildJPanel(jlLights));
      dwPanel2.add(buildJPanel(btnSetManLights));
      dwPanel2.add(buildJPanel(jlManLights));
      dwPanel2.add(buildJPanel(btnToggleManLights));
      dwPanel2.add(buildJPanel(jlToggleManLights));
      dwPanel2.add(buildJPanel(new JLabel("Doors Status", JLabel.CENTER)));
      dwPanel2.add(buildJPanel(jlDoors));
      dwPanel2.add(buildJPanel(btnSetManDoors));
      dwPanel2.add(buildJPanel(jlManDoors));
      dwPanel2.add(buildJPanel(btnToggleManDoors));
      dwPanel2.add(buildJPanel(jlToggleManDoors));
      dwPanel2.add(buildJPanel(new JLabel("Current Temp. (degrees F)", JLabel.CENTER)));
      dwPanel2.add(buildJPanel(jlCurTemperature));
      dwPanel2.add(buildJPanel(new JLabel("Target Temp. from TNC (degrees F)", JLabel.CENTER)));
      dwPanel2.add(buildJPanel(jlTarTemperature));
      dwPanel2.add(buildJPanel(btnSetManTarTemperature));
      dwPanel2.add(buildJPanel(jlManTarTemperature));
      dwPanel2.add(buildJPanel(btnToggleManTarTemperature));
      dwPanel2.add(buildJPanel(jlToggleManTarTemperature));
      dwPanel2.add(buildJPanel(new JLabel("Announcement", JLabel.CENTER)));
      dwPanel2.add(buildJPanel(jlAnnouncement));

      JPanel primaryButtons = new JPanel();
      primaryButtons.setLayout(new GridLayout(1, 4));
      primaryButtons.add(btnShowStaticValues);
      primaryButtons.add(btnSelectTrain);
      primaryButtons.add(btnPauseResume);
      primaryButtons.add(buildJPanel(jlTime));

      JPanel jp = new JPanel();
      jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS));
      jp.add(primaryButtons);
      jp.add(emptyJPanel);
      jp.add(new JSeparator(JSeparator.HORIZONTAL));
      jp.add(dwPanel1);
      jp.add(new JSeparator(JSeparator.HORIZONTAL));
      jp.add(dwPanel2);

      jp.setMaximumSize(new Dimension(400, 700));

      JScrollPane dScroll = new JScrollPane(jp);
      dScroll.setViewportView(jp);

      dynamicWindow = new JFrame();
      dynamicWindow.setTitle("Train Model (Chris Paskie)   -   UI   (Train ID:   --)");
      dynamicWindow.setSize(600, 400);
      dynamicWindow.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
      dynamicWindow.add(dScroll);
      isVisible = false;
      dynamicWindow.setVisible(isVisible);

      // Setup the staticWindow.

      jlLength = new JLabel("", JLabel.CENTER);
      jlWidth = new JLabel("", JLabel.CENTER);
      jlHeight = new JLabel("", JLabel.CENTER);
      jlNumCars = new JLabel("", JLabel.CENTER);
      jlMotorPower = new JLabel("", JLabel.CENTER);
      jlMaxSpeed = new JLabel("", JLabel.CENTER);
      jlServiceBrakeDecel = new JLabel("", JLabel.CENTER);
      jlEmergencyBrakeDecel = new JLabel("", JLabel.CENTER);
      jlFrictionCoeff = new JLabel("", JLabel.CENTER);
      jlEmptyTrainMass = new JLabel("", JLabel.CENTER);
      jlPersonMass = new JLabel("", JLabel.CENTER);
      jlMaxSeatedCount = new JLabel("", JLabel.CENTER);
      jlMaxStandingCount = new JLabel("", JLabel.CENTER);
      jlMaxCrewCount = new JLabel("", JLabel.CENTER);

      JPanel swPanel = new JPanel();
      swPanel.setLayout(new GridLayout(14, 2));
      swPanel.add(buildJPanel(new JLabel("Length (m)", JLabel.CENTER)));
      swPanel.add(buildJPanel(jlLength));
      swPanel.add(buildJPanel(new JLabel("Width (m)", JLabel.CENTER)));
      swPanel.add(buildJPanel(jlWidth));
      swPanel.add(buildJPanel(new JLabel("Height (m)", JLabel.CENTER)));
      swPanel.add(buildJPanel(jlHeight));
      swPanel.add(buildJPanel(new JLabel("Number of Cars", JLabel.CENTER)));
      swPanel.add(buildJPanel(jlNumCars));
      swPanel.add(buildJPanel(new JLabel("Motor Power (W)", JLabel.CENTER)));
      swPanel.add(buildJPanel(jlMotorPower));
      swPanel.add(buildJPanel(new JLabel("Maximum Speed (m/s)", JLabel.CENTER)));
      swPanel.add(buildJPanel(jlMaxSpeed));
      swPanel.add(buildJPanel(new JLabel("Service Brake Deceleration (m/s^2)", JLabel.CENTER)));
      swPanel.add(buildJPanel(jlServiceBrakeDecel));
      swPanel.add(buildJPanel(new JLabel("Emergency Brake Deceleration (m/s^2)", JLabel.CENTER)));
      swPanel.add(buildJPanel(jlEmergencyBrakeDecel));
      swPanel.add(buildJPanel(new JLabel("Coefficient of Friction", JLabel.CENTER)));
      swPanel.add(buildJPanel(jlFrictionCoeff));
      swPanel.add(
          buildJPanel(new JLabel("Train Mass (not inc. passengers/crew) (kg)", JLabel.CENTER)));
      swPanel.add(buildJPanel(jlEmptyTrainMass));
      swPanel.add(buildJPanel(new JLabel("Mass Per Passenger/Crew (kg)", JLabel.CENTER)));
      swPanel.add(buildJPanel(jlPersonMass));
      swPanel.add(buildJPanel(new JLabel("Maximum Seated Passenger Count", JLabel.CENTER)));
      swPanel.add(buildJPanel(jlMaxSeatedCount));
      swPanel.add(buildJPanel(new JLabel("Maximum Standing Passenger Count", JLabel.CENTER)));
      swPanel.add(buildJPanel(jlMaxStandingCount));
      swPanel.add(buildJPanel(new JLabel("Maximum Crew Count", JLabel.CENTER)));
      swPanel.add(buildJPanel(jlMaxCrewCount));

      staticWindow = new JFrame();
      staticWindow.setTitle("Train Model (Chris Paskie)   -   Static Values   (Train ID:   --)");
      staticWindow.setSize(700, 600);
      staticWindow.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
      staticWindow.add(swPanel);
      isVisibleStatic = false;
      staticWindow.setVisible(isVisibleStatic);

      // Set up the TNC UI.
      if (!isSolo) {
        tncUI = new TNC_UI();
      }

    } catch (Exception e) {
      e.printStackTrace(System.err);
      JOptionPane.showMessageDialog(null, e, "Error", JOptionPane.ERROR_MESSAGE);
    }
  }
Exemplo n.º 8
0
  private void init() throws Exception {
    this.setResizable(true);
    String title = "Edit owners";
    if (propText.size() == 0) {
      title += " (no propositions selected)";
    } else if (propText.size() == 1) {
      title +=
          " of proposition: \""
              + DiagramBase.prepareMessageLabel(
                  (String) propText.elementAt(0), DiagramBase.MAX_MESSAGELABEL_SIZE)
              + "\"";
    } else {
      title += " (" + propText.size() + " propositions selected)";
    }
    this.setTitle(title);
    masterPanel = new SizedPanel(600, 300);
    masterPanel.setLayout(new BorderLayout());
    this.getContentPane().add(masterPanel);
    //    okButton.setActionCommand("okButton");
    okButton.setMnemonic(KeyEvent.VK_C);
    buttonPanel.add(okButton);
    okButton.addActionListener(this);
    masterPanel.add(buttonPanel, BorderLayout.SOUTH);

    TablePanel ownerSourcePanel = new TablePanel(new BorderLayout());

    JPanel topSourcePanel = new JPanel(new BorderLayout());
    topSourcePanel.add(new JLabel("Owner name:", JLabel.LEFT), BorderLayout.NORTH);
    ownerText = new JTextField();
    topSourcePanel.add(ownerText, BorderLayout.CENTER);
    JPanel buttonSourcePanel = new JPanel();
    deleteSourceButton = new JButton("Delete");
    deleteSourceButton.setMnemonic(KeyEvent.VK_D);
    deleteSourceButton.addActionListener(this);
    addOwnerButton = new JButton("Add");
    addOwnerButton.setMnemonic(KeyEvent.VK_A);
    addOwnerButton.addActionListener(this);
    buttonSourcePanel.add(addOwnerButton);
    buttonSourcePanel.add(deleteSourceButton);
    topSourcePanel.add(buttonSourcePanel, BorderLayout.SOUTH);
    ownerSourcePanel.add(topSourcePanel, BorderLayout.SOUTH);

    ownerSourceTable = new JTable();
    ownerSourceScrollPane = new JScrollPane();
    ownerSourceScrollPane.setViewportView(ownerSourceTable);
    ownerSourcePanel.add(new JLabel("Available owners", JLabel.CENTER), BorderLayout.NORTH);
    ownerSourcePanel.add(ownerSourceScrollPane, BorderLayout.CENTER);
    ownerSourceTableModel = new OwnerSourceTableModel(araucaria, ownerSourceTable, this);
    ownerSourceTable.setModel(ownerSourceTableModel);
    ownerSourceTableModel.updateTable(araucaria.getArgument().getOwnerList());
    masterPanel.add(ownerSourcePanel, BorderLayout.WEST);

    TablePanel ownerNodesPanel = new TablePanel(new BorderLayout());
    ownerNodesTable = new JTable();
    ownerNodesScrollPane = new JScrollPane();
    ownerNodesScrollPane.setViewportView(ownerNodesTable);
    ownerNodesPanel.add(
        new JLabel("Owners assigned to proposition(s)", JLabel.CENTER), BorderLayout.NORTH);
    ownerNodesPanel.add(ownerNodesScrollPane, BorderLayout.CENTER);
    ownerNodesTableModel = new OwnerNodesTableModel(araucaria, ownerNodesTable);
    ownerNodesTable.setModel(ownerNodesTableModel);
    ownerNodesTableModel.updateTable(araucaria.getArgument().getSelectedVertexOwners());
    masterPanel.add(ownerNodesPanel, BorderLayout.EAST);

    setupArrows();
    JPanel arrowBox = new JPanel(new GridLayout(3, 1, 10, 10));
    if (propText.size() > 0) {
      arrowBox.add(leftArrow);
      arrowBox.add(rightArrow);
    }
    JPanel arrowPanel = new JPanel();
    arrowPanel.add(arrowBox);
    masterPanel.add(arrowPanel, BorderLayout.CENTER);
  }
Exemplo n.º 9
0
  public CellarGUI(Cellar model) {
    this.model = model;
    setTitle("Cellar");
    setSize(new Dimension(1000, 600));
    setResizable(false);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setLayout(new BorderLayout());
    health.setPreferredSize(new Dimension(200, 10));
    exp.setPreferredSize(new Dimension(200, 10));
    currentRoom.setPreferredSize(new Dimension(200, 10));
    spacer.setPreferredSize(new Dimension(200, 115));
    magicLabel.setPreferredSize(new Dimension(200, 10));
    magicLabel.setHorizontalAlignment(JLabel.CENTER);
    playerItemLabel.setText("Player's Items (Max 1)");
    setLabels();

    JScrollPane playerItemsPane = new JScrollPane();
    playerItemsList.setListData(model.getPlayer().getItemList().toArray());
    playerItemsPane.setViewportView(playerItemsList);
    playerItemsPane.setPreferredSize(new Dimension(200, 125));
    JButton drop = new JButton("Drop Item");
    drop.addActionListener(this);
    drop.setPreferredSize(new Dimension(200, 25));

    JScrollPane roomItemsPane = new JScrollPane();
    roomItemsList = new JList(getRoomItems());
    roomItemsPane.setViewportView(roomItemsList);
    roomItemsPane.setPreferredSize(new Dimension(200, 125));
    JButton pickUp = new JButton("Pick Up");
    pickUp.addActionListener(this);
    pickUp.setPreferredSize(new Dimension(200, 25));

    JScrollPane hallsPane = new JScrollPane();
    hallList = new JList(getHalls());
    hallsPane.setViewportView(hallList);
    hallsPane.setPreferredSize(new Dimension(200, 200));
    JButton enterHall = new JButton("Enter Hallway");
    enterHall.setPreferredSize(new Dimension(200, 25));
    enterHall.addActionListener(this);

    JScrollPane outputPane = new JScrollPane();
    output = new JTextArea();
    outputPane.setPreferredSize(new Dimension(550, 550));
    output.setEditable(false);
    output.setBorder(BorderFactory.createLineBorder(Color.black));
    outputPane.setViewportView(output);

    JLabel roomItemLabel = new JLabel("Items in the Room");
    JLabel hallsLabel = new JLabel("Hallways");
    JPanel rightPanel = new JPanel();
    JPanel leftPanel = new JPanel();
    rightPanel.add(playerItemLabel);
    rightPanel.add(playerItemsPane);
    rightPanel.add(drop);
    rightPanel.add(roomItemLabel);
    rightPanel.add(roomItemsPane);
    rightPanel.add(pickUp);
    rightPanel.add(magicLabel);
    rightPanel.add(magic);
    rightPanel.add(spacer);
    rightPanel.add(health);
    rightPanel.add(exp);
    rightPanel.add(currentRoom);
    rightPanel.setPreferredSize(new Dimension(200, 600));
    rightPanel.setBackground(Color.WHITE);
    leftPanel.add(hallsLabel);
    leftPanel.add(hallsPane);
    leftPanel.add(enterHall);
    leftPanel.setPreferredSize(new Dimension(200, 600));
    leftPanel.setBackground(Color.WHITE);
    add(outputPane, BorderLayout.CENTER);
    add(rightPanel, BorderLayout.WEST);
    add(leftPanel, BorderLayout.EAST);
  }
Exemplo n.º 10
0
  private void initComponents() {

    dialogPane = new JPanel();
    contentPanel = new JPanel();
    scrollPane1 = new JScrollPane();
    table = new JTable();
    filterPanel = new JPanel();
    filterLabel = new JLabel();
    filterTextField = new JTextField();
    rowCountLabel = new JLabel();
    buttonBar = new JPanel();
    okButton = new JButton();
    cancelButton = new JButton();

    getRootPane().setDefaultButton(okButton);

    final String filterToolTip =
        "Enter multiple filter strings separated by commas.  e.g.  GM12878, ChipSeq";
    filterLabel.setToolTipText(filterToolTip);
    filterTextField.setToolTipText(filterToolTip);

    // ======== this ========
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    // ======== dialogPane ========

    dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12));
    dialogPane.setLayout(new BorderLayout());

    // ======== contentPanel ========

    contentPanel.setLayout(new BorderLayout(0, 10));

    // ======== scrollPane1 ========

    scrollPane1.setViewportView(table);

    contentPanel.add(scrollPane1, BorderLayout.CENTER);

    // ======== panel1 ========

    filterPanel.setLayout(new JideBoxLayout(filterPanel, JideBoxLayout.X_AXIS, 5));

    // ---- label1 ----
    filterLabel.setText("Filter:");
    filterPanel.add(filterLabel, JideBoxLayout.FIX);

    // ---- filterTextField ----
    filterPanel.add(filterTextField, JideBoxLayout.VARY);

    rowCountLabel.setHorizontalAlignment(JLabel.RIGHT);
    JPanel sillyPanel = new JPanel();
    sillyPanel.setLayout(new JideBoxLayout(sillyPanel, JideBoxLayout.X_AXIS, 0));
    sillyPanel.setPreferredSize(new Dimension(100, 28));
    sillyPanel.add(rowCountLabel, JideBoxLayout.VARY);

    filterPanel.add(sillyPanel, JideBoxLayout.FIX);

    contentPanel.add(filterPanel, BorderLayout.NORTH);

    dialogPane.add(contentPanel, BorderLayout.CENTER);

    // ======== buttonBar ========

    buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0));
    buttonBar.setLayout(new GridBagLayout());
    ((GridBagLayout) buttonBar.getLayout()).columnWidths = new int[] {0, 85, 80};
    ((GridBagLayout) buttonBar.getLayout()).columnWeights = new double[] {1.0, 0.0, 0.0};

    // ---- okButton ----
    okButton.setText("Load");
    okButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            loadButtonActionPerformed(e);
          }
        });
    buttonBar.add(
        okButton,
        new GridBagConstraints(
            1,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(0, 0, 0, 5),
            0,
            0));

    // ---- cancelButton ----
    cancelButton.setText("Cancel");
    cancelButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            cancelButtonActionPerformed(e);
          }
        });
    buttonBar.add(
        cancelButton,
        new GridBagConstraints(
            2,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(0, 0, 0, 0),
            0,
            0));

    dialogPane.add(buttonBar, BorderLayout.SOUTH);

    contentPane.add(dialogPane, BorderLayout.CENTER);
    setSize(700, 620);
    setLocationRelativeTo(getOwner());
  }
  /** GUI element creating and arrangment. Partially generated using NetBeans IDE GUI utilities. */
  @SuppressWarnings("unchecked")
  private void initComponents() {
    jButtonOldPackages = new JButton();
    jTextDate = new JTextField();
    jButtonSetLost = new JButton();
    jButtonSetFound = new JButton();
    jButtonShowLost = new JButton();
    jButtonExit = new JButton();
    jButtonReset = new JButton();
    jScrollPane1 = new JScrollPane();
    jListScans = new JList();
    jScrollPane2 = new JScrollPane();
    jListPackages = new JList();

    jButtonSetFound.setEnabled(false);
    jButtonSetLost.setEnabled(false);

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

    jButtonOldPackages.setText("Timed out packages");
    jButtonOldPackages.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            buttonOldPackagesActionPerformed(event);
          }
        });

    ListSelectionListener listSelectionListener =
        new ListSelectionListener() {
          public void valueChanged(ListSelectionEvent event) {
            jListPackagesActionPertformed(event);
          }
        };

    jButtonExit.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            System.exit(0);
          }
        });

    jButtonSetLost.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            buttonSetLostActionPerformed(event);
          }
        });

    jButtonSetFound.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            buttonSetFoundActionPerformed(event);
          }
        });

    jButtonShowLost.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            buttonShowLostActionPerformed(event);
          }
        });

    jButtonReset.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            reset(event);
          }
        });

    jListPackages.addListSelectionListener(listSelectionListener);

    jButtonSetLost.setText("List as Lost");
    jButtonShowLost.setText("Lost Packages");
    jButtonSetFound.setText("List as Found");
    jButtonExit.setText("Logout");
    jButtonReset.setText("Reset");

    jScrollPane2.setViewportView(jListPackages);
    jScrollPane2.setPreferredSize(new Dimension(200, 200));
    jListPackages.setFixedCellWidth(400);

    jScrollPane1.setViewportView(jListScans);
    // Layout
    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(
                        jScrollPane2,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        300,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(111, 111, 111)
                    .addComponent(
                        jScrollPane1,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        300,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(111, 111, 111)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(
                                jTextDate,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                120,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                jButtonSetLost, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(
                                jButtonOldPackages, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(
                                jButtonShowLost, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(
                                jButtonSetFound, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jButtonReset, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jButtonExit, javax.swing.GroupLayout.Alignment.TRAILING))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addGap(42, 42, 42)
                                    .addComponent(
                                        jTextDate,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jButtonOldPackages)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jButtonSetLost)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jButtonSetFound)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jButtonShowLost)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jButtonReset)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jButtonExit))
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addContainerGap()
                                    .addComponent(
                                        jScrollPane1,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        258,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(
                                jScrollPane2,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                289,
                                Short.MAX_VALUE))
                    .addContainerGap()));

    pack();
  }
Exemplo n.º 12
0
  @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">
  private void initComponents() {
    this.title = new javax.swing.JLabel();
    this.iconLabel = new javax.swing.JLabel();
    this.exportBtn = new javax.swing.JButton();
    this.searchBtn = new javax.swing.JButton();
    JScrollPane scroll = new JScrollPane();
    this.table = new javax.swing.JTable();
    this.search = new javax.swing.JTextField();

    Platform.runLater(
        () -> {
          this.graphPanel.setScene(createScene());
        });

    this.title.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
    this.title.setText("text");

    this.search = new JTextField("Search");
    this.search.setForeground(Color.LIGHT_GRAY);

    this.searchBtn.setText("Search");
    this.searchBtn.addActionListener(
        (e) -> {
          String searchString = search.getText();

          DefaultTableModel resultModel = getNewModel();
          DefaultTableModel oldModel =
              this.modelBackup == null
                  ? (DefaultTableModel) this.table.getModel()
                  : this.modelBackup;
          Pattern p = Pattern.compile(String.format(".*?%s.*?", searchString));
          int rows = oldModel.getRowCount();
          int cols = oldModel.getColumnCount();
          Vector dv = oldModel.getDataVector();

          for (int row = 0; row < rows; row++) {
            Vector v = (Vector) dv.get(row);
            for (int col = 0; col < cols; col++) {
              Object o = v.get(col);
              if (o != null) {
                Matcher m = p.matcher(o.toString());
                if (m.matches()) {
                  resultModel.addRow(v);
                  break;
                }
              }
            }
          }

          if (resultModel.getRowCount() != oldModel.getRowCount()
              && resultModel.getRowCount() > 0) {
            if (this.modelBackup == null) {
              this.modelBackup = oldModel;
            }
            this.table.setModel(resultModel);
            resultModel.fireTableDataChanged();
          }
        });

    table.setDefaultRenderer(
        Integer.class,
        new DefaultTableCellRenderer() {
          @Override
          public Component getTableCellRendererComponent(
              JTable table,
              Object value,
              boolean isSelected,
              boolean hasFocus,
              int row,
              int column) {
            JLabel label =
                (JLabel)
                    super.getTableCellRendererComponent(
                        table, value, isSelected, hasFocus, row, column);
            label.setHorizontalAlignment(JLabel.LEFT);
            return label;
          }
        });

    this.search.addKeyListener(
        new KeyAdapter() {
          @Override
          public void keyPressed(KeyEvent e) {
            if ("search".equalsIgnoreCase(ConnectionDialog.this.search.getText())) {
              ConnectionDialog.this.search.setForeground(Color.LIGHT_GRAY);
            } else {
              ConnectionDialog.this.search.setForeground(Color.BLACK);
            }
            if (ConnectionDialog.this.search.getText().length() == 0
                && ConnectionDialog.this.modelBackup != null) {
              ConnectionDialog.this.table.setModel(ConnectionDialog.this.modelBackup);
              ConnectionDialog.this.modelBackup.fireTableDataChanged();
              ConnectionDialog.this.modelBackup = null;
            }
          }
        });
    MouseAdapter removableListner =
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            if ("search".equalsIgnoreCase(ConnectionDialog.this.search.getText())) {
              ConnectionDialog.this.search.setText("");
              ConnectionDialog.this.search.removeMouseListener(this);
            }
          }
        };
    this.search.addMouseListener(removableListner);

    this.iconLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    this.iconLabel.setIcon(Icons.Error.getIcon32()); // NOI18N
    this.iconLabel.setBorder(
        javax.swing.BorderFactory.createMatteBorder(1, 1, 1, 1, new java.awt.Color(204, 204, 204)));

    this.exportBtn.setText("Export to CSV");
    this.exportBtn.addActionListener(this::exportBtnActionPerformed);
    this.hideBroadCast = new JCheckBox("Hide Broadcast / Multicast");
    this.hideBroadCast.addActionListener(this::toggleBroadcastVisibility);
    this.hideBroadCast.setSelected(true);
    scroll.setViewportView(this.table);
    JPanel p = new JPanel();
    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(p);
    p.setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(
                                scroll, javax.swing.GroupLayout.DEFAULT_SIZE, 976, Short.MAX_VALUE)
                            .addComponent(
                                this.graphPanel,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                976,
                                Short.MAX_VALUE)
                            //                    .addComponent(display)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addComponent(this.iconLabel)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(this.title)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        Short.MAX_VALUE)
                                    .addComponent(this.searchBtn)
                                    .addContainerGap()
                                    .addComponent(this.search)))
                    .addContainerGap()));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(this.iconLabel)
                            .addGroup(
                                layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(this.title)
                                    .addComponent(this.searchBtn)
                                    .addComponent(
                                        this.search,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        21,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(
                        scroll, javax.swing.GroupLayout.DEFAULT_SIZE, 343, Short.MAX_VALUE)
                    .addComponent(
                        this.graphPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 342, Short.MAX_VALUE)
                    .addContainerGap()));
    // 457, 228
    setLayout(new BorderLayout());
    add(p, BorderLayout.CENTER);

    JPanel jPanel1 = new JPanel();
    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(
        jPanel1Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                jPanel1Layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(this.hideBroadCast)
                    .addPreferredGap(
                        javax.swing.LayoutStyle.ComponentPlacement.RELATED, 395, Short.MAX_VALUE)
                    .addComponent(this.exportBtn)
                    .addContainerGap()));
    jPanel1Layout.setVerticalGroup(
        jPanel1Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                jPanel1Layout
                    .createSequentialGroup()
                    //                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
                    // Short.MAX_VALUE)
                    .addGroup(
                        jPanel1Layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(
                                this.hideBroadCast, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(
                                this.exportBtn, javax.swing.GroupLayout.Alignment.TRAILING))
                    .addContainerGap()));

    add(jPanel1, BorderLayout.SOUTH);
  } // </editor-fold>
Exemplo n.º 13
0
  // Initialize Components and set the layout of the dialog
  private void initComponents() {
    emailLabel = new JLabel();
    smtpLabel = new JLabel();
    smtpUserLabel = new JLabel();
    smtpPassword = new JPasswordField();
    smtp = new JTextField();
    smtpPort = new JTextField();
    smtpPsswdLabel = new JLabel();
    smtpUsername = new JTextField();
    jScrollPane1 = new JScrollPane();
    studentsTbl = new JXTable();
    ok = new JButton();
    cancel = new JButton();
    smtpPortLabel = new JLabel();
    email = new JTextField();

    setTitle("Send Email");
    setMinimumSize(new Dimension(100, 100));
    setResizable(false);

    emailLabel.setText("Source Email Address:");

    smtpLabel.setText("SMTP Server:");

    smtpUserLabel.setText("SMTP Username:"******"SMTP Password:"******"Send Email");
    ok.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            okActionPerformed(evt);
          }
        });

    cancel.setText("Cancel");
    cancel.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            cancelActionPerformed(evt);
          }
        });

    smtpPortLabel.setText("SMTP Port:");

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addComponent(ok)
                                    .addGap(18, 18, 18)
                                    .addComponent(cancel))
                            .addGroup(
                                layout
                                    .createParallelGroup(
                                        javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(
                                        jScrollPane1,
                                        javax.swing.GroupLayout.Alignment.LEADING,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        0,
                                        Short.MAX_VALUE)
                                    .addGroup(
                                        javax.swing.GroupLayout.Alignment.LEADING,
                                        layout
                                            .createSequentialGroup()
                                            .addGroup(
                                                layout
                                                    .createParallelGroup(
                                                        javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addComponent(smtpLabel)
                                                    .addComponent(smtpPortLabel))
                                            .addPreferredGap(
                                                javax.swing.LayoutStyle.ComponentPlacement
                                                    .UNRELATED)
                                            .addGroup(
                                                layout
                                                    .createParallelGroup(
                                                        javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addGroup(
                                                        layout
                                                            .createSequentialGroup()
                                                            .addGroup(
                                                                layout
                                                                    .createParallelGroup(
                                                                        javax.swing.GroupLayout
                                                                            .Alignment.LEADING)
                                                                    .addGroup(
                                                                        layout
                                                                            .createSequentialGroup()
                                                                            .addComponent(
                                                                                smtp,
                                                                                javax.swing
                                                                                    .GroupLayout
                                                                                    .PREFERRED_SIZE,
                                                                                90,
                                                                                javax.swing
                                                                                    .GroupLayout
                                                                                    .PREFERRED_SIZE)
                                                                            .addGap(18, 18, 18)
                                                                            .addComponent(
                                                                                smtpUserLabel))
                                                                    .addGroup(
                                                                        layout
                                                                            .createSequentialGroup()
                                                                            .addComponent(
                                                                                smtpPort,
                                                                                javax.swing
                                                                                    .GroupLayout
                                                                                    .PREFERRED_SIZE,
                                                                                90,
                                                                                javax.swing
                                                                                    .GroupLayout
                                                                                    .PREFERRED_SIZE)
                                                                            .addGap(18, 18, 18)
                                                                            .addComponent(
                                                                                smtpPsswdLabel)))
                                                            .addGap(18, 18, 18)
                                                            .addGroup(
                                                                layout
                                                                    .createParallelGroup(
                                                                        javax.swing.GroupLayout
                                                                            .Alignment.LEADING)
                                                                    .addComponent(
                                                                        smtpPassword,
                                                                        javax.swing.GroupLayout
                                                                            .PREFERRED_SIZE,
                                                                        90,
                                                                        javax.swing.GroupLayout
                                                                            .PREFERRED_SIZE)
                                                                    .addComponent(
                                                                        smtpUsername,
                                                                        javax.swing.GroupLayout
                                                                            .PREFERRED_SIZE,
                                                                        90,
                                                                        javax.swing.GroupLayout
                                                                            .PREFERRED_SIZE)))
                                                    .addGroup(
                                                        layout
                                                            .createSequentialGroup()
                                                            .addComponent(emailLabel)
                                                            .addPreferredGap(
                                                                javax.swing.LayoutStyle
                                                                    .ComponentPlacement.RELATED)
                                                            .addComponent(
                                                                email,
                                                                javax.swing.GroupLayout
                                                                    .PREFERRED_SIZE,
                                                                121,
                                                                javax.swing.GroupLayout
                                                                    .PREFERRED_SIZE))))))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(
                                emailLabel,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                22,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                email,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(smtpLabel)
                            .addComponent(
                                smtp,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(smtpUserLabel)
                            .addComponent(
                                smtpUsername,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(smtpPortLabel)
                            .addGroup(
                                layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(
                                        smtpPort,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(
                                        smtpPassword,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(smtpPsswdLabel)))
                    .addGap(18, 18, 18)
                    .addComponent(
                        jScrollPane1,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        131,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(18, 18, 18)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cancel)
                            .addComponent(ok))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    pack();
    setLocationRelativeTo(null);
  }
Exemplo n.º 14
0
  public ContextEditor(Context cntxt) {
    super("Edit User Context: " + localFileName(cntxt));
    ctxt = cntxt;
    windowNum = ctxt.languageName + " Context Editor";
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    listener = new CEListener(this);

    JPanel nameBox = new JPanel();
    nameBox.setLayout(new BoxLayout(nameBox, BoxLayout.LINE_AXIS));
    name = new JTextField(ctxt.languageName, 28);
    name.setMaximumSize(new Dimension(225, 22));
    name.addFocusListener(
        new java.awt.event.FocusAdapter() {

          public void focusLost(java.awt.event.FocusEvent evt) {
            nameFocusLost(evt);
          }
        });

    JLabel nameLabel = new JLabel("Language Name: ");
    nameBox.add(nameLabel);
    nameBox.add(name);

    JPanel folderBox = new JPanel();
    folderBox.setLayout(new BoxLayout(folderBox, BoxLayout.LINE_AXIS));
    folder = new JTextField(ctxt.editDirectory);
    folder.setMaximumSize(new Dimension(225, 22));
    //        folder.addActionListener(listener);
    //        folder.setActionCommand("folder edit");
    folder.addFocusListener(
        new java.awt.event.FocusAdapter() {

          public void focusLost(java.awt.event.FocusEvent evt) {
            folderFocusLost(evt);
          }
        });

    JLabel folderLabel = new JLabel("SILK file folder: ");
    folderBox.add(folderLabel);
    folderBox.add(folder);

    JPanel nameFolderBox = new JPanel();
    nameFolderBox.setLayout(new BoxLayout(nameFolderBox, BoxLayout.PAGE_AXIS));
    nameBox.setAlignmentX(0.5f);
    nameFolderBox.add(nameBox);
    nameFolderBox.add(Box.createRigidArea(new Dimension(0, 4)));
    nameFolderBox.add(folderBox);
    nameFolderBox.setAlignmentX(0.5f);

    buildPopulationBox();

    JPanel btnBoxUDPs = new JPanel(), subBoxUDP = new JPanel();
    btnBoxUDPs.setLayout(new BoxLayout(btnBoxUDPs, BoxLayout.PAGE_AXIS));
    subBoxUDP.setLayout(new BoxLayout(subBoxUDP, BoxLayout.LINE_AXIS));
    int numUDPs = 0;
    if (ctxt.userDefinedProperties != null) {
      numUDPs = ctxt.userDefinedProperties.size();
    }
    String plur = "ies";
    if (numUDPs == 1) {
      plur = "y";
    }
    JLabel udpLabel = new JLabel("Has " + numUDPs + " User-Defined Propert" + plur);
    subBoxUDP.add(udpLabel);
    JButton addUDP = new JButton("Add UDP");
    addUDP.setActionCommand("add UDP");
    addUDP.addActionListener(listener);
    subBoxUDP.add(addUDP);
    btnBoxUDPs.add(subBoxUDP);
    if (numUDPs > 0) {
      Dimension sizer = new Dimension(250, 50);
      String[] udpMenu = genUDPMenu();
      UDPick = new JComboBox(udpMenu);
      UDPick.addActionListener(listener);
      UDPick.setActionCommand("view/edit UDP");
      UDPick.setMinimumSize(sizer);
      UDPick.setMaximumSize(sizer);
      UDPick.setBorder(
          BorderFactory.createTitledBorder(
              BorderFactory.createLineBorder(Color.blue), "View/Edit UDPs"));
      btnBoxUDPs.add(UDPick);
    } //  end of if-any-UDPs-exist

    JPanel domThs = new JPanel();
    domThs.setLayout(new BoxLayout(domThs, BoxLayout.PAGE_AXIS));
    domThs.setBorder(
        BorderFactory.createTitledBorder(
            BorderFactory.createLineBorder(Color.blue), "Kinship System Domain Theories"));
    domThs.setAlignmentX(0.5f);
    JPanel dtRefBtnBox = new JPanel();
    dtRefBtnBox.setLayout(new BoxLayout(dtRefBtnBox, BoxLayout.LINE_AXIS));
    dtRefBtnBox.setAlignmentX(0.0f);
    JLabel dtRefLabel = new JLabel("Terms of Reference ");
    dtRefBtnBox.add(dtRefLabel);
    if (ctxt.domTheoryRefExists()) {
      JButton dtRefEdit = new JButton("Edit Theory");
      dtRefEdit.setActionCommand("edit dtRef");
      dtRefEdit.addActionListener(listener);
      dtRefBtnBox.add(dtRefEdit);
      //            JButton dtRefDelete = new JButton("Delete Theory");
      //            dtRefDelete.setActionCommand("dtRef delete");
      //            dtRefDelete.addActionListener(listener);
      //            dtRefBtnBox.add(dtRefDelete);
    } //  end of if-dt-exists
    else { //  if does not exist
      JLabel dtRefNone = new JLabel("< None >");
      dtRefBtnBox.add(dtRefNone);
      //            JButton dtRefAdd = new JButton("Add Theory");
      //            dtRefAdd.setActionCommand("dtRef add");
      //            dtRefAdd.addActionListener(listener);
      //            dtRefBtnBox.add(dtRefAdd);
    } //  end of does-not-exist
    domThs.add(dtRefBtnBox);

    JPanel dtAddrBtnBox = new JPanel();
    dtAddrBtnBox.setLayout(new BoxLayout(dtAddrBtnBox, BoxLayout.LINE_AXIS));
    dtAddrBtnBox.setAlignmentX(0.0f);
    JLabel dtAddrLabel = new JLabel("Terms of Address ");
    dtAddrBtnBox.add(dtAddrLabel);
    if (ctxt.domTheoryAdrExists()) {
      JButton dtAddrEdit = new JButton("Edit Theory");
      dtAddrEdit.setActionCommand("edit dtAddr");
      dtAddrEdit.addActionListener(listener);
      dtAddrBtnBox.add(dtAddrEdit);
      //            JButton dtAddrViewList = new JButton("Delete Theory");
      //            dtAddrViewList.setActionCommand("dtAddr delete");
      //            dtAddrViewList.addActionListener(listener);
      //            dtAddrBtnBox.add(dtAddrViewList);
    } //  end of if-dt-exists
    else { //  if does not exist
      JLabel dtAddrNone = new JLabel("< None >");
      dtAddrBtnBox.add(dtAddrNone);
      //            JButton dtAddrAdd = new JButton("Add Theory");
      //            dtAddrAdd.setActionCommand("dtAddr add");
      //            dtAddrAdd.addActionListener(listener);
      //            dtAddrBtnBox.add(dtAddrAdd);
    } //  end of does-not-exist
    domThs.add(dtAddrBtnBox);
    // End of the left hand portion
    // Right hand portion follows. it is narrower.

    JPanel polyBox = new JPanel();
    polyBox.setLayout(new BoxLayout(polyBox, BoxLayout.PAGE_AXIS));
    polyBox.setAlignmentX(0.5f);
    JLabel polyLabelA = new JLabel("Polygamy");
    JLabel polyLabelB = new JLabel("Permitted?");
    JRadioButton yesPoly = new JRadioButton("Yes");
    yesPoly.setActionCommand("polygamy yes");
    yesPoly.addActionListener(listener);
    JRadioButton noPoly = new JRadioButton("No");
    noPoly.setActionCommand("polygamy no");
    noPoly.addActionListener(listener);
    if (cntxt.polygamyPermit) {
      yesPoly.setSelected(true);
    } else {
      noPoly.setSelected(true);
    }
    ButtonGroup polyBtns = new ButtonGroup();
    polyBtns.add(yesPoly);
    polyBtns.add(noPoly);
    polyBox.add(polyLabelA);
    polyBox.add(polyLabelB);
    polyBox.add(yesPoly);
    polyBox.add(noPoly);

    JPanel matrixBox = new JPanel();
    matrixBox.setLayout(new BoxLayout(matrixBox, BoxLayout.PAGE_AXIS));
    matrixBox.setAlignmentX(0.5f);
    JLabel matrixLabelA = new JLabel("Kin Term Matrix");
    JLabel matrixLabelC = new JLabel(ctxt.indSerNumGen + " rows");
    JLabel matrixLabelD = new JLabel(ctxt.ktm.numberOfKinTerms() + " terms");
    matrixLabelA.setAlignmentX(0.5f);
    matrixLabelC.setAlignmentX(0.5f);
    matrixLabelD.setAlignmentX(0.5f);
    JButton matrixEditBtn = new JButton("Edit Matrix");
    matrixEditBtn.setEnabled(false);
    matrixEditBtn.setActionCommand("edit matrix");
    matrixEditBtn.addActionListener(listener);
    matrixEditBtn.setAlignmentX(0.5f);
    matrixBox.add(matrixLabelA);
    matrixBox.add(matrixLabelC);
    matrixBox.add(matrixLabelD);
    matrixBox.add(matrixEditBtn);

    JPanel distinctBox = new JPanel();
    distinctBox.setLayout(new BoxLayout(distinctBox, BoxLayout.PAGE_AXIS));
    distinctBox.setAlignmentX(0.5f);
    JLabel distinctLabelA = new JLabel("Distinct Terms");
    JLabel distinctLabelB = new JLabel("of Address");
    distinctLabelA.setAlignmentX(0.5f);
    distinctLabelB.setAlignmentX(0.5f);
    JRadioButton yesDistinct = new JRadioButton("Yes");
    yesDistinct.setActionCommand("distinct yes");
    yesDistinct.addActionListener(listener);
    JRadioButton noDistinct = new JRadioButton("No");
    noDistinct.setActionCommand("distinct no");
    noDistinct.addActionListener(listener);
    yesDistinct.setAlignmentX(0.5f);
    noDistinct.setAlignmentX(0.5f);
    if (ctxt.distinctAdrTerms) {
      yesDistinct.setSelected(true);
    } else {
      noDistinct.setSelected(true);
    }
    ButtonGroup distinctBtns = new ButtonGroup();
    distinctBtns.add(yesDistinct);
    distinctBtns.add(noDistinct);
    distinctBox.add(distinctLabelA);
    distinctBox.add(distinctLabelB);
    distinctBox.add(yesDistinct);
    distinctBox.add(noDistinct);

    /*
     * NOTE: It should be possible to put all these elements directly into
     * the ContentPane. But that doesn't work; the layout is truly ugly and
     * stuff gets stacked on top of other stuff. What works is to put
     * everything into a JPanel with BoxLayout. Then put the JPanel into
     * ContentPane.
     */
    JPanel leftCol = new JPanel();
    leftCol.setLayout(new BoxLayout(leftCol, BoxLayout.PAGE_AXIS));
    leftCol.add(nameFolderBox);
    leftCol.add(Box.createRigidArea(new Dimension(0, 4)));
    leftCol.add(populationBox);
    leftCol.add(Box.createRigidArea(new Dimension(0, 8)));
    leftCol.add(btnBoxUDPs);
    leftCol.add(Box.createRigidArea(new Dimension(0, 8)));
    leftCol.add(domThs);
    leftCol.add(new JLabel(" "));

    JPanel rightCol = new JPanel();
    rightCol.setLayout(new BoxLayout(rightCol, BoxLayout.PAGE_AXIS));
    rightCol.setBorder(
        BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.blue), "Options"));
    rightCol.add(Box.createRigidArea(new Dimension(0, 20)));
    rightCol.add(polyBox);
    rightCol.add(Box.createRigidArea(new Dimension(0, 20)));
    rightCol.add(matrixBox);
    int high = (numUDPs > 0 ? 120 : 20);
    rightCol.add(Box.createRigidArea(new Dimension(0, high)));
    rightCol.add(distinctBox);

    JPanel commentBox = new JPanel();
    commentBox.setLayout(new BoxLayout(commentBox, BoxLayout.PAGE_AXIS));
    commentBox.setBorder(
        BorderFactory.createTitledBorder(
            BorderFactory.createLineBorder(Color.blue), "Notes on this culture:"));
    JScrollPane commentsPane = new JScrollPane();
    comments = new JTextArea();
    comments.setColumns(20);
    comments.setEditable(true);
    comments.setRows(3);
    comments.setText(PersonPanel.restoreLineBreaks(ctxt.comments));
    comments.getDocument().addDocumentListener(new CommentListener());
    commentsPane.setViewportView(comments);
    commentBox.add(commentsPane);

    JPanel guts = new JPanel(); // Holds the guts of this window
    guts.setLayout(new BoxLayout(guts, BoxLayout.LINE_AXIS));
    guts.add(leftCol);
    guts.add(Box.createRigidArea(new Dimension(10, 4)));
    guts.add(rightCol);

    JPanel wholeThing = new JPanel();
    wholeThing.setLayout(new BoxLayout(wholeThing, BoxLayout.PAGE_AXIS));
    wholeThing.add(Box.createRigidArea(new Dimension(0, 4)));
    wholeThing.add(guts);
    wholeThing.add(Box.createRigidArea(new Dimension(0, 8)));
    wholeThing.add(commentBox);
    wholeThing.add(Box.createRigidArea(new Dimension(0, 4)));

    getContentPane().add(wholeThing);

    addInternalFrameListener(this);
    setSize(600, 620);
    setVisible(true);
  } //  end of ContextEditor constructor
Exemplo n.º 15
0
 /**
  * Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT edit this method OR
  * call it in your code!
  *
  * @noinspection ALL
  */
 private void $$$setupUI$$$() {
   contentPane = new JPanel();
   contentPane.setLayout(new GridLayoutManager(4, 1, new Insets(10, 10, 10, 10), -1, -1));
   final JPanel panel1 = new JPanel();
   panel1.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1));
   contentPane.add(
       panel1,
       new GridConstraints(
           3,
           0,
           1,
           1,
           GridConstraints.ANCHOR_SOUTH,
           GridConstraints.FILL_HORIZONTAL,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
           1,
           null,
           null,
           null,
           0,
           false));
   final JPanel panel2 = new JPanel();
   panel2.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1));
   panel1.add(
       panel2,
       new GridConstraints(
           1,
           0,
           1,
           1,
           GridConstraints.ANCHOR_EAST,
           GridConstraints.FILL_VERTICAL,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
           null,
           null,
           null,
           0,
           false));
   btImport = new JButton();
   btImport.setText("Import");
   panel2.add(
       btImport,
       new GridConstraints(
           0,
           0,
           1,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_HORIZONTAL,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           null,
           null,
           0,
           false));
   btCancel = new JButton();
   btCancel.setEnabled(false);
   btCancel.setText("Cancel");
   panel2.add(
       btCancel,
       new GridConstraints(
           0,
           1,
           1,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_HORIZONTAL,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           null,
           null,
           0,
           false));
   btClose = new JButton();
   btClose.setText("Close");
   panel2.add(
       btClose,
       new GridConstraints(
           0,
           2,
           1,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_HORIZONTAL,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           null,
           null,
           0,
           false));
   final JSeparator separator1 = new JSeparator();
   panel1.add(
       separator1,
       new GridConstraints(
           0,
           0,
           1,
           1,
           GridConstraints.ANCHOR_NORTH,
           GridConstraints.FILL_HORIZONTAL,
           GridConstraints.SIZEPOLICY_WANT_GROW,
           GridConstraints.SIZEPOLICY_WANT_GROW,
           null,
           null,
           null,
           0,
           false));
   final JPanel panel3 = new JPanel();
   panel3.setLayout(new GridLayoutManager(4, 4, new Insets(0, 0, 0, 0), -1, -1));
   contentPane.add(
       panel3,
       new GridConstraints(
           0,
           0,
           1,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_BOTH,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
           null,
           null,
           null,
           0,
           false));
   final JLabel label1 = new JLabel();
   label1.setText("File path:");
   panel3.add(
       label1,
       new GridConstraints(
           1,
           0,
           1,
           1,
           GridConstraints.ANCHOR_EAST,
           GridConstraints.FILL_NONE,
           GridConstraints.SIZEPOLICY_FIXED,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           null,
           null,
           0,
           false));
   tfFilePath = new JTextField();
   panel3.add(
       tfFilePath,
       new GridConstraints(
           1,
           1,
           1,
           2,
           GridConstraints.ANCHOR_WEST,
           GridConstraints.FILL_HORIZONTAL,
           GridConstraints.SIZEPOLICY_WANT_GROW,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           new Dimension(150, -1),
           null,
           0,
           false));
   btBrowse = new JButton();
   btBrowse.setText("Browse");
   panel3.add(
       btBrowse,
       new GridConstraints(
           1,
           3,
           1,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_HORIZONTAL,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           null,
           null,
           0,
           false));
   final JLabel label2 = new JLabel();
   label2.setText("Delimiter:");
   panel3.add(
       label2,
       new GridConstraints(
           2,
           0,
           1,
           1,
           GridConstraints.ANCHOR_EAST,
           GridConstraints.FILL_NONE,
           GridConstraints.SIZEPOLICY_FIXED,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           null,
           null,
           0,
           false));
   cmbDelimiter = new JComboBox();
   cmbDelimiter.setEditable(true);
   final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel();
   defaultComboBoxModel1.addElement(",");
   defaultComboBoxModel1.addElement("|");
   defaultComboBoxModel1.addElement("-");
   defaultComboBoxModel1.addElement(":");
   cmbDelimiter.setModel(defaultComboBoxModel1);
   panel3.add(
       cmbDelimiter,
       new GridConstraints(
           2,
           1,
           1,
           2,
           GridConstraints.ANCHOR_WEST,
           GridConstraints.FILL_HORIZONTAL,
           GridConstraints.SIZEPOLICY_CAN_GROW,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           null,
           null,
           0,
           false));
   final JLabel label3 = new JLabel();
   label3.setText("Table name:");
   panel3.add(
       label3,
       new GridConstraints(
           0,
           0,
           1,
           1,
           GridConstraints.ANCHOR_EAST,
           GridConstraints.FILL_NONE,
           GridConstraints.SIZEPOLICY_FIXED,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           null,
           null,
           0,
           false));
   tfTableName = new JTextField();
   panel3.add(
       tfTableName,
       new GridConstraints(
           0,
           1,
           1,
           2,
           GridConstraints.ANCHOR_WEST,
           GridConstraints.FILL_HORIZONTAL,
           GridConstraints.SIZEPOLICY_WANT_GROW,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           new Dimension(150, -1),
           null,
           0,
           false));
   final JPanel panel4 = new JPanel();
   panel4.setLayout(new GridLayoutManager(3, 1, new Insets(0, 0, 0, 0), -1, -1));
   panel3.add(
       panel4,
       new GridConstraints(
           3,
           0,
           1,
           4,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_BOTH,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
           null,
           null,
           null,
           0,
           false));
   final JPanel panel5 = new JPanel();
   panel5.setLayout(new GridLayoutManager(2, 4, new Insets(0, 0, 0, 0), -1, -1));
   panel4.add(
       panel5,
       new GridConstraints(
           0,
           0,
           1,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_BOTH,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
           null,
           null,
           null,
           0,
           false));
   final JLabel label4 = new JLabel();
   label4.setText("Select types for columns:");
   panel5.add(
       label4,
       new GridConstraints(
           1,
           0,
           1,
           1,
           GridConstraints.ANCHOR_WEST,
           GridConstraints.FILL_NONE,
           GridConstraints.SIZEPOLICY_FIXED,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           null,
           null,
           0,
           false));
   final Spacer spacer1 = new Spacer();
   panel5.add(
       spacer1,
       new GridConstraints(
           1,
           1,
           1,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_HORIZONTAL,
           GridConstraints.SIZEPOLICY_WANT_GROW,
           1,
           null,
           null,
           null,
           0,
           false));
   btRemoveColumn = new JButton();
   btRemoveColumn.setEnabled(false);
   btRemoveColumn.setText("Remove");
   panel5.add(
       btRemoveColumn,
       new GridConstraints(
           1,
           3,
           1,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_HORIZONTAL,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           null,
           null,
           0,
           false));
   btAddColumn = new JButton();
   btAddColumn.setText("Add...");
   panel5.add(
       btAddColumn,
       new GridConstraints(
           1,
           2,
           1,
           1,
           GridConstraints.ANCHOR_EAST,
           GridConstraints.FILL_NONE,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           null,
           null,
           0,
           false));
   final JSeparator separator2 = new JSeparator();
   panel5.add(
       separator2,
       new GridConstraints(
           0,
           0,
           1,
           4,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_BOTH,
           GridConstraints.SIZEPOLICY_WANT_GROW,
           GridConstraints.SIZEPOLICY_WANT_GROW,
           null,
           null,
           null,
           0,
           false));
   final JScrollPane scrollPane1 = new JScrollPane();
   panel4.add(
       scrollPane1,
       new GridConstraints(
           1,
           0,
           1,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_BOTH,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
           null,
           new Dimension(400, 200),
           null,
           0,
           false));
   rowsTable = new JTable();
   scrollPane1.setViewportView(rowsTable);
   final JLabel label5 = new JLabel();
   label5.setFont(new Font(label5.getFont().getName(), Font.BOLD, label5.getFont().getSize()));
   label5.setText("* Note: data for not listed columns will be treated as of String type.");
   panel4.add(
       label5,
       new GridConstraints(
           2,
           0,
           1,
           1,
           GridConstraints.ANCHOR_SOUTHWEST,
           GridConstraints.FILL_NONE,
           GridConstraints.SIZEPOLICY_FIXED,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           null,
           null,
           0,
           false));
   final JSeparator separator3 = new JSeparator();
   contentPane.add(
       separator3,
       new GridConstraints(
           1,
           0,
           1,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_BOTH,
           GridConstraints.SIZEPOLICY_WANT_GROW,
           GridConstraints.SIZEPOLICY_WANT_GROW,
           null,
           null,
           null,
           0,
           false));
   final JPanel panel6 = new JPanel();
   panel6.setLayout(new GridLayoutManager(2, 3, new Insets(0, 0, 0, 0), -1, -1));
   contentPane.add(
       panel6,
       new GridConstraints(
           2,
           0,
           1,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_BOTH,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
           null,
           null,
           null,
           0,
           false));
   final JLabel label6 = new JLabel();
   label6.setText("Written rows:");
   panel6.add(
       label6,
       new GridConstraints(
           1,
           0,
           1,
           1,
           GridConstraints.ANCHOR_EAST,
           GridConstraints.FILL_NONE,
           GridConstraints.SIZEPOLICY_FIXED,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           null,
           null,
           0,
           false));
   final Spacer spacer2 = new Spacer();
   panel6.add(
       spacer2,
       new GridConstraints(
           1,
           2,
           1,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_HORIZONTAL,
           GridConstraints.SIZEPOLICY_WANT_GROW,
           1,
           null,
           null,
           null,
           0,
           false));
   writtenRowsCount = new JLabel();
   writtenRowsCount.setText("?");
   panel6.add(
       writtenRowsCount,
       new GridConstraints(
           1,
           1,
           1,
           1,
           GridConstraints.ANCHOR_WEST,
           GridConstraints.FILL_NONE,
           GridConstraints.SIZEPOLICY_FIXED,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           null,
           null,
           0,
           false));
   final JLabel label7 = new JLabel();
   label7.setText("Read rows:");
   panel6.add(
       label7,
       new GridConstraints(
           0,
           0,
           1,
           1,
           GridConstraints.ANCHOR_EAST,
           GridConstraints.FILL_NONE,
           GridConstraints.SIZEPOLICY_FIXED,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           null,
           null,
           0,
           false));
   readRowsCount = new JLabel();
   readRowsCount.setText("?");
   panel6.add(
       readRowsCount,
       new GridConstraints(
           0,
           1,
           1,
           1,
           GridConstraints.ANCHOR_WEST,
           GridConstraints.FILL_NONE,
           GridConstraints.SIZEPOLICY_FIXED,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           null,
           null,
           0,
           false));
 }