public class GWindow
extends javax.swing.JFrame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Constructor and Description |
---|
GWindow()
Construct a GWindow with default title and size.
|
GWindow(Position position,
Size size,
boolean noTitlebar)
Same as GWindow(), but titlebar may be omited.
|
GWindow(java.lang.String title)
Same as GWindow() with given title.
|
GWindow(java.lang.String title,
Position position,
Size size)
Same as GWindow() with given title, position and size of client window.
|
GWindow(java.lang.String title,
Size size)
Same as GWindow() with given title and size of client window.
|
Modifier and Type | Method and Description |
---|---|
void |
addExitListener(ExitListener exitListener)
Register an ExitListener to get a notification when the close button is clicked.
|
void |
adjust()
Actualize the conversion between window und user coordinates
according to the current component size.
|
void |
clear()
Clear the screen graphics (without calling repaint).
|
void |
clearBuf()
Clear the graphics offline buffer (without calling repaint).
|
void |
clearStore(java.awt.Color color)
Clear store buffer by uniformly painting it with given color.
|
static void |
delay(int time)
Delay execution for the given amount of time ( in ms ).
|
void |
disableClose(boolean b)
Disable/Enable the title bar's closing button.
|
void |
drawImage(java.awt.image.BufferedImage bi,
int x,
int y,
boolean lowerLeft)
Draw the given BufferedImage into offscreen buffer at
(x, y) coordinates of upper left corner.
|
java.lang.String |
getAbout()
Return copywrite information.
|
java.awt.geom.AffineTransform |
getAffineScale()
Perform scaling of the offscreen buffer to fit the image to
the current window dimension.
|
java.awt.Color |
getBgColor()
Return the current background color.
|
int |
getBottomInset()
Return the bottom inset of the window (border width) in pixels.
|
java.awt.image.BufferedImage |
getBufferedImage()
Return a reference to the offscreen buffer
created by GWindow's constructor.
|
int |
getCurrentHeight()
Return the height of the client area in user coordinates.
|
int |
getCurrentWidth()
Return the width of the client area in user coordinates.
|
static java.lang.String[] |
getDesktopProperties()
Return the property names of available system properties.
|
int |
getLeftInset()
Return the left inset of the window (border width) in pixels.
|
java.awt.Graphics2D |
getOffG2D()
Return the Graphics2D context of the offscreen buffer
created by GWindow's constructor.
|
java.awt.Color |
getPixelColor(double x,
double y)
Return the color of the screen pixel at given location.
|
int |
getPopupHeight()
Return the height of the window in user coordinates
when it was created.
|
int |
getPopupWidth()
Return the width of the window in user coordinates
when it was created.
|
int |
getRightInset()
Return the right inset of the window (border width) in pixels.
|
double |
getScaleX()
Return the current magnification factor of horizontal window size.
|
double |
getScaleY()
Return the current magnification factor of vertical window size.
|
static int |
getScreenHeight()
Get the height of the screen (in pixels).
|
static int |
getScreenWidth()
Get the width of the screen (in pixels).
|
java.lang.String |
getVersion()
Return version information.
|
boolean |
isDisposed()
Return true, if the window was disposed or released.
|
static Position |
position(int ulx,
int uly)
Return a Position ref with specified upperleft x and y coordinates.
|
void |
recallGraphics()
Copy the store buffer to the offscreen buffer.
|
java.awt.Color |
setBgColor(java.awt.Color color)
Set the background color of the window and offscreen buffer
and show the window.
|
void |
setOffG2D(java.awt.Graphics2D g2D)
Set the Graphics2D context of the offscreen buffer.
|
void |
setTitle(java.lang.String title)
Set the title in the window's title bar.
|
void |
setWinCenter()
Set window to screen center.
|
void |
setWinCenter(Size size)
Set window to screen center with given size of the embedded component.
|
void |
setWindow(double xmin,
double xmax,
double ymin,
double ymax)
Set window coordinate system
left_x, right_x, bottom_y, top_y
|
void |
setWinPosition(int ulx,
int uly)
Set the position of the window (x-y-coordinates of upper left corner in device coordinates).
|
void |
setWinPosition(Position position)
Set the position of the window (position of uppler left corner in device coordinates).
|
void |
setWinSize(int width,
int height)
Set the size of the embedded component (in device coordinates)
to given width and heigth.
|
void |
setWinSize(Size size)
Set the size of the embedded component (in device coordinates).
|
void |
showComponent(javax.swing.JComponent component)
Add the component to the frame's contentPane
and show the window with default background color.
|
void |
showComponent(javax.swing.JComponent component,
boolean visible)
Same as showComponent(JComponent component)
but set visibilty to the given value.
|
void |
showComponent(javax.swing.JComponent component,
java.awt.Color bgColor)
Add a component to the frame's contentPane
and show the window with the given background color.
|
void |
showComponent(javax.swing.JComponent component,
java.awt.Color bgColor,
boolean visible)
Same as showComponent(JComponent component, Color bgColor)
but set visibilty to the given value.
|
static Size |
size(int width,
int height)
Return a Size ref with specified width and height.
|
void |
storeGraphics()
Copy the offscreen buffer to a store buffer.
|
int |
topLeftInset()
Return the top inset of the window (title bar + border) in pixels.
|
java.awt.Shape |
toUser(java.awt.Shape shape)
Convert the given shape from window coordinates to user coordinates.
|
int |
toUserHeight(double windowHeight)
Convert window coordinates increment to user coordinates increment (vertical).
|
java.awt.geom.AffineTransform |
toUserTransform()
Create an affine transform to convert a shape
from window coordinates to user coordinates and return it.
|
int |
toUserWidth(double windowWidth)
Convert window coordinates increment to user coordinates increment (horizontal).
|
int |
toUserY(double windowY)
Convert window coordinate to user coordinate (vertical).
|
double |
toWindowHeight(int userHeight)
Convert user coordinates increment to window coordinates increment (vertical).
|
double |
toWindowWidth(int userWidth)
Convert user coordinates increment to window coordinates increment (horizontal).
|
double |
toWindowX(int userX)
Convert user coordinates to window coordinates (horizontal).
|
double |
toWindowY(int userY)
Convert user coordinates to window coordinates (vertical).
|
void |
transformGraphics(java.awt.geom.AffineTransform at)
Transform offscreen buffer with given affine transformation.
|
getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setTransferHandler, update
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setUndecorated
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public GWindow()
public GWindow(java.lang.String title)
public GWindow(java.lang.String title, Size size)
public GWindow(java.lang.String title, Position position, Size size)
public GWindow(Position position, Size size, boolean noTitlebar)
public void addExitListener(ExitListener exitListener)
public static Position position(int ulx, int uly)
new
public static Size size(int width, int height)
public static int getScreenWidth()
public static int getScreenHeight()
public java.awt.Color setBgColor(java.awt.Color color)
public java.awt.Color getBgColor()
public void setWinPosition(Position position)
public void setWinPosition(int ulx, int uly)
public void setWinSize(Size size)
public void setWinSize(int width, int height)
public void setWinCenter(Size size)
public void setWinCenter()
public void showComponent(javax.swing.JComponent component)
public void showComponent(javax.swing.JComponent component, boolean visible)
public void showComponent(javax.swing.JComponent component, java.awt.Color bgColor)
public void showComponent(javax.swing.JComponent component, java.awt.Color bgColor, boolean visible)
public java.awt.image.BufferedImage getBufferedImage()
public java.awt.Graphics2D getOffG2D()
public void setOffG2D(java.awt.Graphics2D g2D)
public int getCurrentWidth()
public int getCurrentHeight()
public int getLeftInset()
public int getRightInset()
public int topLeftInset()
public int getBottomInset()
public double getScaleX()
public double getScaleY()
public int getPopupWidth()
public int getPopupHeight()
public java.awt.geom.AffineTransform getAffineScale()
public void setTitle(java.lang.String title)
setTitle
in class java.awt.Frame
public int toUserY(double windowY)
public int toUserWidth(double windowWidth)
public int toUserHeight(double windowHeight)
public double toWindowX(int userX)
public double toWindowY(int userY)
public double toWindowWidth(int userWidth)
public double toWindowHeight(int userHeight)
public void setWindow(double xmin, double xmax, double ymin, double ymax)
public java.awt.Shape toUser(java.awt.Shape shape)
public java.awt.geom.AffineTransform toUserTransform()
public java.lang.String getVersion()
public java.lang.String getAbout()
public void adjust()
public static void delay(int time)
public void clearBuf()
public void clear()
public static java.lang.String[] getDesktopProperties()
public void disableClose(boolean b)
public void storeGraphics()
public void recallGraphics()
public void clearStore(java.awt.Color color)
public void transformGraphics(java.awt.geom.AffineTransform at)
public java.awt.Color getPixelColor(double x, double y)
public boolean isDisposed()
public void drawImage(java.awt.image.BufferedImage bi, int x, int y, boolean lowerLeft)