public QuirksPanel(Entity entity, Quirks quirks, boolean editable, DialogOptionListener parent, HashMap<Integer, WeaponQuirks> h_wpnQuirks) { this.entity = entity; this.quirks = quirks; this.editable = editable; this.parent = parent; this.h_wpnQuirks = h_wpnQuirks; setLayout(new GridBagLayout()); refreshQuirks(); }
private void setQuirks() { panQuirks.setQuirks(); }
public void refreshQuirks() { removeAll(); quirkComps = new ArrayList<DialogOptionComponent>(); for (Integer eqNum : h_wpnQuirks.keySet()) { add(new JLabel(group.getDisplayableName()), GBC.eol()); addQuirk(option, editable); JLabel labWpn = new JLabel(m.getName() + " (" + entity.getLocationName(m.getLocation()) + ")"); add(labWpn, GBC.eol()); for (Enumeration<IOptionGroup> i = wpnQuirks.getGroups(); i .hasMoreElements(); ) { continue; addWeaponQuirk(key, option, editable); validate();
private void initGUI() { //Set up the megamek QuirksPanel. for (Mounted m : entity.getWeaponList()) { h_wpnQuirks.put(entity.getEquipmentNum(m), m.getQuirks()); } qpanel = new QuirksPanel(entity, entity.getQuirks(), true, this, h_wpnQuirks); qpanel.refreshQuirks(); //Set up the display of this dialog. JScrollPane scroller = new JScrollPane(qpanel); scroller.setPreferredSize(new Dimension(300,200)); setLayout(new BorderLayout()); add(scroller, BorderLayout.CENTER); add(buildButtonPanel(), BorderLayout.SOUTH); }
public void refreshQuirks() { panQuirks.refreshQuirks(); }
panQuirks = new QuirksPanel(entity, quirks, editable, this, h_wpnQuirks); panPartReps = new JPanel(new GridBagLayout()); setupEquip();
private void addWeaponQuirk(int key, IOption option, boolean editable) { DialogOptionComponent optionComp = new DialogOptionComponent(parent, option, editable); add(optionComp, GBC.eol()); h_wpnQuirkComps.get(key).add(optionComp); }
private void addQuirk(IOption option, boolean editable) { DialogOptionComponent optionComp = new DialogOptionComponent(parent, option, editable); add(optionComp, GBC.eol()); quirkComps.add(optionComp); }
@Override public void actionPerformed(ActionEvent e) { if (okayButton.equals(e.getSource())) { qpanel.setQuirks(); setVisible(false); } else if (cancelButton.equals(e.getSource())) { setVisible(false); } } }