use of java.awt.Dimension in project pcgen by PCGen.
the class CompanionInfoTab method initComponents.
private void initComponents() {
{
DefaultTableColumnModel model = new DefaultTableColumnModel();
TableColumn column = new TableColumn(0);
column.setResizable(true);
model.addColumn(column);
column = new TableColumn(1, 120, new ButtonCellRenderer(), null);
column.setMaxWidth(120);
column.setResizable(false);
model.addColumn(column);
companionsTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
companionsTable.getTableHeader().setResizingAllowed(false);
companionsTable.setAutoCreateColumnsFromModel(false);
companionsTable.setColumnModel(model);
}
companionsTable.setIntercellSpacing(new Dimension(0, 0));
companionsTable.setFocusable(false);
companionsTable.setRowHeight(23);
companionsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
setLeftComponent(new JScrollPane(companionsTable));
JPanel rightPane = new JPanel(new BorderLayout());
infoPane.setOpaque(false);
infoPane.setEditable(false);
infoPane.setFocusable(true);
//$NON-NLS-1$
infoPane.setContentType("text/html");
rightPane.add(new JScrollPane(infoPane), BorderLayout.CENTER);
JPanel buttonPane = new JPanel(new FlowLayout());
buttonPane.add(loadButton);
rightPane.add(buttonPane, BorderLayout.SOUTH);
setRightComponent(rightPane);
}
use of java.awt.Dimension in project pcgen by PCGen.
the class SettingsHandler method getOptionsFromProperties.
public static Dimension getOptionsFromProperties(final PlayerCharacter aPC) {
Dimension d = new Dimension(0, 0);
//$NON-NLS-1$ //$NON-NLS-2$
final String tempBrowserPath = getPCGenOption("browserPath", "");
if (//$NON-NLS-1$
!"".equals(tempBrowserPath)) {
setBrowserPath(tempBrowserPath);
} else {
setBrowserPath(null);
}
setLeftUpperCorner(new //$NON-NLS-1$
Point(//$NON-NLS-1$
getPCGenOption("windowLeftUpperCorner.X", -1.0).intValue(), //$NON-NLS-1$
getPCGenOption("windowLeftUpperCorner.Y", -1.0).intValue()));
//$NON-NLS-1$
setWindowState(getPCGenOption("windowState", Frame.NORMAL));
//$NON-NLS-1$
Double dw = getPCGenOption("windowWidth", 0.0);
//$NON-NLS-1$
Double dh = getPCGenOption("windowHeight", 0.0);
if (!CoreUtility.doublesEqual(dw.doubleValue(), 0.0) && !CoreUtility.doublesEqual(dh.doubleValue(), 0.0)) {
final int width = Integer.parseInt(dw.toString().substring(0, //$NON-NLS-1$
Math.min(dw.toString().length(), dw.toString().lastIndexOf("."))));
final int height = Integer.parseInt(dh.toString().substring(0, //$NON-NLS-1$
Math.min(dh.toString().length(), dh.toString().lastIndexOf("."))));
d = new Dimension(width, height);
}
setCustomizerLeftUpperCorner(new //$NON-NLS-1$
Point(//$NON-NLS-1$
getPCGenOption("customizer.windowLeftUpperCorner.X", -1.0).intValue(), //$NON-NLS-1$
getPCGenOption("customizer.windowLeftUpperCorner.Y", -1.0).intValue()));
//$NON-NLS-1$
dw = getPCGenOption("customizer.windowWidth", 0.0);
//$NON-NLS-1$
dh = getPCGenOption("customizer.windowHeight", 0.0);
if (!CoreUtility.doublesEqual(dw.doubleValue(), 0.0) && !CoreUtility.doublesEqual(dh.doubleValue(), 0.0)) {
setCustomizerDimension(new Dimension(dw.intValue(), dh.intValue()));
}
setKitSelectorLeftUpperCorner(new //$NON-NLS-1$
Point(//$NON-NLS-1$
getPCGenOption("kitSelector.windowLeftUpperCorner.X", -1.0).intValue(), //$NON-NLS-1$
getPCGenOption("kitSelector.windowLeftUpperCorner.Y", -1.0).intValue()));
//$NON-NLS-1$
dw = getPCGenOption("kitSelector.windowWidth", 0.0);
//$NON-NLS-1$
dh = getPCGenOption("kitSelector.windowHeight", 0.0);
if (!CoreUtility.doublesEqual(dw.doubleValue(), 0.0) && !CoreUtility.doublesEqual(dh.doubleValue(), 0.0)) {
setKitSelectorDimension(new Dimension(dw.intValue(), dh.intValue()));
}
//
// Read in the buy/sell percentages for the gear tab
// If not in the .ini file and ignoreCost is set, then use 0%
// Otherwise set buy to 100% and sell to %50
//
//$NON-NLS-1$
int buyRate = getPCGenOption("GearTab.buyRate", -1);
//$NON-NLS-1$
int sellRate = getPCGenOption("GearTab.sellRate", -1);
if ((buyRate < 0) || (sellRate < 0)) {
if (//$NON-NLS-1$
getPCGenOption("GearTab.ignoreCost", false)) {
buyRate = 0;
sellRate = 0;
} else {
buyRate = 100;
sellRate = 50;
}
}
//$NON-NLS-1$ //$NON-NLS-2$
Globals.initCustColumnWidth(CoreUtility.split(getOptions().getProperty("pcgen.options.custColumnWidth", ""), ','));
//$NON-NLS-1$
loadURLs = getPCGenOption("loadURLs", false);
//$NON-NLS-1$
Globals.setSourceDisplay(SourceFormat.values()[getPCGenOption("sourceDisplay", SourceFormat.LONG.ordinal())]);
//$NON-NLS-1$
setAlwaysOverwrite(getPCGenOption("alwaysOverwrite", false));
//$NON-NLS-1$
setAutoFeatsRefundable(getPCGenOption("autoFeatsRefundable", false));
//$NON-NLS-1$
setAutogenExoticMaterial(getPCGenOption("autoGenerateExoticMaterial", false));
//$NON-NLS-1$
setAutogenMagic(getPCGenOption("autoGenerateMagic", false));
//$NON-NLS-1$
setAutogenMasterwork(getPCGenOption("autoGenerateMasterwork", false));
//$NON-NLS-1$
setAutogenRacial(getPCGenOption("autoGenerateRacial", false));
//$NON-NLS-1$
setChaTabPlacement(getOptionTabPlacement("chaTabPlacement", SwingConstants.TOP));
setCreatePcgBackup(getPCGenOption("createPcgBackup", true));
//$NON-NLS-1$
setCustomizerSplit1(getPCGenOption("customizer.split1", -1));
//$NON-NLS-1$
setCustomizerSplit2(getPCGenOption("customizer.split2", -1));
//$NON-NLS-1$
setDefaultOSType(getPCGenOption("defaultOSType", null));
//$NON-NLS-1$
setEnforceSpendingBeforeLevelUp(getPCGenOption("enforceSpendingBeforeLevelUp", false));
//$NON-NLS-1$
setGearTab_AllowDebt(getPCGenOption("GearTab.allowDebt", false));
//$NON-NLS-1$
setGearTab_AutoResize(getPCGenOption("GearTab.autoResize", false));
setGearTab_BuyRate(buyRate);
//$NON-NLS-1$
setGearTab_IgnoreCost(getPCGenOption("GearTab.ignoreCost", false));
setGearTab_SellRate(sellRate);
//$NON-NLS-1$
setGrimHPMode(getPCGenOption("grimHPMode", false));
//$NON-NLS-1$
setGrittyACMode(getPCGenOption("grittyACMode", false));
//$NON-NLS-1$
setGUIUsesOutputNameEquipment(getPCGenOption("GUIUsesOutputNameEquipment", false));
//$NON-NLS-1$
setGUIUsesOutputNameSpells(getPCGenOption("GUIUsesOutputNameSpells", false));
//$NON-NLS-1$
setHideMonsterClasses(getPCGenOption("hideMonsterClasses", false));
//$NON-NLS-1$
setHPMaxAtFirstLevel(getPCGenOption("hpMaxAtFirstLevel", true));
//$NON-NLS-1$
setHPMaxAtFirstClassLevel(getPCGenOption("hpMaxAtFirstClassLevel", false));
//$NON-NLS-1$
setHPMaxAtFirstPCClassLevelOnly(getPCGenOption("hpMaxAtFirstPCClassLevelOnly", false));
//$NON-NLS-1$
setHPPercent(getPCGenOption("hpPercent", 100));
//$NON-NLS-1$
setHPRollMethod(getPCGenOption("hpRollMethod", Constants.HP_STANDARD));
//$NON-NLS-1$
setIgnoreMonsterHDCap(getPCGenOption("ignoreMonsterHDCap", false));
//$NON-NLS-1$//$NON-NLS-2$
setInvalidDmgText(getPCGenOption("invalidDmgText", LanguageBundle.getString("SettingsHandler.114")));
//$NON-NLS-1$//$NON-NLS-2$
setInvalidToHitText(getPCGenOption("invalidToHitText", LanguageBundle.getString("SettingsHandler.114")));
//$NON-NLS-1$
setLastTipShown(getPCGenOption("lastTipOfTheDayTipShown", -1));
//$NON-NLS-1$
setLookAndFeel(getPCGenOption("looknFeel", 1));
//$NON-NLS-1$
setMaxPotionSpellLevel(getPCGenOption("maxPotionSpellLevel", 3));
//$NON-NLS-1$
setMaxWandSpellLevel(getPCGenOption("maxWandSpellLevel", 4));
//$NON-NLS-1$
setMetamagicAllowedInEqBuilder(getPCGenOption("allowMetamagicInCustomizer", false));
setPccFilesLocation(new File(expandRelativePath(getPCGenOption(//$NON-NLS-1$
"pccFilesLocation", //$NON-NLS-1$ //$NON-NLS-2$
System.getProperty("user.dir") + File.separator + "data"))));
setPcgenOutputSheetDir(new File(expandRelativePath(//$NON-NLS-1$
getOptions().getProperty(//$NON-NLS-1$
"pcgen.files.pcgenOutputSheetDir", //$NON-NLS-1$ //$NON-NLS-2$
System.getProperty("user.dir") + File.separator + "outputsheets"))));
setPcgenPreviewDir(new File(expandRelativePath(//$NON-NLS-1$
getOptions().getProperty(//$NON-NLS-1$
"pcgen.files.pcgenPreviewDir", //$NON-NLS-1$ //$NON-NLS-2$
System.getProperty("user.dir") + File.separator + "preview"))));
setGmgenPluginDir(new File(expandRelativePath(//$NON-NLS-1$
getOptions().getProperty(//$NON-NLS-1$
"gmgen.files.gmgenPluginDir", //$NON-NLS-1$ //$NON-NLS-2$
System.getProperty("user.dir") + File.separator + "plugins"))));
//$NON-NLS-1$
setBackupPcgPath(new File(expandRelativePath(getOptions().getProperty("pcgen.files.characters.backup", ""))));
setPortraitsPath(new File(expandRelativePath(//$NON-NLS-1$
getOptions().getProperty(//$NON-NLS-1$
"pcgen.files.portraits", Globals.getDefaultPcgPath()))));
//$NON-NLS-1$ //$NON-NLS-2$
setPostExportCommandStandard(getPCGenOption("postExportCommandStandard", ""));
//$NON-NLS-1$ //$NON-NLS-2$
setPostExportCommandPDF(getPCGenOption("postExportCommandPDF", ""));
//$NON-NLS-1$
setPrereqFailColor(getPCGenOption("prereqFailColor", Color.red.getRGB()));
//$NON-NLS-1$
setPrereqQualifyColor(getPCGenOption("prereqQualifyColor", Color.black.getRGB()));
//$NON-NLS-1$
setPreviewTabShown(getPCGenOption("previewTabShown", true));
//$NON-NLS-1$
setROG(getPCGenOption("isROG", false));
//$NON-NLS-1$
setSaveCustomInLst(getPCGenOption("saveCustomInLst", false));
//$NON-NLS-1$
setSaveOutputSheetWithPC(getPCGenOption("saveOutputSheetWithPC", false));
//$NON-NLS-1$
setPrintSpellsWithPC(getPCGenOption("printSpellsWithPC", true));
//$NON-NLS-1$ //$NON-NLS-2$
setSelectedSpellSheet(expandRelativePath(getOptions().getProperty("pcgen.files.selectedSpellOutputSheet", "")));
setSelectedCharacterHTMLOutputSheet(expandRelativePath(//$NON-NLS-1$
getOptions().getProperty(//$NON-NLS-1$
"pcgen.files.selectedCharacterHTMLOutputSheet", "")), //$NON-NLS-1$
aPC);
setSelectedCharacterPDFOutputSheet(expandRelativePath(//$NON-NLS-1$
getOptions().getProperty(//$NON-NLS-1$
"pcgen.files.selectedCharacterPDFOutputSheet", "")), //$NON-NLS-1$
aPC);
//$NON-NLS-1$ //$NON-NLS-2$
setSelectedEqSetTemplate(expandRelativePath(getOptions().getProperty("pcgen.files.selectedEqSetTemplate", "")));
setSelectedPartyHTMLOutputSheet(expandRelativePath(//$NON-NLS-1$
getOptions().getProperty(//$NON-NLS-1$
"pcgen.files.selectedPartyHTMLOutputSheet", //$NON-NLS-1$
"")));
setSelectedPartyPDFOutputSheet(expandRelativePath(//$NON-NLS-1$
getOptions().getProperty(//$NON-NLS-1$
"pcgen.files.selectedPartyPDFOutputSheet", //$NON-NLS-1$
"")));
//$NON-NLS-1$
setShowFeatDialogAtLevelUp(getPCGenOption("showFeatDialogAtLevelUp", true));
//$NON-NLS-1$
setShowHPDialogAtLevelUp(getPCGenOption("showHPDialogAtLevelUp", true));
//$NON-NLS-1$
setShowImagePreview(getPCGenOption("showImagePreview", true));
//$NON-NLS-1$
setShowSingleBoxPerBundle(getPCGenOption("showSingleBoxPerBundle", false));
setOutputDeprecationMessages(getPCGenOption("outputDeprecationMessages", true));
setInputUnconstructedMessages(getPCGenOption("inputUnconstructedMessages", false));
//$NON-NLS-1$
setShowStatDialogAtLevelUp(getPCGenOption("showStatDialogAtLevelUp", true));
//$NON-NLS-1$
setShowTipOfTheDay(getPCGenOption("showTipOfTheDay", true));
//$NON-NLS-1$
setShowToolBar(getPCGenOption("showToolBar", true));
//$NON-NLS-1$
setShowSkillModifier(getPCGenOption("showSkillModifier", true));
//$NON-NLS-1$
setShowSkillRanks(getPCGenOption("showSkillRanks", true));
//$NON-NLS-1$
setShowWarningAtFirstLevelUp(getPCGenOption("showWarningAtFirstLevelUp", true));
//$NON-NLS-1$ //$NON-NLS-2$
setSkinLFThemePack(getPCGenOption("skinLFThemePack", ""));
//$NON-NLS-1$
setSpellMarketPriceAdjusted(getPCGenOption("spellMarketPriceAdjusted", false));
//$NON-NLS-1$
setTabPlacement(getOptionTabPlacement("tabPlacement", SwingConstants.BOTTOM));
//$NON-NLS-1$
setUseHigherLevelSlotsDefault(getPCGenOption("useHigherLevelSlotsDefault", false));
//$NON-NLS-1$
setUseWaitCursor(getPCGenOption("useWaitCursor", true));
//$NON-NLS-1$
setWantToLoadMasterworkAndMagic(getPCGenOption("loadMasterworkAndMagicFromLst", false));
setWeaponProfPrintout(getPCGenOption("weaponProfPrintout", //$NON-NLS-1$
Constants.DEFAULT_PRINTOUT_WEAPONPROF));
// Load up all the RuleCheck stuff from the options.ini file
// It's stored as:
// pcgen.options.rulechecks=aKey:Y|bKey:N|cKey:Y
//$NON-NLS-1$ //$NON-NLS-2$
parseRuleChecksFromOptions(getPCGenOption("ruleChecks", ""));
return d;
}
use of java.awt.Dimension in project L42 by ElvisResearchGroup.
the class Frame method createNew.
private static Frame createNew(String wName, String html, int x, int y) {
FutureTask<Frame> future = new FutureTask<>(() -> {
final Frame frame = new Frame(Frame.extractTitle(html));
JFXPanel jfxPanel = new JFXPanel();
frame.createHtmlContent(jfxPanel, html);
frame.getContentPane().add(jfxPanel);
frame.setMinimumSize(new Dimension(x, y));
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
Frame.close(wName);
}
});
frame.setVisible(true);
return frame;
});
SwingUtilities.invokeLater(future);
try {
return future.get();
} catch (ExecutionException e) {
throw propagateException(e.getCause());
} catch (InterruptedException e) {
throw propagateException(e);
}
}
use of java.awt.Dimension in project pcgen by PCGen.
the class RunConvertPanel method setupDisplay.
/**
* @see pcgen.gui2.converter.panel.ConvertSubPanel#setupDisplay(javax.swing.JPanel, pcgen.cdom.base.CDOMObject)
*/
@Override
public void setupDisplay(JPanel panel, CDOMObject pc) {
panel.setLayout(new GridBagLayout());
JLabel introLabel = new JLabel("Conversion in progress");
GridBagConstraints gbc = new GridBagConstraints();
Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, 1, 1.0, 0);
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(0, 10, 5, 10);
panel.add(introLabel, gbc);
JLabel explainLabel = new JLabel("<html>The LST data is being converted. In the log, " + "LSTERROR rows are errors that need to be manually corrected in the source data. " + "LSTWARN rows indicate changes the converter is making. " + "See " + changeLogFile.getAbsolutePath() + " for a log of all data changes.</html>");
explainLabel.setFocusable(true);
Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, 1, 1.0, 0);
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(0, 10, 5, 10);
panel.add(explainLabel, gbc);
progressBar = getProgressBar();
Dimension d = progressBar.getPreferredSize();
d.width = 400;
progressBar.setPreferredSize(d);
progressBar.setStringPainted(true);
Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, 1, 1.0, 0);
gbc.fill = GridBagConstraints.HORIZONTAL;
panel.add(progressBar, gbc);
messageAreaContainer = new JScrollPane(getMessageArea());
Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, GridBagConstraints.REMAINDER, 1.0, 1.0);
gbc.fill = GridBagConstraints.BOTH;
panel.add(messageAreaContainer, gbc);
panel.setPreferredSize(new Dimension(800, 500));
}
use of java.awt.Dimension in project pcgen by PCGen.
the class PCGenFrame method showMatureDialog.
private void showMatureDialog(String text) {
Logging.errorPrint("Warning: The following datasets contains mature themes. User discretion is advised.");
Logging.errorPrint(text);
final JDialog aFrame = new JDialog(this, LanguageBundle.getString("in_matureTitle"), true);
final JPanel jPanel1 = new JPanel();
final JPanel jPanel3 = new JPanel();
final JLabel jLabel1 = new //$NON-NLS-1$
JLabel(//$NON-NLS-1$
LanguageBundle.getString("in_matureWarningLine1"), SwingConstants.CENTER);
final JLabel jLabel2 = new //$NON-NLS-1$
JLabel(//$NON-NLS-1$
LanguageBundle.getString("in_matureWarningLine2"), SwingConstants.CENTER);
//$NON-NLS-1$
final JCheckBox jCheckBox1 = new JCheckBox(LanguageBundle.getString("in_licShowOnLoad"));
//$NON-NLS-1$
final JButton jClose = new JButton(LanguageBundle.getString("in_close"));
//$NON-NLS-1$
jClose.setMnemonic(LanguageBundle.getMnemonic("in_mn_close"));
jPanel1.setLayout(new BorderLayout());
jPanel1.add(jLabel1, BorderLayout.NORTH);
jPanel1.add(jLabel2, BorderLayout.SOUTH);
HtmlPanel htmlPanel = new HtmlPanel();
HtmlRendererContext theRendererContext = new SimpleHtmlRendererContext(htmlPanel, new SimpleUserAgentContext());
htmlPanel.setHtml(text, "", theRendererContext);
jPanel3.add(jCheckBox1);
jPanel3.add(jClose);
final PropertyContext context = PCGenSettings.OPTIONS_CONTEXT;
jCheckBox1.setSelected(context.getBoolean(PCGenSettings.OPTION_SHOW_MATURE_ON_LOAD));
jClose.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
aFrame.dispose();
}
});
jCheckBox1.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent evt) {
context.setBoolean(PCGenSettings.OPTION_SHOW_MATURE_ON_LOAD, jCheckBox1.isSelected());
}
});
aFrame.getContentPane().setLayout(new BorderLayout());
aFrame.getContentPane().add(jPanel1, BorderLayout.NORTH);
aFrame.getContentPane().add(htmlPanel, BorderLayout.CENTER);
aFrame.getContentPane().add(jPanel3, BorderLayout.SOUTH);
aFrame.setSize(new Dimension(456, 176));
Utility.setComponentRelativeLocation(this, aFrame);
aFrame.setVisible(true);
}
Aggregations