Exemplo n.º 1
0
  private void flipSeparators(Component c, int orientn) {

    if (c != null
        && c instanceof JToolBar
        && UIManager.getLookAndFeel().getName().toLowerCase().indexOf("windows") != -1) {

      JToolBar jtb = (JToolBar) c;

      Component comps[] = jtb.getComponents();

      if (comps != null && comps.length > 0) {

        for (int i = 0; i < comps.length; i++) {

          try {

            Component component = comps[i];

            if (component != null) {

              if (component instanceof JSeparator) {

                jtb.remove(component);

                JSeparator separ = new JSeparator();

                if (orientn == SwingConstants.VERTICAL) {

                  separ.setOrientation(SwingConstants.VERTICAL);

                  separ.setMinimumSize(new Dimension(2, 6));

                  separ.setPreferredSize(new Dimension(2, 6));

                  separ.setMaximumSize(new Dimension(2, 100));

                } else {

                  separ.setOrientation(SwingConstants.HORIZONTAL);

                  separ.setMinimumSize(new Dimension(6, 2));

                  separ.setPreferredSize(new Dimension(6, 2));

                  separ.setMaximumSize(new Dimension(100, 2));
                }

                jtb.add(separ, i);
              }
            }

          } catch (Exception e) {

            e.printStackTrace();
          }
        }
      }
    }
  }
Exemplo n.º 2
0
 @Override
 public void addSeparator() {
   super.addSeparator(new Dimension(5, 1));
   JSeparator separator = new JSeparator(SwingConstants.VERTICAL);
   separator.setMaximumSize(new Dimension(10, 40));
   add(separator);
   super.addSeparator(new Dimension(5, 1));
 }
Exemplo n.º 3
0
 public static JSeparator createToolBarSeparator() {
   JSeparator toolBarSeparator = new JSeparator(JSeparator.VERTICAL);
   Dimension dim = new Dimension(4, 22);
   toolBarSeparator.setPreferredSize(dim);
   toolBarSeparator.setSize(dim);
   toolBarSeparator.setMinimumSize(dim);
   toolBarSeparator.setMaximumSize(dim);
   return toolBarSeparator;
 }
 public void addToolbarSeparator() {
   JSeparator sep = new JSeparator();
   sep.setOrientation(SwingConstants.VERTICAL);
   Dimension size = new Dimension(10, 25);
   sep.setMinimumSize(size);
   sep.setPreferredSize(size);
   sep.setMaximumSize(size);
   toolbar.add(sep);
 }
Exemplo n.º 5
0
  private JSeparator createButUpSeparator() {
    butUp.add(Box.createRigidArea(GV.DIM_RA));
    JSeparator jSep = new JSeparator();
    jSep.setOrientation(SwingConstants.VERTICAL);
    jSep.setMaximumSize(new Dimension(2, 18));
    butUp.add(jSep);
    butUp.add(Box.createRigidArea(GV.DIM_RA));

    return jSep;
  }
Exemplo n.º 6
0
  public DriverFrame() {
    super("311");

    this.setSize(this.WIDTH, this.HEIGHT);
    this.setLocationRelativeTo(null);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.setResizable(false);
    this.getContentPane().setBackground(Color.GRAY);
    this.setLayout(new BorderLayout(10, 10));

    this.bDiv = new JPanel();
    this.tDiv = new JPanel();

    this.add(this.bDiv, BorderLayout.SOUTH);
    this.add(this.tDiv, BorderLayout.NORTH);

    this.tDiv.add(new JLabel("COSC 311 - Driver Program"));

    this.bDiv.setLayout(new BoxLayout(this.bDiv, BoxLayout.Y_AXIS));

    this.orderRadio = new JRadioButton[this.ORDER_RADIO_LABELS.length];
    this.typeRadio = new JRadioButton[this.TYPE_RADIO_LABELS.length];

    for (int i = 0; i < this.BUTTON_LABELS.length; i++) {
      if (i == this.BUTTON_LABELS.length - 1) {
        this.oRadio = new ButtonGroup();
        for (int j = 0; j < this.ORDER_RADIO_LABELS.length; j++) {
          this.orderRadio[j] = new JRadioButton(this.ORDER_RADIO_LABELS[j]);
          this.orderRadio[j].addActionListener(this);
          this.oRadio.add(this.orderRadio[j]);
          this.bDiv.add(this.orderRadio[j]);
        }
        this.orderRadio[0].setSelected(true);

        JSeparator sep = new JSeparator();
        sep.setMaximumSize(new Dimension(this.WIDTH * 2, 5));
        this.bDiv.add(sep);

        this.tRadio = new ButtonGroup();
        for (int j = 0; j < this.TYPE_RADIO_LABELS.length; j++) {
          this.typeRadio[j] = new JRadioButton(this.TYPE_RADIO_LABELS[j]);
          this.typeRadio[j].addActionListener(this);
          this.tRadio.add(this.typeRadio[j]);
          this.bDiv.add(this.typeRadio[j]);
        }
        this.typeRadio[0].setSelected(true);
      }
      JButton btn = new JButton(this.BUTTON_LABELS[i]);
      btn.addActionListener(this);
      btn.setMaximumSize(new Dimension(this.WIDTH, 25));
      this.bDiv.add(btn);

      this.myStructure = new DataStructure();
    }
  }
  private JComponent createSchemaBox() {
    schemaBox = new SchemaBox(this);

    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.LINE_AXIS));
    panel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, ThemeMediator.LIGHT_BORDER_COLOR));

    final String strShowOpts = I18n.tr("Show Options");
    final String strHideOpts = I18n.tr("Hide Options");

    // reusing schema box panel for more options button
    // minor optimization to keep the layout as flat as possible
    final JButton buttonOptions = new JButton(strShowOpts);
    buttonOptions.setContentAreaFilled(false);
    // buttonOptions.setBorderPainted(false);
    buttonOptions.setOpaque(false);

    Dimension dim = new Dimension(120, 30);
    buttonOptions.setMinimumSize(dim);
    buttonOptions.setMaximumSize(dim);
    buttonOptions.setPreferredSize(dim);
    buttonOptions.setSize(dim);
    // buttonOptions.setMargin(new Insets(0, 0, 0, 0));
    // buttonOptions.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0,
    // ThemeMediator.LIGHT_BORDER_COLOR));

    buttonOptions.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            scrollPaneSearchOptions.setVisible(!scrollPaneSearchOptions.isVisible());

            buttonOptions.setText(scrollPaneSearchOptions.isVisible() ? strHideOpts : strShowOpts);
          }
        });

    JSeparator sep = new JSeparator(SwingConstants.VERTICAL);
    sep.setMaximumSize(new Dimension(2, 100));

    panel.add(schemaBox);
    panel.add(Box.createHorizontalGlue());
    panel.add(sep);
    panel.add(buttonOptions);

    return panel;
  }
Exemplo n.º 8
0
  public ExpressionTester() {
    setLayout(new BorderLayout());
    _txtExpression = new JTextPane(new HighlightedDocument());
    JScrollPane scpExp = new JScrollPane(_txtExpression);
    scpExp.setPreferredSize(new Dimension(400, 400));

    _txtResult = new JTextArea();
    _txtResult.setEditable(false);
    JScrollPane scpResutlt = new JScrollPane(_txtResult);
    scpResutlt.setPreferredSize(new Dimension(200, 400));

    _btnEval = new JButton("Evaluate");
    _btnEval.setPreferredSize(new Dimension(400, 20));
    JSeparator sep = new JSeparator();
    sep.setPreferredSize(new Dimension(10, 400));
    sep.setMaximumSize(new Dimension(10, 400));

    add(scpExp, BorderLayout.CENTER);
    add(scpResutlt, BorderLayout.LINE_END);
    add(_btnEval, BorderLayout.PAGE_END);

    _btnEval.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            _txtResult.setText("");
            try {
              Valueable[] valueables =
                  ExpressionFactory.evalExpression(_txtExpression.getText().toLowerCase());
              StringBuilder buffer = new StringBuilder();
              for (Valueable val : valueables) {
                buffer.append("[" + val.getValue("1") + "]\n");
              }
              _txtResult.setText(buffer.toString());
            } catch (Exception exc) {
              exc.printStackTrace();
              _txtResult.setText("Can not evaluate");
            }
          }
        });
  }
  public void initComponents(NceSystemConnectionMemo m) throws Exception {
    this.memo = m;

    // populate the GUI, invoked as part of startup
    // load the port selection part
    portBox.setToolTipText("Select the port to use");
    portBox.setAlignmentX(JLabel.LEFT_ALIGNMENT);
    Vector<String> v = getPortNames();
    for (int i = 0; i < v.size(); i++) {
      portBox.addItem(v.elementAt(i));
    }
    openPortButton.setText("Open");
    openPortButton.setToolTipText("Configure program to use selected port");
    openPortButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            try {
              openPortButtonActionPerformed(evt);
              // } catch (jmri.jmrix.SerialConfigException ex) {
              //    log.error("Error while opening port.  Did you select the right one?\n"+ex);
            } catch (java.lang.UnsatisfiedLinkError ex) {
              log.error("Error while opening port.  Did you select the right one?\n" + ex);
            }
          }
        });
    {
      JSeparator js = new JSeparator();
      js.setMaximumSize(new Dimension(10000, 10));
      add(js);
    }
    JPanel p1 = new JPanel();
    p1.setLayout(new FlowLayout());
    p1.add(new JLabel("Serial port: "));
    p1.add(portBox);
    p1.add(openPortButton);
    p1.setMaximumSize(p1.getPreferredSize());
    add(p1);

    // add user part of GUI
    {
      JSeparator js = new JSeparator();
      js.setMaximumSize(new Dimension(10000, 10));
      add(js);
    }
    JPanel p2 = new JPanel();
    {
      JPanel p = new JPanel();
      p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
      checkButton.setToolTipText("?");
      checkButton.setEnabled(false);
      p.add(checkButton);
      checkButton.addActionListener(
          new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
              if (checkButton.isSelected()) {
                sendBytes(new byte[] {(byte) '?'});
                checkButton.setText("Res.");
                checkButton.setToolTipText("Resume packet monitoring");
              } else {
                sendBytes(new byte[] {(byte) ' '});
                checkButton.setText("Info");
                checkButton.setToolTipText("?");
              }
            }
          });
      truncateCheckBox.setToolTipText("Check this box to suppress identical packets");
      p.add(truncateCheckBox);
      p2.add(p);
    }

    {
      JPanel p = new JPanel();
      p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
      ButtonGroup g = new ButtonGroup();
      JRadioButton b;
      b = new JRadioButton("Verbose");
      b.setToolTipText("V");
      g.add(b);
      p.add(b);
      b.addActionListener(
          new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
              sendBytes(new byte[] {(byte) 'V'});
            }
          });
      b = new JRadioButton("Hex with preamble symbol");
      b.setToolTipText("H0");
      g.add(b);
      p.add(b);
      b.addActionListener(
          new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
              sendBytes(new byte[] {(byte) 'H', (byte) '0'});
            }
          });
      p2.add(p);
      b = new JRadioButton("(as above with spaces)");
      b.setToolTipText("H1");
      g.add(b);
      p.add(b);
      b.addActionListener(
          new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
              sendBytes(new byte[] {(byte) 'H', (byte) '1'});
            }
          });
      p2.add(p);
      b = new JRadioButton("Hex without preamble symbol");
      b.setToolTipText("H2");
      g.add(b);
      p.add(b);
      b.addActionListener(
          new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
              sendBytes(new byte[] {(byte) 'H', (byte) '2'});
            }
          });
      p2.add(p);
      b = new JRadioButton("(as above with spaces)");
      b.setToolTipText("H3");
      g.add(b);
      p.add(b);
      b.addActionListener(
          new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
              sendBytes(new byte[] {(byte) 'H', (byte) '3'});
            }
          });
      p2.add(p);
      b = new JRadioButton("Hex with preamble count in hex");
      b.setToolTipText("H4");
      g.add(b);
      p.add(b);
      b.addActionListener(
          new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
              sendBytes(new byte[] {(byte) 'H', (byte) '4'});
            }
          });
      p2.add(p);
      b = new JRadioButton("(as above with spaces)");
      b.setToolTipText("H5");
      g.add(b);
      p.add(b);
      b.addActionListener(
          new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
              sendBytes(new byte[] {(byte) 'H', (byte) '5'});
            }
          });
      p2.add(p);
    } // end hex/verbose group

    { // start acc off/on
      JPanel p = new JPanel();
      p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
      ButtonGroup g = new ButtonGroup();
      JRadioButton b;
      b = new JRadioButton("Hide acc packets");
      b.setToolTipText("A-");
      g.add(b);
      p.add(b);
      b.addActionListener(
          new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
              sendBytes(new byte[] {(byte) 'A', (byte) '-'});
            }
          });
      b = new JRadioButton("Show acc packets");
      b.setToolTipText("A+");
      g.add(b);
      p.add(b);
      b.addActionListener(
          new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
              sendBytes(new byte[] {(byte) 'A', (byte) '+'});
            }
          });
      p2.add(p);
    } // end acc off/on

    { // start idle off/on
      JPanel p = new JPanel();
      p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
      ButtonGroup g = new ButtonGroup();
      JRadioButton b;
      b = new JRadioButton("Hide idle packets");
      b.setToolTipText("I-");
      g.add(b);
      p.add(b);
      b.addActionListener(
          new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
              sendBytes(new byte[] {(byte) 'I', (byte) '-'});
            }
          });
      b = new JRadioButton("Show idle packets");
      b.setToolTipText("I+");
      g.add(b);
      p.add(b);
      b.addActionListener(
          new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
              sendBytes(new byte[] {(byte) 'I', (byte) '+'});
            }
          });
      p2.add(p);
    } // end idle off/on

    { // start loco off/on
      JPanel p = new JPanel();
      p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
      ButtonGroup g = new ButtonGroup();
      JRadioButton b;
      locoSpeedButton.setToolTipText("L-");
      g.add(locoSpeedButton);
      p.add(locoSpeedButton);
      locoSpeedButton.addActionListener(
          new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
              sendBytes(new byte[] {(byte) 'L', (byte) '-'});
            }
          });
      b = new JRadioButton("Show loco packets");
      b.setToolTipText("L+");
      g.add(b);
      p.add(b);
      b.addActionListener(
          new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
              sendBytes(new byte[] {(byte) 'L', (byte) '+'});
            }
          });
      p2.add(p);
    } // end loco off/on

    { // start reset off/on
      JPanel p = new JPanel();
      p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
      ButtonGroup g = new ButtonGroup();
      JRadioButton b;
      b = new JRadioButton("Hide reset packets");
      b.setToolTipText("R-");
      g.add(b);
      p.add(b);
      b.addActionListener(
          new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
              sendBytes(new byte[] {(byte) 'R', (byte) '-'});
            }
          });
      b = new JRadioButton("Show reset packets");
      b.setToolTipText("R+");
      g.add(b);
      p.add(b);
      b.addActionListener(
          new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
              sendBytes(new byte[] {(byte) 'R', (byte) '+'});
            }
          });
      p2.add(p);
    } // end reset off/on

    { // start signal on/off
      JPanel p = new JPanel();
      p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
      ButtonGroup g = new ButtonGroup();
      JRadioButton b;
      b = new JRadioButton("Hide signal packets");
      b.setToolTipText("S-");
      g.add(b);
      p.add(b);
      b.addActionListener(
          new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
              sendBytes(new byte[] {(byte) 'S', (byte) '-'});
            }
          });
      b = new JRadioButton("Show signal packets");
      b.setToolTipText("S+");
      g.add(b);
      p.add(b);
      b.addActionListener(
          new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
              sendBytes(new byte[] {(byte) 'S', (byte) '+'});
            }
          });
      p2.add(p);
    } // end signal off/on

    { // Monitor command acc single/double
      JPanel p = new JPanel();
      p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
      JLabel t = new JLabel("Monitor Command");
      p.add(t);
      ButtonGroup g = new ButtonGroup();
      JRadioButton b;
      b = new JRadioButton("Acc addresses single");
      b.setToolTipText("AS");
      g.add(b);
      p.add(b);
      b.addActionListener(
          new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
              sendBytes(new byte[] {(byte) 'A', (byte) 'S'});
            }
          });
      b = new JRadioButton("Acc addresses paired");
      b.setToolTipText("AP");
      g.add(b);
      p.add(b);
      b.addActionListener(
          new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
              sendBytes(new byte[] {(byte) 'A', (byte) 'P'});
            }
          });
      p2.add(p);
    } // end acc single/double

    p2.setMaximumSize(p2.getPreferredSize());
    JScrollPane ps = new JScrollPane(p2);
    ps.setMaximumSize(ps.getPreferredSize());
    ps.setVisible(true);
    add(ps);
  }
Exemplo n.º 10
0
  /** Initialize the contents of the frame. */
  private void initialize() {
    frmPuzzledicePuzzleEditor = new JFrame();
    frmPuzzledicePuzzleEditor.setTitle("Puzzledice Puzzle Map Editor");
    frmPuzzledicePuzzleEditor.setBounds(100, 100, 743, 585);
    frmPuzzledicePuzzleEditor.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    frmPuzzledicePuzzleEditor.getContentPane().setLayout(new BorderLayout(0, 0));
    frmPuzzledicePuzzleEditor.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent winEvt) {
            if (onExit()) System.exit(0);
          }
        });
    // Set up the program to catch OSX quit events
    try {
      OSXAdapter.setQuitHandler(this, this.getClass().getMethod("onExit", new Class[] {}));
    } catch (SecurityException e) {
      e.printStackTrace();
    } catch (NoSuchMethodException e) {
      e.printStackTrace();
    }

    JMenuBar menuBar = new JMenuBar();
    frmPuzzledicePuzzleEditor.setJMenuBar(menuBar);

    JMenu mnFile = new JMenu("File");
    menuBar.add(mnFile);

    JMenuItem mntmNew = new JMenuItem("New");
    mntmNew.setAccelerator(
        KeyStroke.getKeyStroke(
            KeyEvent.VK_N, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    mntmNew.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            clear();
            _openFile = null;
          }
        });
    mnFile.add(mntmNew);

    JMenuItem mntmOpen = new JMenuItem("Open");
    mntmOpen.setAccelerator(
        KeyStroke.getKeyStroke(
            KeyEvent.VK_O, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    mntmOpen.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {

            // Run the file dialogue later since it's blocking
            SwingUtilities.invokeLater(
                new Runnable() {
                  public void run() {
                    FileDialog chooser =
                        new FileDialog(frmPuzzledicePuzzleEditor, "Open", FileDialog.LOAD);
                    chooser.setVisible(true);
                    if (chooser.getFile() != null) {
                      clear();
                      File file = new File(chooser.getDirectory(), chooser.getFile());
                      if (Loader.LoadFromXML(file)) {
                        areaEditPanel.justLoaded();
                        puzzleEditPanel.justLoaded();
                        _openFile = file;
                      } else {
                        JOptionPane.showMessageDialog(
                            frmPuzzledicePuzzleEditor,
                            "File failed to open!",
                            "Error",
                            JOptionPane.ERROR_MESSAGE);
                      }
                    }
                  }
                });
          }
        });
    mnFile.add(mntmOpen);

    JMenuItem mntmSave = new JMenuItem("Save");
    mntmSave.setAccelerator(
        KeyStroke.getKeyStroke(
            KeyEvent.VK_S, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    mntmSave.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            // Invoke the save later since it's a blocking method
            SwingUtilities.invokeLater(
                new Runnable() {
                  public void run() {
                    save();
                  }
                });
          }
        });
    mnFile.add(mntmSave);

    JMenuItem mntmSaveAs = new JMenuItem("Save As");
    mntmSaveAs.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            SwingUtilities.invokeLater(
                new Runnable() {
                  public void run() {
                    String xml = xmlDigest();
                    saveAs(xml);
                  }
                });
          }
        });
    mnFile.add(mntmSaveAs);

    JMenuItem mntmExit = new JMenuItem("Exit");
    mntmExit.setAccelerator(
        KeyStroke.getKeyStroke(
            KeyEvent.VK_Q, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    mntmExit.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            if (onExit()) System.exit(0);
          }
        });
    mnFile.add(mntmExit);

    JMenu mnHelp = new JMenu("Help");
    menuBar.add(mnHelp);

    JPanel panel = new JPanel();
    frmPuzzledicePuzzleEditor.getContentPane().add(panel);
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));

    JPanel editPanel = new JPanel();
    panel.add(editPanel);
    editPanel.setLayout(new BoxLayout(editPanel, BoxLayout.X_AXIS));

    JSeparator separator_2 = new JSeparator();
    separator_2.setMinimumSize(new Dimension(5, 0));
    separator_2.setMaximumSize(new Dimension(5, 0));
    separator_2.setPreferredSize(new Dimension(5, 0));
    editPanel.add(separator_2);

    areaEditPanel = new AreaEditPanel();
    editPanel.add(areaEditPanel);

    JSeparator separator = new JSeparator();
    separator.setMinimumSize(new Dimension(5, 0));
    separator.setMaximumSize(new Dimension(5, 0));
    separator.setPreferredSize(new Dimension(5, 0));
    editPanel.add(separator);

    puzzleEditPanel = new PuzzleEditPanel();
    editPanel.add(puzzleEditPanel);

    JSeparator separator_1 = new JSeparator();
    separator_1.setMinimumSize(new Dimension(5, 0));
    separator_1.setMaximumSize(new Dimension(5, 0));
    separator_1.setPreferredSize(new Dimension(5, 0));
    editPanel.add(separator_1);

    graphPanel = new JTabbedPane(JTabbedPane.TOP);
    graphPanel.setPreferredSize(
        new Dimension(
            frmPuzzledicePuzzleEditor.getBounds().width,
            frmPuzzledicePuzzleEditor.getBounds().height));
    panel.add(graphPanel);
    graphPanel.setAlignmentY(Component.TOP_ALIGNMENT);

    areaGraph = new mxGraph();

    areaGraph.setAutoSizeCells(true);
    areaGraphComponent = new mxGraphComponent(areaGraph);
    areaGraphComponent.addComponentListener(
        new ComponentAdapter() {
          @Override
          public void componentResized(ComponentEvent arg0) {
            areaGraphLayout =
                new mxOrganicLayout(
                    areaGraph,
                    new Rectangle(
                        0, 0, graphPanel.getBounds().width, graphPanel.getBounds().height));
            areaGraphLayout.execute(areaGraph.getDefaultParent());
          }
        });
    areaGraphComponent.setEnabled(false);
    areaGraphLayout =
        new mxOrganicLayout(
            areaGraph,
            new Rectangle(0, 0, graphPanel.getBounds().width, graphPanel.getBounds().height));

    areaGraph.setEnabled(false);

    graphPanel.addTab("Area Graph", null, areaGraphComponent, null);

    puzzleGraph = new mxGraph();

    puzzleGraph.setAutoSizeCells(true);

    puzzleGraphComponent = new mxGraphComponent(puzzleGraph);
    puzzleGraphComponent.addComponentListener(
        new ComponentAdapter() {
          @Override
          public void componentResized(ComponentEvent arg0) {}
        });
    puzzleGraphComponent.setEnabled(false);
    puzzleGraphOrganicLayout =
        new mxOrganicLayout(
            puzzleGraph,
            new Rectangle(0, 0, graphPanel.getBounds().width, graphPanel.getBounds().height));
    puzzleGraphHierLayout = new mxHierarchicalLayout(puzzleGraph, SwingConstants.WEST);

    graphPanel.addTab("Puzzle Graph", null, puzzleGraphComponent, null);
    txtTextPanel = new JTextArea("Textual description");
    panel.add(txtTextPanel);
    txtTextPanel.setLineWrap(true);
    txtTextPanel.setWrapStyleWord(true);
    txtTextPanel.setEditable(false);

    frmPuzzledicePuzzleEditor.addComponentListener(
        new ComponentAdapter() {
          @Override
          public void componentResized(ComponentEvent arg0) {
            graphPanel.setPreferredSize(
                new Dimension(
                    frmPuzzledicePuzzleEditor.getBounds().width,
                    frmPuzzledicePuzzleEditor.getBounds().height));
          }
        });

    _emptyXml = xmlDigest();
  }
Exemplo n.º 11
0
  private void initComponents() {
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    JPanel topPanel = new JPanel();
    topPanel.setLayout(new BoxLayout(topPanel, BoxLayout.X_AXIS));
    topPanel.add(Box.createRigidArea(new Dimension(20, 40)));
    JLabel lab = new JLabel("Run summary");
    lab.setFont(ViewerWindow.sansFont.deriveFont(18f));
    topPanel.add(lab);
    topPanel.add(Box.createHorizontalGlue());

    this.add(topPanel);

    SummaryTableModel summaryModel = new SummaryTableModel();
    summaryTable = new JTable(summaryModel);
    summaryTable.setTableHeader(null);
    summaryTable.setCellSelectionEnabled(false);
    summaryTable.setShowHorizontalLines(false);
    summaryTable.setShowVerticalLines(false);
    summaryTable.setOpaque(false);
    summaryTable.setBackground(this.getBackground());
    summaryTable.setIntercellSpacing(new Dimension(10, 2));
    TableColumn firstCol = summaryTable.getColumnModel().getColumn(0);
    firstCol.setPreferredWidth(200);
    firstCol.setMaxWidth(300);
    SummaryCellRenderer renderer = new SummaryCellRenderer();
    renderer.setFont(ViewerWindow.sansFont.deriveFont(15f));
    firstCol.setCellRenderer(renderer);

    this.add(summaryTable);
    this.add(Box.createVerticalStrut(10));
    JSeparator sep = new JSeparator(JSeparator.HORIZONTAL);
    sep.setMaximumSize(new Dimension(1000, 20));
    this.add(sep);
    this.add(Box.createVerticalStrut(25));
    JPanel modLabelPanel = new JPanel();
    modLabelPanel.setLayout(new BoxLayout(modLabelPanel, BoxLayout.X_AXIS));
    JLabel modTitle = new JLabel("Modifier summary");
    modTitle.setFont(ViewerWindow.sansFont.deriveFont(18f));
    modLabelPanel.add(Box.createHorizontalStrut(10));
    modLabelPanel.add(modTitle);
    modLabelPanel.add(Box.createHorizontalGlue());
    modLabelPanel.setMaximumSize(new Dimension(1000, 40));
    this.add(modLabelPanel);
    this.add(Box.createVerticalStrut(10));

    String[] columnHeaders = new String[] {"Label", "Proposals", "% Accepted", ""};
    ModifierTableModel modModel = new ModifierTableModel(columnHeaders);
    modifierTable = new JTable(modModel);
    //		JScrollPane modTableSP = new JScrollPane(modifierTable);
    //		modTableSP.setPreferredSize(new Dimension(500, 200));
    // modTableSP.setMaximumSize(new Dimension(2000, 250));
    //		modTableSP.setBorder(BorderFactory.createEmptyBorder(10, 20, 0, 40));
    //		modTableSP.setViewportBorder(null);
    modifierTable.setTableHeader(null);
    modifierTable.setCellSelectionEnabled(false);
    modifierTable.setShowHorizontalLines(false);
    modifierTable.setShowVerticalLines(false);
    modifierTable.setIntercellSpacing(new Dimension(10, 2));
    modifierTable.setOpaque(false);
    modifierTable.setBackground(this.getBackground());

    TableColumn col = modifierTable.getColumnModel().getColumn(0);
    col.setPreferredWidth(100);
    col.setMaxWidth(200);
    col.setCellRenderer(new SummaryCellRenderer());

    col = modifierTable.getColumnModel().getColumn(1);
    col.setPreferredWidth(60);
    col.setMaxWidth(150);

    col = modifierTable.getColumnModel().getColumn(2);
    col.setPreferredWidth(50);
    col.setMaxWidth(100);

    col = modifierTable.getColumnModel().getColumn(3);
    col.setCellRenderer(new MeterBarCellRenderer());
    col.setPreferredWidth(200);
    col.setMaxWidth(200);

    this.add(modifierTable);

    this.add(Box.createVerticalGlue());
  }