public BadKitPanel(KitAssemblyApp _app) {
    app = _app;
    setLayout(new GridBagLayout());
    c = new GridBagConstraints();

    label = new JLabel();
    sendButton = new JButton("Send Kit Non-Norm");
    sendButton.addActionListener(this);
    toggleDropParts = new JButton("Enable Parts Robot Drop Parts");
    toggleDropParts.addActionListener(this);

    titleLabel = new JLabel("Kit Assembly Non-Normatives");
    titleLabel.setFont(new Font("Verdana", Font.BOLD, 16));
    titleLabel.setPreferredSize(new Dimension(300, 25));
    titleLabel.setMaximumSize(new Dimension(300, 25));
    titleLabel.setMinimumSize(new Dimension(300, 25));
    titleLabel.setAlignmentX(CENTER_ALIGNMENT);

    Kit temp = new Kit();
    temp.setID("Bad Kit to Make");
    for (int j = 0; j < 8; j++) {
      temp.addPart(new Part(new PartInfo(null, "images/good.png")));
    }
    badKit = new BadKit(temp);
    label = new JLabel(temp.getID());

    sent = new JLabel("");
    sent.setPreferredSize(new Dimension(230, 25));
    sent.setMaximumSize(new Dimension(230, 25));
    sent.setMinimumSize(new Dimension(230, 25));
    sent.setAlignmentX(CENTER_ALIGNMENT);

    c.gridx = 0;
    c.gridy = 0;
    add(titleLabel, c);
    c.gridy = 1;

    add(badKit, c);
    c.gridy = 2;
    c.insets = new Insets(10, 0, 0, 0);
    add(sendButton, c);
    c.gridy = 3;
    add(toggleDropParts, c);
    c.gridy = 4;
    add(sent, c);
  }
Пример #2
0
 private void configureStatusLabel(JLabel label, int width) {
   label.setMinimumSize(new Dimension(width, (int) label.getMinimumSize().getHeight()));
   label.setMaximumSize(new Dimension(width, (int) label.getMaximumSize().getHeight()));
   label.setPreferredSize(new Dimension(width, (int) label.getPreferredSize().getHeight()));
 }