public void updateValues() { Attributes attributes = _character.getAttributes(); _strengthValue.setText(String.valueOf(attributes.get(Attributes.STR))); _dexterityValue.setText(String.valueOf(attributes.get(Attributes.DEX))); _constitutionValue.setText(String.valueOf(attributes.get(Attributes.CON))); _intelligenceValue.setText(String.valueOf(attributes.get(Attributes.INT))); _wisdomValue.setText(String.valueOf(attributes.get(Attributes.WIS))); _charismaValue.setText(String.valueOf(attributes.get(Attributes.CHA))); _strengthMod.setText(String.valueOf(attributes.getMod(Attributes.STR))); _dexterityMod.setText(String.valueOf(attributes.getMod(Attributes.DEX))); _constitutionMod.setText(String.valueOf(attributes.getMod(Attributes.CON))); _intelligenceMod.setText(String.valueOf(attributes.getMod(Attributes.INT))); _wisdomMod.setText(String.valueOf(attributes.getMod(Attributes.WIS))); _charismaMod.setText(String.valueOf(attributes.getMod(Attributes.CHA))); String health = String.valueOf(_character.getMaxHealth()); health += "/" + String.valueOf(_character.getBloodied()); health += "/" + String.valueOf(_character.getSurgeValue()); health += " (" + String.valueOf(_character.getSurgeAmount()) + "/day)"; _healthValue.setText(health); _levelValue.setText(String.valueOf(_character.getLevel())); _initiativeValue.setText(String.valueOf(_character.getInitiative())); _fortitudeValue.setText(String.valueOf(_character.getFortitude())); _reflexValue.setText(String.valueOf(_character.getReflex())); _willValue.setText(String.valueOf(_character.getWill())); }
private void attachListeners() { _character.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updateValues(); } }); }