Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Loading is the item is equippable is working in the editor

  • Loading branch information...
commit 048fc5a3fed8326c3682e8f7147f08baf6ca0796 1 parent a9eaf5b
@nhydock authored
Showing with 20 additions and 8 deletions.
  1. +20 −8 src/editor/ItemEditor/ItemEditorGUI.java
View
28 src/editor/ItemEditor/ItemEditorGUI.java
@@ -126,7 +126,7 @@ public ItemEditorGUI()
add(l);
add(nameField);
- l = new JLabel("Battle Animation: ");
+ l = new JLabel("Battle Command: ");
l.setSize(l.getPreferredSize());
l.setLocation(650, 10);
@@ -140,25 +140,27 @@ public ItemEditorGUI()
* Value Type button group
*/
typePane = new JLayeredPane();
- typePane.setSize(new Dimension(350, 64));
+ typePane.setSize(new Dimension(400, 64));
typePane.setLocation(220, 64);
typePane.setBorder(BorderFactory.createTitledBorder("Equipment Type: "));
types = new ButtonGroup();
+ equipmentTypeButtons = new JRadioButton[EQUIPMENTTYPES.length];
for (int i = 0; i < EQUIPMENTTYPES.length; i++)
{
JRadioButton jb = new JRadioButton(EQUIPMENTLABELS[i]);
jb.setSize(jb.getPreferredSize());
- jb.setLocation(20+(100*i), 24);
-
+ jb.setLocation(40+(100*i), 24);
+ equipmentTypeButtons[i] = jb;
types.add(jb);
typePane.add(jb);
}
+ equipmentTypeButtons[0].setSelected(true);
add(typePane);
equippable = new JCheckBox("Is Equippable");
equippable.setSize(equippable.getPreferredSize());
- equippable.setLocation(typePane.getX() + 150, typePane.getY());
+ equippable.setLocation(typePane.getX() + 150, typePane.getY()-3);
equippable.addActionListener(this);
enablePane(typePane, equippable.isSelected());
add(equippable);
@@ -191,6 +193,7 @@ public ItemEditorGUI()
add(saveButton);
add(restoreButton);
+ validate();
}
@@ -225,13 +228,22 @@ public void enablePane(JLayeredPane jp, boolean lock)
}
/**
- * Loads an enemies values into the editor's fields and makes it the active enemy
+ * Loads an item's values into the editor's fields and makes it the active item
* @param e
*/
- public void loadItem(Item i)
+ public void loadItem(Item item)
{
//load name
- nameField.setText(i.getName());
+ nameField.setText(item.getName());
+ equippable.setSelected(item.isEquipment());
+ enablePane(typePane, equippable.isSelected());
+ for (int i = 0; i < EQUIPMENTTYPES.length; i++)
+ {
+ boolean selected = false;
+ if (i == item.getEquipmentType())
+ selected = true;
+ equipmentTypeButtons[i].setSelected(selected);
+ }
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.