New ability picker (though not turned on yet)

This commit is contained in:
magenoxx 2011-07-15 17:27:22 +04:00
parent d4ef4b24c3
commit 616aea619d
15 changed files with 685 additions and 17 deletions

View file

@ -0,0 +1,68 @@
package mage.client.util;
import com.sun.org.apache.xerces.internal.impl.dv.xs.YearMonthDV;
import java.awt.*;
import java.util.UUID;
/**
* Contains dynamic settings for client.
*
* @author nantuko
*/
public class SettingsManager {
private static SettingsManager fInstance = new SettingsManager();
public static SettingsManager getInstance() {
return fInstance;
}
public int getScreenWidth() {
return screenWidth;
}
public void setScreenWidth(int screenWidth) {
this.screenWidth = screenWidth;
}
public int getScreenHeight() {
return screenHeight;
}
public void setScreenHeight(int screenHeight) {
this.screenHeight = screenHeight;
}
public void setScreenWidthAndHeight(int screenWidth, int screenHeight) {
this.screenWidth = screenWidth;
this.screenHeight = screenHeight;
}
/**
* Get centered component position. Depends on screen width and height.
*
* @param dialogWidth
* @param dialogHeight
* @return
*/
public Point getComponentPosition(int dialogWidth, int dialogHeight) {
if (dialogWidth == 0) {
throw new IllegalArgumentException("dialogWidth can't be 0");
}
if (dialogHeight == 0) {
throw new IllegalArgumentException("dialogHeight can't be 0");
}
int width = Math.max(screenWidth, dialogWidth);
int height = Math.max(screenHeight, dialogHeight);
int x = ((width - dialogWidth) / 2);
int y = ((height - dialogHeight) / 2);
return new Point(x, y);
}
private int screenWidth;
private int screenHeight;
}