|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.norbl.util.gui.GuiMetrics
public class GuiMetrics
Static methods for finding and manipulating the sizes of gui components.
Field Summary | |
---|---|
static java.awt.FontMetrics |
fontMetrics
|
static javax.swing.JLabel |
LABEL_SAMPLE
Used as sample JComponent for finding the size of things. |
static int |
lineHeight
The height of a line in the the default font of a JLabel. |
static boolean |
permitInit
Flag to prevent init from being called in non-gui applications. |
static int |
screenHeight
|
static int |
screenWidth
|
static int |
STANDARD_SPACE
|
static int |
widthX
The width in pixels of 'X', in the default font of a JLabel. |
Constructor Summary | |
---|---|
GuiMetrics()
|
Method Summary | |
---|---|
static int |
getScreenHeight()
|
static int |
getScreenHeight(javax.swing.JComponent c)
|
static java.awt.Dimension |
getScreenSize()
|
static java.awt.Dimension |
getScreenSize(javax.swing.JComponent c)
|
static int |
getScreenWidth()
|
static int |
getScreenWidth(javax.swing.JComponent c)
|
static int |
getWidth(java.lang.String s)
|
static void |
init()
|
static java.awt.Dimension |
noBiggerThanScreen(java.awt.Dimension d)
|
static java.awt.Dimension |
noBiggerThanScreenFraction(java.awt.Dimension d,
float fraction)
|
static int |
roundDiv(int numer,
int denom)
|
static int |
roundMult(int v,
float factor)
|
static java.awt.Dimension |
screenFraction(float fraction)
Calculates a fraction of the screen size. |
static int |
toPixelHeight(float fraction)
The height, in pixels, of a fraction of the screeen height. |
static int |
toPixelWidth(float fraction)
The width, in pixels, of a fraction of the screeen width. |
static int |
upToMultiple(int h,
int lineH)
Converts a number of pixels to an exact multiple of a another integer, rounding up. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static int STANDARD_SPACE
public static int screenWidth
public static int screenHeight
public static java.awt.FontMetrics fontMetrics
public static int widthX
public static int lineHeight
public static javax.swing.JLabel LABEL_SAMPLE
public static boolean permitInit
Constructor Detail |
---|
public GuiMetrics()
Method Detail |
---|
public static void init()
public static int getScreenWidth(javax.swing.JComponent c)
public static int getScreenWidth()
public static int getScreenHeight(javax.swing.JComponent c)
public static int getScreenHeight()
public static java.awt.Dimension getScreenSize(javax.swing.JComponent c)
public static java.awt.Dimension getScreenSize()
public static java.awt.Dimension noBiggerThanScreen(java.awt.Dimension d)
public static java.awt.Dimension noBiggerThanScreenFraction(java.awt.Dimension d, float fraction)
public static int roundMult(int v, float factor)
public static java.awt.Dimension screenFraction(float fraction)
public static int toPixelWidth(float fraction)
public static int toPixelHeight(float fraction)
public static int roundDiv(int numer, int denom)
public static int getWidth(java.lang.String s)
public static int upToMultiple(int h, int lineH)
h
- the number to modified.lineH
- the 'base', which the return will be a multiple of.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |