Creates the dialog
()
| 114 | * Creates the dialog |
| 115 | */ |
| 116 | @Override |
| 117 | protected void create(){ |
| 118 | setLayout(new GridBagLayout()); |
| 119 | |
| 120 | GridBagConstraints constraints = new GridBagConstraints(); |
| 121 | constraints.gridx = 0; |
| 122 | constraints.gridy = 1; |
| 123 | constraints.insets = new Insets(4, 4, 4, 4); |
| 124 | constraints.fill = GridBagConstraints.HORIZONTAL; |
| 125 | constraints.weightx = 1.0; |
| 126 | |
| 127 | add(new JLabel("Name"), constraints); |
| 128 | constraints.gridx++; |
| 129 | if(place != null) textfieldName = new JTextField(place.getName()); |
| 130 | else textfieldName = new JTextField(); |
| 131 | add(textfieldName, constraints); |
| 132 | |
| 133 | placeGroupNull = new PlaceGroup("none", null); |
| 134 | |
| 135 | constraints.gridx = 0; |
| 136 | constraints.gridy++; |
| 137 | add(new JLabel("Place group"), constraints); |
| 138 | comboboxPlaceGroup = new JComboBox<>(); |
| 139 | comboboxPlaceGroup.addItem(placeGroupNull); |
| 140 | for(PlaceGroup a : world.getPlaceGroups()) comboboxPlaceGroup.addItem(a); |
| 141 | if(place != null && place.getPlaceGroup() != null) comboboxPlaceGroup.setSelectedItem(place.getPlaceGroup()); |
| 142 | constraints.gridx++; |
| 143 | add(comboboxPlaceGroup, constraints); |
| 144 | |
| 145 | constraints.gridx = 0; |
| 146 | constraints.gridy++; |
| 147 | add(new JLabel("Colored info ring"), constraints); |
| 148 | comboboxInfoColor = new JComboBox<>(); |
| 149 | for(InformationColor rl : world.getInformationColors()) comboboxInfoColor.addItem(rl); |
| 150 | if(place != null && place.getInfoRing() != null) comboboxInfoColor.setSelectedItem(place.getInfoRing()); |
| 151 | constraints.gridx++; |
| 152 | add(comboboxInfoColor, constraints); |
| 153 | |
| 154 | Integer min_lvl = -1, max_lvl = -1; |
| 155 | if(place != null){ |
| 156 | min_lvl = place.getRecLevelMin(); |
| 157 | max_lvl = place.getRecLevelMax(); |
| 158 | } |
| 159 | |
| 160 | constraints.gridx = 0; |
| 161 | constraints.gridy++; |
| 162 | add(checkboxLvlMin = new JCheckBox("Show minimum level:"), constraints); |
| 163 | checkboxLvlMin.setSelected(min_lvl >= 0); |
| 164 | checkboxLvlMin.addActionListener(new ActionListener() { |
| 165 | @Override |
| 166 | public void actionPerformed(ActionEvent ae) { |
| 167 | spinnerRecLvlMin.setEnabled(((JCheckBox) ae.getSource()).isSelected()); |
| 168 | } |
| 169 | }); |
| 170 | spinnerRecLvlMin = new JSpinner(); |
| 171 | spinnerRecLvlMin.setModel(new SpinnerNumberModel(max(min_lvl, 0), 0, 1000, 1)); |
| 172 | constraints.gridx++; |
| 173 | add(spinnerRecLvlMin, constraints); |
nothing calls this directly
no test coverage detected