Example #1
0
  /** Constructs a panel containing an options menu, then returns said panel. */
  public JPanel buildOptionsMenu() {
    JPanel options = new JPanel();

    // Create the height/width section
    JPanel dimensions = new JPanel();
    dimensions.setLayout(new BoxLayout(dimensions, BoxLayout.Y_AXIS));

    JLabel widthLabel = new JLabel("X:");
    JTextField widthBox = new JTextField(10);
    widthField = widthBox;
    JPanel width = new JPanel();
    width.add(widthLabel);
    width.add(widthBox);

    JLabel heightLabel = new JLabel("Y:");
    JTextField heightBox = new JTextField(10);
    heightField = heightBox;
    JPanel height = new JPanel();
    height.add(heightLabel);
    height.add(heightBox);

    dimensions.add(width);
    dimensions.add(height);

    // "Apply changes" button
    JButton apply = new JButton("Apply Changes");
    apply.addActionListener(new ApplyHWChanges());

    // Fill option
    JButton fill = new JButton("Fill with current tile");
    fill.addActionListener(new FillButton());
    options.add(fill);

    // Current selected tile
    JPanel tileArea = new JPanel();
    tileArea.setLayout(new BoxLayout(tileArea, BoxLayout.Y_AXIS));
    tileArea.add(new JLabel("Current Tile"));

    tileArea.add(currTileDisplay);

    // remove once testing is done
    backEnd.setTestImage(currTileImg);

    // Save button
    JButton save = new JButton("Save");
    save.addActionListener(new SaveButton());

    options.add(dimensions);
    options.add(apply);
    options.add(tileArea);
    options.add(save);
    return options;
  }