public void itemStateChanged(final ItemEvent e) { if (!initialized) { return; } final JComboBox combo = (JComboBox) e.getSource(); if (e.getStateChange() == ItemEvent.SELECTED) { final String csheet = (String) combo.getSelectedItem(); SettingsHandler.setPCGenOption( "InfoCharacterSheet." + SettingsHandler.getGame().getName() + ".CurrentSheet", csheet); final File template = new File(theSheetDir + File.separator + csheet); theParent.setSheet(template); } }
private void buildCombo() { final File sheetDir = new File(theSheetDir); final File[] fileList = sheetDir.listFiles(); if (fileList == null) { Logging.errorPrint("Could not find preview sheet directory " + theSheetDir); return; } for (int i = 0; i < fileList.length; ++i) { if (!fileList[i].isDirectory() && !fileList[i].isHidden()) { theCombo.addItem(fileList[i].getName()); } } final String csheet = SettingsHandler.getPCGenOption( "InfoCharacterSheet." + SettingsHandler.getGame().getName() + ".CurrentSheet", SettingsHandler.getGame().getDefaultPreviewSheet()); final File template = new File(theSheetDir + File.separator + csheet); theCombo.setSelectedItem(template.getName()); theParent.setSheet(template); }
/** * <code>actionPerformed</code> is an event callback used whenever the user changes the selected * equipment set. The <code>ActionEvent</code> object contains the information about which * equipment set has been selected. * * @param e an <code>ActionEvent</code> object */ public void actionPerformed(ActionEvent e) { pc.setCalcEquipSetId(e.getActionCommand()); theParent.refresh(); }