public class ATKGraphicsUtils
extends java.lang.Object
Constructor and Description |
---|
ATKGraphicsUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
centerDialog(java.awt.Dialog dlg)
Center the given dialog according to its parent and its preferredSize.
|
static void |
centerDialog(java.awt.Dialog dlg,
int dlgWidth,
int dlgHeight)
Center the given dialog according to its parent.
|
static void |
centerFrame(javax.swing.JComponent parent,
java.awt.Frame fr)
Center the given frame according to the given componenent.
|
static void |
centerFrameOnScreen(java.awt.Frame fr)
Center the given frame on screen.
|
static java.awt.font.FontRenderContext |
getDefaultRenderContext()
Retreive the default render context.
|
static java.awt.font.LineMetrics |
getLineMetrics(java.lang.String s,
java.awt.Font f)
Returns the line metrics for the given font.
|
static java.awt.Window |
getWindowForComponent(java.awt.Component aComponent)
Return the parent Window of the given component.
|
static int[] |
getWindowPosFromArgs(java.lang.String[] args) |
static java.awt.Dimension |
measureString(java.lang.String s,
java.awt.Font f)
Measure a string (using AA font , zoom and translation of Graphics2D are not supported)
|
static void |
positionFrameOnScreen(java.awt.Frame fr,
int posx,
int posy)
Position the given frame at the requested location on screen.
|
static void |
printComponent(javax.swing.JComponent comp,
java.lang.String title,
boolean fitToPage,
int printerResolution)
Displays the print dialog and sends a component snapshot to the printer.
|
public static java.awt.Dimension measureString(java.lang.String s, java.awt.Font f)
s
- String to be measuredf
- Font usedpublic static java.awt.font.FontRenderContext getDefaultRenderContext()
public static java.awt.font.LineMetrics getLineMetrics(java.lang.String s, java.awt.Font f)
s
- String to be measuredf
- Font objectpublic static void centerDialog(java.awt.Dialog dlg, int dlgWidth, int dlgHeight)
Note: This function has been designed to work with 'heavyWeight' system dependant awt window which doesn't use a layout manager (null layout).
dlg
- the dialog.dlgWidth
- desired width of the JDialog content pane.dlgHeight
- desired height of the JDialog content pane.public static void centerDialog(java.awt.Dialog dlg)
dlg
- the dialog.public static void centerFrameOnScreen(java.awt.Frame fr)
fr
- Frame to be centered.public static void centerFrame(javax.swing.JComponent parent, java.awt.Frame fr)
parent
- Parent componentfr
- Frame to be centered.public static java.awt.Window getWindowForComponent(java.awt.Component aComponent)
aComponent
- Child componenentpublic static void printComponent(javax.swing.JComponent comp, java.lang.String title, boolean fitToPage, int printerResolution)
comp
- Component to be printed out.title
- Title of the print dialog.fitToPage
- True to fit the component to the page (printerResolution ignored).printerResolution
- Printer resolution when fitToPage is not enabled.public static void positionFrameOnScreen(java.awt.Frame fr, int posx, int posy)
fr
- Frame to be positioned.public static int[] getWindowPosFromArgs(java.lang.String[] args)