Beispiel #1
0
 public SnapshotDialog(Vector surfaces) {
   super(false);
   super.setTopPanel(firstPanel);
   guiInit(surfaces);
   btnBack.setEnabled(false);
   addListeners();
 }
Beispiel #2
0
  private void guiInit(Vector v) {
    super.guiInit();
    displays = new JComboBox(v);

    JLabel label = new JLabel();
    String help =
        "<html><font color=black size=-1><b>"
            + "Enter a base file name for the snapshot, and choose a "
            + "display surface as the source of the snapshot. "
            + "RePast will append the tick count at which the snapshot was "
            + "taken as well as the '.png' extension, creating a new file "
            + "each time a snapshot is taken.</b></font></html>";
    label.setText(help);
    firstPanel.add(label, BorderLayout.NORTH);

    JPanel subP = new JPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.insets = new Insets(2, 2, 2, 2);
    c.anchor = GridBagConstraints.WEST;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 0.0;
    c.weighty = 0.0;

    c.gridwidth = 1;
    subP.add(new JLabel("File Name: "), c);
    c.gridy = GridBagConstraints.RELATIVE;
    subP.add(new JLabel("Display: "), c);

    c.weightx = 1.0;
    c.gridy = 0;
    c.gridx = 1;

    subP.add(fldName, c);
    c.gridy = 1;
    c.gridwidth = GridBagConstraints.REMAINDER;
    subP.add(displays, c);

    c.weightx = 0.0;
    c.gridx = 2;
    c.gridy = 0;
    c.gridwidth = 1;
    subP.add(btnBrowse, c);

    firstPanel.add(subP, BorderLayout.SOUTH);
    firstPanel.setBorder(BorderFactory.createEtchedBorder());

    // secondPanel
    buttonLabel.setText(NONE_HELP);
    secondPanel.add(buttonLabel, BorderLayout.NORTH);

    JPanel subP1 = new JPanel(new GridBagLayout());
    c.gridx = 0;
    c.gridy = 0;
    c.weightx = 1.0;
    c.fill = GridBagConstraints.HORIZONTAL;

    subP1.add(btnNone, c);
    c.gridy = GridBagConstraints.RELATIVE;
    subP1.add(btnPauseAndEnd, c);
    subP1.add(btnInterval, c);

    c.gridy = 2;
    c.gridx = 1;
    c.weightx = 1.0;
    subP1.add(fldInterval, c);
    fldInterval.setEnabled(false);

    ButtonGroup bg = new ButtonGroup();
    bg.add(btnPauseAndEnd);
    bg.add(btnNone);
    bg.add(btnInterval);

    btnNone.setSelected(true);
    secondPanel.add(subP1, BorderLayout.SOUTH);
    secondPanel.setBorder(BorderFactory.createTitledBorder("Take Snapshot"));

    Dimension browseSize = btnBrowse.getPreferredSize();
    Dimension betterSize = new Dimension(browseSize.width, fldName.getPreferredSize().height);
    btnBrowse.setPreferredSize(betterSize);
  }
Beispiel #3
0
 public void display(JFrame owner, String title) {
   frame = owner;
   super.setSize(337, 286);
   super.display(owner, title, false);
 }