Fixed a problem that caused netbeans design view to fail.
-
package mage.client.util;
import java.io.File;
@@ -33,11 +32,13 @@ public final class Config {
static {
Properties p = new Properties();
+ boolean fileFound = true;
try (FileInputStream fis = new FileInputStream(new File("config/config.properties"))) {
p.load(fis);
} catch (IOException ex) {
- logger.fatal("Config error ", ex);
+ fileFound = false;
}
+ if (fileFound) {
serverName = p.getProperty("server-name");
port = Integer.parseInt(p.getProperty("port"));
remoteServer = p.getProperty("remote-server");
@@ -51,20 +52,21 @@ public final class Config {
dimensions = new CardDimensions(cardScalingFactor);
dimensionsEnlarged = new CardDimensions(cardScalingFactorEnlarged);
-// activate instead this part, to run the UI editor for some panels without error
-// serverName = "localhost";
-// port = 17171;
-// remoteServer = "mage-server";
-// cardScalingFactor = 0.4;
-// cardScalingFactorEnlarged = 0.5;
-// handScalingFactor = 1.3;
-// defaultGameType = p.getProperty("default-game-type", "Human");
-// defaultDeckPath = "";
-// defaultOtherPlayerIndex = "1";
-// defaultComputerName = "Computer";
-//
-// dimensions = new CardDimensions(cardScalingFactor);
-// dimensionsEnlarged = new CardDimensions(cardScalingFactorEnlarged);
+ } else { // Take some default valies for netbeans design view
+ serverName = "localhost";
+ port = 17171;
+ remoteServer = "mage-server";
+ cardScalingFactor = 0.4;
+ cardScalingFactorEnlarged = 0.5;
+ handScalingFactor = 1.3;
+ defaultGameType = p.getProperty("default-game-type", "Human");
+ defaultDeckPath = "";
+ defaultOtherPlayerIndex = "1";
+ defaultComputerName = "AI Computer";
+
+ dimensions = new CardDimensions(cardScalingFactor);
+ dimensionsEnlarged = new CardDimensions(cardScalingFactorEnlarged);
+ }
}
