public MapRoomPanel(Room nRoom, DataBank nDataBank, JFrame nParent) { room = nRoom; dataBank = nDataBank; parent = nParent; JPanel topBar = new JPanel(); JPanel buttonBar = new JPanel(); JPanel dataBar = new JPanel(); JPanel monsterPane = new JPanel(); JPanel chestPane = new JPanel(); JPanel otherPane = new JPanel(); jlRoomTitle = new JLabel("Room #"); topBar.add(jlRoomTitle); isStud = new JCheckBox("Stud"); isStud.setToolTipText("This is a stud room."); isMagicLock = new JCheckBox("Magic"); isMagicLock.setToolTipText("Chest/box is magically sealed."); tfLairedMonsterName = new JTextField[Util.MON_MAXSTACKSIZE]; jbLairVerify = new JButton[Util.MON_MAXSTACKSIZE]; jbLairBrowse = new JButton[Util.MON_MAXSTACKSIZE]; monsterPane.setLayout(new GridLayout((Util.MON_MAXSTACKSIZE << 1) + 1, 1)); for (int i = 0; i < Util.MON_MAXSTACKSIZE; i++) { tfLairedMonsterName[i] = new JTextField(10); jbLairVerify[i] = new JButton("Verify"); jbLairBrowse[i] = new JButton("Browse"); jbLairVerify[i].addActionListener(this); jbLairBrowse[i].addActionListener(this); tfLairedMonsterName[i].setToolTipText("Type of monster laired here."); jbLairVerify[i].setToolTipText("Verify monster entered exists."); jbLairBrowse[i].setToolTipText("Browse for a monster."); JPanel lairedMonster = new JPanel(); lairedMonster.add(new JLabel("Lair " + i + ":")); lairedMonster.add(tfLairedMonsterName[i]); lairedMonster.add(jbLairVerify[i]); lairedMonster.add(jbLairBrowse[i]); monsterPane.add(lairedMonster); } JPanel monsterHead = new JPanel(); monsterHead.add(new JLabel("Monster name")); monsterHead.add(new JLabel("#")); monsterPane.add(monsterHead); tfMonsters = new JTextField[Util.MON_MAXSTACKSIZE]; tfMonsterCounts = new JTextField[Util.MON_MAXSTACKSIZE]; jbVerify = new JButton[Util.MON_MAXSTACKSIZE]; jbBrowse = new JButton[Util.MON_MAXSTACKSIZE]; for (byte i = 0; i < Util.MON_MAXSTACKSIZE; i++) { JPanel thisMon = new JPanel(); tfMonsters[i] = new JTextField(10); tfMonsterCounts[i] = new JTextField(3); jbVerify[i] = new JButton("Verify"); jbBrowse[i] = new JButton("Browse"); jbVerify[i].addActionListener(this); jbBrowse[i].addActionListener(this); tfMonsters[i].setToolTipText("Type of monster laired here."); tfMonsterCounts[i].setToolTipText("Average number of monster laired here."); jbVerify[i].setToolTipText("Verify monster entered exists."); jbBrowse[i].setToolTipText("Browse for a monster."); thisMon.add(tfMonsters[i]); thisMon.add(tfMonsterCounts[i]); thisMon.add(jbVerify[i]); thisMon.add(jbBrowse[i]); monsterPane.add(thisMon); } jrBooty = new JRadioButton[3]; jrBooty[0] = new JRadioButton("None"); jrBooty[1] = new JRadioButton("Box"); jrBooty[2] = new JRadioButton("Chest"); jrBooty[0].addActionListener(this); jrBooty[1].addActionListener(this); jrBooty[2].addActionListener(this); jrBooty[0].setToolTipText("No treasure in this room."); jrBooty[1].setToolTipText("A box in this room."); jrBooty[2].setToolTipText("A chest in this room."); bootyGroup = new ButtonGroup(); bootyGroup.add(jrBooty[0]); bootyGroup.add(jrBooty[1]); bootyGroup.add(jrBooty[2]); tfRoomItem = new JTextField(10); tfChestItems = new JTextField[Chest.MAXITEMSINCHEST]; tfChestGold = new JTextField(6); cmbChestTrap = new JComboBox(Trap.values()); tfChestTrapLevel = new JTextField(2); jbBrowseCItem = new JButton[Chest.MAXITEMSINCHEST]; jbVerifyCItem = new JButton[Chest.MAXITEMSINCHEST]; jbBrowseRItem = new JButton("Browse"); jbVerifyRItem = new JButton("Verify"); jbBrowseRItem.addActionListener(this); jbVerifyRItem.addActionListener(this); jbBrowseRItem.setToolTipText("Browse for room item."); jbVerifyRItem.setToolTipText("Verify room item."); JPanel[] cItems = new JPanel[Chest.MAXITEMSINCHEST]; for (int i = 0; i < cItems.length; i++) { cItems[i] = new JPanel(); cItems[i].add(new JLabel("Chest Item")); jbBrowseCItem[i] = new JButton("Browse"); jbVerifyCItem[i] = new JButton("Verify"); tfChestItems[i] = new JTextField(10); jbBrowseCItem[i].addActionListener(this); jbVerifyCItem[i].addActionListener(this); jbBrowseCItem[i].setToolTipText("Browse for chest item."); jbVerifyCItem[i].setToolTipText("Verify chest item."); cItems[i].add(tfChestItems[i]); cItems[i].add(jbVerifyCItem[i]); cItems[i].add(jbBrowseCItem[i]); } JPanel rItem = new JPanel(); // JPanel cItem = new JPanel(); rItem.add(new JLabel("Room Item")); rItem.add(tfRoomItem); rItem.add(jbVerifyRItem); rItem.add(jbBrowseRItem); // cItem.add(new JLabel("Chest Item")); JPanel goldPane = new JPanel(); JPanel trap = new JPanel(); // JPanel trapLevel = new JPanel(); goldPane.add(new JLabel("Gold:")); goldPane.add(tfChestGold); trap.add(new JLabel("Trap type:")); trap.add(cmbChestTrap); trap.add(new JLabel("Trap level:")); trap.add(tfChestTrapLevel); cmbPlayersHere = new JComboBox(); cmbPlayersHere.setToolTipText("Players in this room."); JPanel monsterTypePane = new JPanel(); int mc = (MonsterClass.values().length / 3) + 2; monsterTypePane.setLayout(new GridLayout(mc, 3)); jbMTNone = new JButton("None"); jbMTAll = new JButton("All"); jbMTInvert = new JButton("Invert"); jbMTNone.addActionListener(this); jbMTAll.addActionListener(this); jbMTInvert.addActionListener(this); jbMTNone.setToolTipText("Clear all boxes."); jbMTAll.setToolTipText("Select all boxes."); jbMTInvert.setToolTipText("Invert selection."); monsterTypePane.add(jbMTNone); monsterTypePane.add(jbMTAll); monsterTypePane.add(jbMTInvert); monsterTypes = new JCheckBox[MonsterClass.values().length]; for (MonsterClass t : MonsterClass.values()) { monsterTypes[t.value()] = new JCheckBox(t.toString()); monsterTypePane.add(monsterTypes[t.value()]); } jbOK = new JButton("OK"); jbCancel = new JButton("Cancel"); jbOK.addActionListener(this); jbCancel.addActionListener(this); jbOK.setToolTipText("Store changes to room."); jbCancel.setToolTipText("Cancel any changes."); otherPane = new JPanel(); otherPane.setLayout(new GridLayout(5, 1)); otherPane.add(jrBooty[0]); otherPane.add(jrBooty[1]); otherPane.add(jrBooty[2]); otherPane.add(isStud); otherPane.add(isMagicLock); chestPane.setLayout(new GridLayout(3 + cItems.length, 1)); chestPane.add(rItem); chestPane.add(goldPane); chestPane.add(trap); // chestPane.add(trapLevel); for (int i = 0; i < cItems.length; i++) chestPane.add(cItems[i]); dataBar.add(monsterPane); dataBar.add(otherPane); dataBar.add(chestPane); buttonBar.add(jbOK); buttonBar.add(jbCancel); buttonBar.add(new JLabel("Players:")); buttonBar.add(cmbPlayersHere); JPanel lowLowPane = new JPanel(); lowLowPane.setLayout(new BorderLayout()); lowLowPane.add(monsterTypePane, BorderLayout.CENTER); lowLowPane.add(buttonBar, BorderLayout.SOUTH); JPanel lowerPane = new JPanel(); lowerPane.setLayout(new BorderLayout()); lowerPane.add(dataBar, BorderLayout.CENTER); lowerPane.add(lowLowPane, BorderLayout.SOUTH); setLayout(new BorderLayout()); add(topBar, BorderLayout.NORTH); add(lowerPane, BorderLayout.CENTER); updatePanel(); }