public Properties getProperties() {
    Properties prop = new Properties();
    String name = saName.getText();
    String interval = saInt.getText();
    boolean opt = saYes.isSelected();

    prop.put("name", name);
    prop.put("suppressInt", interval);
    prop.put("suppressAll", opt + "");

    return prop;
  }
Exemplo n.º 2
0
 /** Used internally for property changes */
 public void propertyChange(PropertyChangeEvent event) {
   if (ignoreEvent_) {
     if (Debug.EVENT) System.out.println("Logo: ignore event");
     return;
   }
   if (Debug.EVENT) {
     System.out.println("LogoDialog: " + event);
     System.out.println("            " + event.getPropertyName());
   }
   if (event.getPropertyName().equals("location")) {
     Point2D.Double locp = logo_.getLocationP();
     xPosTextField.setText(String.valueOf(locp.x));
     yPosTextField.setText(String.valueOf(locp.y));
   }
 }
Exemplo n.º 3
0
  private JPanel createSearchPanel(final FilteredJList classes) {
    JPanel search = new JPanel();
    search.setLayout(new BorderLayout());
    search.add(new JLabel("Choose a Demo to start:      Find: "), BorderLayout.WEST);
    final javax.swing.JTextField jtf = new javax.swing.JTextField();
    jtf.getDocument()
        .addDocumentListener(
            new DocumentListener() {
              public void removeUpdate(DocumentEvent e) {
                classes.setFilter(jtf.getText());
              }

              public void insertUpdate(DocumentEvent e) {
                classes.setFilter(jtf.getText());
              }

              public void changedUpdate(DocumentEvent e) {
                classes.setFilter(jtf.getText());
              }
            });
    jtf.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            selectedClass = classes.getSelectedValues();
            startApp(selectedClass);
          }
        });
    final JCheckBox showSettingCheck = new JCheckBox("Show Setting");
    showSettingCheck.setSelected(true);
    showSettingCheck.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            showSetting = showSettingCheck.isSelected();
          }
        });
    jtf.setPreferredSize(new Dimension(100, 25));
    search.add(jtf, BorderLayout.CENTER);
    search.add(showSettingCheck, BorderLayout.EAST);
    return search;
  }
Exemplo n.º 4
0
 private void setLogo() {
   //
   // label Id
   //
   setTitle("Logo - " + logo_.getId());
   //
   // options
   //
   labelVisibleCheckBox.setSelected(logo_.isVisible());
   labelSelectableCheckBox.setSelected(logo_.isSelectable());
   //
   // location
   //
   Point2D.Double locp = logo_.getLocationP();
   xPosTextField.setText(String.valueOf(locp.x));
   yPosTextField.setText(String.valueOf(locp.y));
   //
   // alignment
   //
   horizComboBox.setSelectedIndex(logo_.getHAlign());
   vertComboBox.setSelectedIndex(logo_.getVAlign());
 }
Exemplo n.º 5
0
  private void updateLogo() {
    ignoreEvent_ = true;
    if (pane_ != null) pane_.setBatch(true, "LogoDialog");
    //
    // options
    //
    logo_.setVisible(labelVisibleCheckBox.isSelected());
    logo_.setSelectable(labelSelectableCheckBox.isSelected());
    //
    // Location
    //
    double x = Double.valueOf(xPosTextField.getText()).doubleValue();
    double y = Double.valueOf(yPosTextField.getText()).doubleValue();
    Point2D.Double locp = new Point2D.Double(x, y);
    logo_.setLocationP(locp);
    //
    // alignment
    //
    logo_.setHAlign(horizComboBox.getSelectedIndex());
    logo_.setVAlign(vertComboBox.getSelectedIndex());

    if (pane_ != null) pane_.setBatch(false, "LogoDialog");
    ignoreEvent_ = false;
  }
Exemplo n.º 6
0
  public void calculaSumas() {
    try {
      TableModel tm = this.tablaPrincipal.getModel();
      int tamTabla = tm.getRowCount();
      double costo, cantidad, totalFila, sumaTotal;
      sumaTotal = 0.0;

      for (int i = 0; i < tamTabla; i++) {
        if (tm.getValueAt(i, 2) != null && tm.getValueAt(i, 3) != null) {
          costo = Double.valueOf(String.valueOf(tm.getValueAt(i, 2)));
          cantidad = Double.valueOf(String.valueOf(tm.getValueAt(i, 3)));
          totalFila = costo * cantidad;

          tm.setValueAt(totalFila, i, 4);
          sumaTotal += totalFila;
        }
      }

      txtSumaTotal.setText(String.valueOf(sumaTotal));
    } catch (Exception e) {
      Dialogos.lanzarAlerta("Cantidades invalidas, puede que algun numero este mal escrito");
    }
  }
Exemplo n.º 7
0
 public void setid(String id) {
   Idtext.setText(id);
 }
Exemplo n.º 8
0
  public GUI() {

    // Sets the text and initiates the objects for the buttons
    playButton = new JButton("PLAY");
    exitButton = new JButton("QUIT");
    howToPlay = new JButton("HOW TO PLAY");
    quitEducation = new JButton("Quit education");
    rollDice = new JButton("ROLL THE DICE");
    saveCareerProspects = new JButton("Save career prospects");
    exitApplication = new JButton("Exit application");

    // The main container for the JFrames
    // container for frame

    JPanel welcome = new JPanel();
    spalshScreen.setContentPane(welcome);
    JPanel container = new JPanel();
    frame.setContentPane(container);
    // container for frame 2
    JPanel container2 = new JPanel();
    container2.setBackground(Color.WHITE);

    frame2.setContentPane(container2);
    // container for frame 3
    JPanel container3 = new JPanel();
    container3.setBackground(Color.WHITE);
    frame3.setContentPane(container3);

    loading = new javax.swing.JLabel();
    loading.setIcon(
        new javax.swing.ImageIcon(getClass().getClassLoader().getResource("images/hexLoader.gif")));

    // start panel with play button and exit button
    // for frame

    playerName = new javax.swing.JTextField();
    playerName.setText("Player");
    playerName.setLocation(100, 100);
    playerName.setPreferredSize(new Dimension(100, 100));
    playerName.setHorizontalAlignment(JTextField.CENTER);

    JPanel frame = new JPanel();

    frame.add(playerName);

    frame.add(playButton);
    playButton.setPreferredSize(new Dimension(200, 100));
    frame.add(exitButton);
    exitButton.setPreferredSize(new Dimension(200, 100));
    frame.add(howToPlay);
    howToPlay.setPreferredSize(new Dimension(200, 100));

    // board image start screen
    start = new javax.swing.JLabel();
    start.setIcon(
        new javax.swing.ImageIcon(getClass().getClassLoader().getResource("images/logo2.png")));

    // for frame 2
    JPanel frame2 = new JPanel();
    frame2.add(quitEducation);

    /* Start of creating the board */

    JButton ordinaryButton;
    int row = 10, column = 10;
    frame2.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(3, 3, 3, 3);

    for (int j = 1; j <= row; j++) {
      for (int i = 0; i < column; i++) {

        ordinaryButton = new JButton();

        if (i == column - 1 && j == row) doActiveTile(ordinaryButton);

        if (j == 1) { // top line
          gbc.ipady = 30;
          gbc.gridx = i;
          gbc.gridy = j;
          gbc.gridwidth = 1;
          addToList(ordinaryButton, TOP);
          frame2.add(ordinaryButton, gbc); // add in the frame
        } else {
          if (j == 10) { // bottom line
            gbc.ipady = 30;
            gbc.gridx = i;
            gbc.gridy = j;
            gbc.gridwidth = 1;
            addToList(ordinaryButton, BOTTOM);
            frame2.add(ordinaryButton, gbc); // add in the frame
          } else {
            if (i == 0) { // left-hand side column
              gbc.ipady = 30;
              gbc.gridx = i;
              gbc.gridy = j;
              gbc.gridwidth = 1;
              addToList(ordinaryButton, LEFT);
              frame2.add(ordinaryButton, gbc); // add in the frame
            } else {
              if (i == 9) { // right-hand side column
                gbc.ipady = 30;
                gbc.gridx = i;
                gbc.gridy = j;
                gbc.gridwidth = 1;
                addToList(ordinaryButton, RIGHT);
                frame2.add(ordinaryButton, gbc); // add in the frame
              }
            }
          }
        }
      }
    }
    /* End of creating the board */

    /* adding constraints for roll dice and Quit education */
    gbc.ipady = 30;
    gbc.gridx = 2;
    gbc.gridy = 4;
    gbc.gridwidth = 2;
    frame2.add(rollDice, gbc); // add in the frame

    gbc.ipady = 30;
    gbc.gridx = 6;
    gbc.gridy = 4;
    gbc.gridwidth = 2;
    frame2.add(quitEducation, gbc); // add in the frame
    /* END OF adding constraints for roll dice and Quit education */

    // for frame 3
    JPanel frame3 = new JPanel();

    frame3.setLayout(new GridBagLayout());
    gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(3, 3, 3, 3);
    gbc.ipady = 30;
    gbc.gridx = 1;
    gbc.gridy = 1;
    gbc.gridwidth = 4;
    frame3.add(saveCareerProspects, gbc);

    frame3.setBackground(Color.WHITE);

    skillsLabel = new javax.swing.JLabel("SKILLS");
    skillsLabel.setBorder(BorderFactory.createMatteBorder(1, 5, 1, 1, Color.ORANGE));
    Font font = skillsLabel.getFont();
    // same font but bold
    int fontSize = font.getSize();
    fontSize += 5;
    Font boldFont = new Font(font.getFontName(), Font.BOLD, fontSize);
    skillsLabel.setFont(boldFont);

    gbc.ipady = 10;
    gbc.gridx = 1;
    gbc.gridy = 3;
    gbc.gridwidth = 1;
    frame3.add(skillsLabel, gbc);
    mathematicsLabel = new javax.swing.JLabel();
    mathematicsLabel.setBorder(BorderFactory.createMatteBorder(1, 5, 1, 1, Color.PINK));
    gbc.gridx = 1;
    gbc.gridy = 4;
    gbc.gridwidth = 1;
    frame3.add(mathematicsLabel, gbc);
    scienceLabel = new javax.swing.JLabel();
    scienceLabel.setBorder(BorderFactory.createMatteBorder(1, 5, 1, 1, Color.CYAN));
    gbc.gridx = 1;
    gbc.gridy = 5;
    gbc.gridwidth = 1;
    frame3.add(scienceLabel, gbc);
    computerScienceLabel = new javax.swing.JLabel();
    computerScienceLabel.setBorder(BorderFactory.createMatteBorder(1, 5, 1, 1, Color.green));
    gbc.gridx = 1;
    gbc.gridy = 6;
    gbc.gridwidth = 1;
    frame3.add(computerScienceLabel, gbc);
    geographyLabel = new javax.swing.JLabel();
    geographyLabel.setBorder(BorderFactory.createMatteBorder(1, 5, 1, 1, Color.RED));
    gbc.gridx = 1;
    gbc.gridy = 7;
    gbc.gridwidth = 1;
    frame3.add(geographyLabel, gbc);
    historyLabel = new javax.swing.JLabel();
    historyLabel.setBorder(BorderFactory.createMatteBorder(1, 5, 1, 1, Color.BLACK));
    gbc.gridx = 1;
    gbc.gridy = 8;
    gbc.gridwidth = 1;
    frame3.add(historyLabel, gbc);
    gbc.ipady = 30;
    gbc.gridx = 1;
    gbc.gridy = 9;
    gbc.gridwidth = 4;
    frame3.add(exitApplication, gbc);

    gbc.ipady = 10;
    careersLabel = new javax.swing.JLabel("CAREER PROSPECTS", SwingConstants.RIGHT);
    gbc.gridx = 3;
    gbc.gridy = 3;
    gbc.gridwidth = 1;
    careersLabel.setFont(boldFont);

    frame3.add(careersLabel, gbc);
    secondColMaths = new javax.swing.JLabel(mathematicsCareer[0], SwingConstants.RIGHT);
    gbc.gridx = 3;
    gbc.gridy = 4;
    gbc.gridwidth = 1;
    frame3.add(secondColMaths, gbc);
    secondColScience = new javax.swing.JLabel(scienceCareer[0], SwingConstants.RIGHT);
    gbc.gridx = 3;
    gbc.gridy = 5;
    gbc.gridwidth = 1;
    frame3.add(secondColScience, gbc);
    secondColCompScience = new javax.swing.JLabel(computerScienceCareer[0], SwingConstants.RIGHT);
    gbc.gridx = 3;
    gbc.gridy = 6;
    gbc.gridwidth = 1;
    frame3.add(secondColCompScience, gbc);
    secondColGeography = new javax.swing.JLabel(geographyCareer[0], SwingConstants.RIGHT);
    gbc.gridx = 3;
    gbc.gridy = 7;
    gbc.gridwidth = 1;
    frame3.add(secondColGeography, gbc);
    secondColHistory = new javax.swing.JLabel(historyCareer[0], SwingConstants.RIGHT);
    gbc.gridx = 3;
    gbc.gridy = 8;
    gbc.gridwidth = 1;
    frame3.add(secondColHistory, gbc);

    JLabel skills = new javax.swing.JLabel();
    skills.setIcon(
        new javax.swing.ImageIcon(getClass().getClassLoader().getResource("images/small.jpg")));
    gbc.gridx = 1;
    gbc.gridy = 1;
    gbc.gridheight = 9;
    gbc.gridwidth = 3;
    frame3.add(skills, gbc);

    JLabel backgroundImage = new javax.swing.JLabel();
    backgroundImage.setIcon(
        new javax.swing.ImageIcon(getClass().getClassLoader().getResource("images/logoSmall.jpg")));
    gbc.gridx = 3;
    gbc.gridy = 2;
    gbc.gridheight = 2;
    gbc.gridwidth = 3;
    frame2.setBackground(Color.WHITE);
    frame2.add(backgroundImage, gbc);

    JLabel rollDiceImage = new javax.swing.JLabel();
    rollDiceImage.setIcon(
        new javax.swing.ImageIcon(getClass().getClassLoader().getResource("images/rollDice.jpg")));
    gbc.gridx = 2;
    gbc.gridy = 5;
    gbc.gridheight = 3;
    gbc.gridwidth = 3;
    frame2.add(rollDiceImage, gbc);

    JLabel quitEducationImage = new javax.swing.JLabel();
    quitEducationImage.setIcon(
        new javax.swing.ImageIcon(
            getClass().getClassLoader().getResource("images/quitEducation.jpg")));
    gbc.gridx = 6;
    gbc.gridy = 5;
    gbc.gridheight = 3;
    gbc.gridwidth = 3;
    frame2.add(quitEducationImage, gbc);

    exitApplication.setFont(boldFont);
    saveCareerProspects.setFont(boldFont);
    saveCareerProspects.setForeground(Color.ORANGE);
    exitApplication.setBackground(Color.BLACK);
    exitApplication.setForeground(Color.RED);
    Border border = new LineBorder(Color.LIGHT_GRAY, 5);
    exitApplication.setBorder(border);
    saveCareerProspects.setBorder(border);
    start.setBorder(border);
    howToPlay.setBorder(border);
    playButton.setBorder(border);
    exitButton.setBorder(border);
    howToPlay.setFont(boldFont);
    playButton.setFont(boldFont);
    exitButton.setFont(boldFont);
    border = new LineBorder(Color.ORANGE, 5);
    playerName.setBorder(border);

    // Adds the fields to the panel
    // Adds all the panels to the container
    welcome.add(loading);
    container.add(start);
    container.add(frame);
    container2.add(frame2);
    container3.add(frame3);

    // Action Listeners for the buttons
    howToPlay.addActionListener(this);
    playButton.addActionListener(this);
    exitButton.addActionListener(this);
    quitEducation.addActionListener(this);
    rollDice.addActionListener(this);
    saveCareerProspects.addActionListener(this);
    exitApplication.addActionListener(this);

    // Starts up the UI
    startGui();
    print();
  }
Exemplo n.º 9
0
  // Code behind the buttons. This is called when the 4 buttons are clicked
  @Override
  public void actionPerformed(ActionEvent e) {

    // play button
    if (e.getActionCommand() == "PLAY") {

      Board gameBoard = new Board();

      frame2.setVisible(true);
      frame.setVisible(false);
    } else if (e.getActionCommand() == "HOW TO PLAY") {
      Icon Instructions =
          new ImageIcon(getClass().getClassLoader().getResource("images/instructions.jpg"));
      JOptionPane.showMessageDialog(
          null,
          "<html><body><h1>How to play the game</h1><h3>| Roll the dice </h3><h3>| Answer questions </h3><h3>| Earn skills</h3><h3>--- Repeat until you graduate</h3><h3>--- Get career prospects based on your skills</h3><h3>--- Save the career prospects for further use</h3></body></html>",
          "Game Instructions",
          JOptionPane.INFORMATION_MESSAGE,
          Instructions);
    } else if (e.getActionCommand() == "QUIT") {

      int input =
          JOptionPane.showOptionDialog(
              null,
              "Are you sure you want to exit?",
              "Are you sure?",
              JOptionPane.YES_NO_OPTION,
              JOptionPane.INFORMATION_MESSAGE,
              null,
              null,
              null);
      if (input == JOptionPane.OK_OPTION) {
        System.exit(0);
      }
    } else if (e.getActionCommand() == "Quit education") {

      doCareerProspects();

      frame.setVisible(false);
      frame2.setVisible(false);
      frame3.setVisible(true);
    } else if (e.getActionCommand() == "Save career prospects") {

      try {
        Formatter output = new Formatter("Career.txt");

        StringBuilder myCareersToBeSaved = new StringBuilder();
        myCareersToBeSaved.append(
            "You might enjoy and be successful in one of the following careers: " + "\n\n");

        myCareersToBeSaved.append(mathematicsCareer[getMathematicsValue()] + "\n");
        myCareersToBeSaved.append(historyCareer[getHistoryValue()] + "\n");
        myCareersToBeSaved.append(geographyCareer[getGeographyValue()] + "\n");
        myCareersToBeSaved.append(computerScienceCareer[getComputerScienceValue()] + "\n");
        myCareersToBeSaved.append(scienceCareer[getScienceValue()] + "\n");

        output.format(myCareersToBeSaved.toString());
        output.close();
      } catch (Exception ex) {
        System.err.println(ex);
      }

      Icon saved = new ImageIcon(getClass().getClassLoader().getResource("images/saved.png"));
      int input =
          JOptionPane.showOptionDialog(
              null,
              "Career prospects have been saved! \n Do you want to exit?",
              "Career prospects saved",
              JOptionPane.YES_NO_OPTION,
              JOptionPane.INFORMATION_MESSAGE,
              saved,
              null,
              null);
      if (input == JOptionPane.OK_OPTION) {
        System.exit(0);
      }

    } else if (e.getActionCommand() == "Exit application") {
      Icon leaving = new ImageIcon(getClass().getClassLoader().getResource("images/leaving.png"));

      int input =
          JOptionPane.showOptionDialog(
              null,
              "Press CANCEL or OK to exit!",
              "Are you sure?",
              JOptionPane.OK_CANCEL_OPTION,
              JOptionPane.INFORMATION_MESSAGE,
              leaving,
              null,
              null);
      if (input == JOptionPane.OK_OPTION) {
        System.exit(0);
      }
    } else if (e.getActionCommand() == "ROLL THE DICE") {

      String name = playerName.getText();
      int randomNumber;
      randomNumber = rollDice();
      doMove(randomNumber);

      final ImageIcon icon =
          new ImageIcon(getClass().getClassLoader().getResource("images/dices.gif"));
      String fullDetail = "Hi " + name + "," + "\n     You rolled a " + randomNumber;
      JOptionPane.showMessageDialog(
          null, fullDetail, "Rolled dice", JOptionPane.INFORMATION_MESSAGE, icon);

      Quiz();

      if (getPlayerPosition() >= 72) {
        doCareerProspects();

        frame.setVisible(false);
        frame2.setVisible(false);
        frame3.setVisible(true);
      }
    }
  }
Exemplo n.º 10
0
  private void initComponents() {
    splitPaneMain = new javax.swing.JSplitPane();
    //
    // splitPanel = new javax.swing.JSplitPane();
    splitPanelLeft = new javax.swing.JSplitPane();
    graphOptionsPanel = new javax.swing.JPanel();
    graphPanel = new javax.swing.JPanel();
    rightPanel = new javax.swing.JPanel();
    generalPanel = new javax.swing.JPanel();
    nameTextField = new javax.swing.JTextField();
    labelForName = new javax.swing.JLabel();
    blocksPanel = new javax.swing.JPanel();
    addBlockButton = new javax.swing.JButton();
    removeBlockButton = new javax.swing.JButton();
    adjustBlockButton = new javax.swing.JButton();
    portsPanel = new javax.swing.JPanel();
    addPortButton = new javax.swing.JButton();
    removePortButton = new javax.swing.JButton();
    adjustPortButton = new javax.swing.JButton();
    blockRelationsPanel = new javax.swing.JPanel();
    addRelationButton = new javax.swing.JButton();
    removeRelationButton = new javax.swing.JButton();

    splitPanelLeft.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);

    graphOptionsPanel.setLayout(
        new javax.swing.BoxLayout(graphOptionsPanel, javax.swing.BoxLayout.PAGE_AXIS));

    topOptionsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Mouse Mode"));
    graphOptionsPanel.add(topOptionsPanel);

    bottomOptionsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Layout"));
    graphOptionsPanel.add(bottomOptionsPanel);

    gm = new DefaultModalGraphMouse();
    JComboBox modeBox = gm.getModeComboBox();
    topOptionsPanel.add(modeBox);

    PortConnections pconnsInst = PortConnections.getInstance();
    vv = new VisualizationViewer(new CircleLayout(pconnsInst));
    // create the transformers
    // edge label
    final Transformer edgeLabel =
        new Transformer() {
          public String transform(Object obj) {
            if (obj instanceof InteractionArc) {
              InteractionArc arc = (InteractionArc) obj;
              return arc.getArcStateShort();
            }
            return "unknown";
          }
        };
    this.edgeLabel = edgeLabel;
    vv.getRenderContext().setEdgeLabelTransformer(edgeLabel);
    vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line());
    // options
    java.util.List<String> options = new ArrayList<String>();
    options.add("FRLayout");
    options.add("KKLayout");
    options.add("CircleLayout");
    options.add("SpringLayout");
    options.add("SpringLayout2");
    options.add("ISOMLayout");
    layoutBox = new JComboBox(options.toArray());
    layoutBox.setSelectedItem(options.get(0));
    layoutBox.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            InteractionGraphs igraphs = InteractionGraphs.getInstance();
            InteractionGraph graph = igraphs.getGraph(emidSelected);
            String selected = (String) ((JComboBox) e.getSource()).getSelectedItem();
            if (selected.equals("FRLayout")) {
              vv = new VisualizationViewer(new FRLayout(graph));
            } else if (selected.equals("KKLayout")) {
              vv = new VisualizationViewer(new KKLayout(graph));
            } else if (selected.equals("CircleLayout")) {
              vv = new VisualizationViewer(new CircleLayout(graph));
            } else if (selected.equals("SpringLayout")) {
              vv = new VisualizationViewer(new SpringLayout(graph));
            } else if (selected.equals("SpringLayout2")) {
              vv = new VisualizationViewer(new SpringLayout2(graph));
            } else if (selected.equals("ISOMLayout")) {
              vv = new VisualizationViewer(new ISOMLayout(graph));
            }
            vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
            vv.getRenderContext().setEdgeLabelTransformer(edgeLabel);
            vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line());
            setVisualizationViewer(vv);
          }
        });
    layoutBox.setSelectedItem("CircleLayout");

    bottomOptionsPanel.add(layoutBox);

    splitPanelLeft.setTopComponent(graphOptionsPanel);

    javax.swing.GroupLayout graphPanelLayout = new javax.swing.GroupLayout(graphPanel);
    graphPanel.setLayout(graphPanelLayout);
    graphPanelLayout.setHorizontalGroup(
        graphPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 181, Short.MAX_VALUE));
    graphPanelLayout.setVerticalGroup(
        graphPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 432, Short.MAX_VALUE));

    // splitPanelLeft.setRightComponent(graphPanel);

    splitPaneMain.setLeftComponent(splitPanelLeft);

    rightPanel.setLayout(new javax.swing.BoxLayout(rightPanel, javax.swing.BoxLayout.PAGE_AXIS));

    generalPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("General"));

    labelForName.setText("name");

    nameTextField.setText("new");

    javax.swing.GroupLayout generalPanelLayout = new javax.swing.GroupLayout(generalPanel);
    generalPanel.setLayout(generalPanelLayout);
    generalPanelLayout.setHorizontalGroup(
        generalPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                generalPanelLayout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(labelForName)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(
                        nameTextField,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        265,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(140, Short.MAX_VALUE)));
    generalPanelLayout.setVerticalGroup(
        generalPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                generalPanelLayout
                    .createSequentialGroup()
                    .addGroup(
                        generalPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(labelForName)
                            .addComponent(
                                nameTextField,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(96, Short.MAX_VALUE)));

    rightPanel.add(generalPanel);

    blocksPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Blocks"));

    javax.swing.GroupLayout blocksPanelLayout = new javax.swing.GroupLayout(blocksPanel);
    blocksPanel.setLayout(blocksPanelLayout);
    blocksPanelLayout.setHorizontalGroup(
        blocksPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                blocksPanelLayout
                    .createSequentialGroup()
                    .addGap(179, 179, 179)
                    .addGroup(
                        blocksPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(
                                adjustBlockButton,
                                javax.swing.GroupLayout.Alignment.LEADING,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                            .addComponent(
                                removeBlockButton,
                                javax.swing.GroupLayout.Alignment.LEADING,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                            .addComponent(
                                addBlockButton,
                                javax.swing.GroupLayout.Alignment.LEADING,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                114,
                                Short.MAX_VALUE))
                    .addContainerGap(158, Short.MAX_VALUE)));
    blocksPanelLayout.setVerticalGroup(
        blocksPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                blocksPanelLayout
                    .createSequentialGroup()
                    .addComponent(addBlockButton)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(removeBlockButton)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(adjustBlockButton)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    rightPanel.add(blocksPanel);

    portsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Ports"));

    javax.swing.GroupLayout portsPanelLayout = new javax.swing.GroupLayout(portsPanel);
    portsPanel.setLayout(portsPanelLayout);
    portsPanelLayout.setHorizontalGroup(
        portsPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                portsPanelLayout
                    .createSequentialGroup()
                    .addGap(177, 177, 177)
                    .addGroup(
                        portsPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(
                                adjustPortButton,
                                javax.swing.GroupLayout.Alignment.LEADING,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                            .addComponent(
                                removePortButton,
                                javax.swing.GroupLayout.Alignment.LEADING,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                            .addComponent(
                                addPortButton,
                                javax.swing.GroupLayout.Alignment.LEADING,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                115,
                                Short.MAX_VALUE))
                    .addContainerGap(159, Short.MAX_VALUE)));
    portsPanelLayout.setVerticalGroup(
        portsPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                portsPanelLayout
                    .createSequentialGroup()
                    .addComponent(addPortButton)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(removePortButton)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(adjustPortButton)
                    .addContainerGap(32, Short.MAX_VALUE)));

    rightPanel.add(portsPanel);

    blockRelationsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Block Relations"));

    javax.swing.GroupLayout blockRelationsPanelLayout =
        new javax.swing.GroupLayout(blockRelationsPanel);
    blockRelationsPanel.setLayout(blockRelationsPanelLayout);
    blockRelationsPanelLayout.setHorizontalGroup(
        blockRelationsPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                blockRelationsPanelLayout
                    .createSequentialGroup()
                    .addGap(177, 177, 177)
                    .addGroup(
                        blockRelationsPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(
                                removeRelationButton,
                                javax.swing.GroupLayout.Alignment.LEADING,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                            .addComponent(
                                addRelationButton,
                                javax.swing.GroupLayout.Alignment.LEADING,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                114,
                                Short.MAX_VALUE))
                    .addContainerGap(159, Short.MAX_VALUE)));
    blockRelationsPanelLayout.setVerticalGroup(
        blockRelationsPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                blockRelationsPanelLayout
                    .createSequentialGroup()
                    .addComponent(addRelationButton)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(removeRelationButton)
                    .addContainerGap(61, Short.MAX_VALUE)));

    rightPanel.add(blockRelationsPanel);

    splitPaneMain.setRightComponent(rightPanel);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(
                splitPaneMain, javax.swing.GroupLayout.DEFAULT_SIZE, 653, Short.MAX_VALUE));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(
                splitPaneMain,
                javax.swing.GroupLayout.Alignment.TRAILING,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                541,
                Short.MAX_VALUE));
  }
  public void setProperties(String actionName) {
    saName.setEnabled(true);
    if (actionName == null) {
      saInt.setText(0 + "");
      saYes.setSelected(true);
      saInt.setEnabled(false);
      saNo.setSelected(false);
      saName.setText("");
      saName.setEnabled(true);
    } else if (NotifierList.notifiers.get(actionName) == null) {

      saInt.setText(0 + "");
      saYes.setSelected(true);
      saInt.setEnabled(false);
      saNo.setSelected(false);
      saName.setText("");
      saName.setEnabled(true);
    } else {

      FilterAction action = (FilterAction) NotifierList.notifiers.get(actionName);
      Properties prop = action.getProperties();

      String saint = prop.getProperty("suppressInt");
      if (saint == null) saint = "0";
      saInt.setText(saint);

      String name = prop.getProperty("name");
      if (name == null) name = "";
      saName.setText(name);

      saName.setEnabled(false);

      String opt = prop.getProperty("suppressAll");
      if (opt != null && opt.equals("true")) {
        saYes.setSelected(true);
        saInt.setEnabled(false);
        saNo.setSelected(false);
      } else {
        saYes.setSelected(false);
        saInt.setEnabled(true);
        saNo.setSelected(true);
      }
    }
  }
Exemplo n.º 12
0
 public static void removeEnterFromKeymap(javax.swing.JTextField field) {
   javax.swing.KeyStroke enter =
       javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ENTER, 0);
   javax.swing.text.Keymap map = field.getKeymap();
   map.removeKeyStrokeBinding(enter);
 }