GTGE API

com.golden.gamedev.engine.graphics
Class AppletMode

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by java.applet.Applet
                  extended by com.golden.gamedev.engine.graphics.AppletMode
All Implemented Interfaces:
BaseGraphics, ImageObserver, MenuContainer, Serializable, Accessible
Direct Known Subclasses:
GameLoader

public class AppletMode
extends Applet
implements BaseGraphics

Graphics engine for Applet Environment.

See BaseGraphics for how to use graphics engine separated from Golden T Game Engine (GTGE) Frame Work.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.applet.Applet
Applet.AccessibleApplet
 
Nested classes/interfaces inherited from class java.awt.Panel
Panel.AccessibleAWTPanel
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static GraphicsConfiguration CONFIG
          The graphics configuration that constructs this graphics engine.
static GraphicsDevice DEVICE
          The graphics device that constructs this graphics engine.
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
AppletMode()
          Creates new instance of Applet Graphics Engine, please see note below.
 
Method Summary
 void cleanup()
          Releases any system graphics resources and do finalization.
 void destroy()
          Override Applet.destroy() to release any graphics resource by calling cleanup().
 boolean flip()
          Flips backbuffer to the screen (primary surface).
 Graphics2D getBackBuffer()
          Returns backbuffer where the rendering perform.
 Component getComponent()
          Returns the component where the rendering perform.
 String getGraphicsDescription()
          Returns graphics engine description, for example: fullscreen, windowed, applet, fullscreen with bufferstrategy, etc.
 Dimension getSize()
          Returns graphics engine dimension.
 Image getWindowIcon()
          Returns graphics engine window icon image or null if setting window icon image is not supported.
 String getWindowTitle()
          Returns graphics engine window title or String "" if setting window title is not supported.
 void setWindowIcon(Image icon)
          Sets graphics engine window icon image.
 void setWindowTitle(String st)
          Sets graphics engine window title.
 void start()
          Initializes this applet graphics engine, do not attempt to use any graphics function before this method is automatically called by the browser.
 
Methods inherited from class java.applet.Applet
getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, init, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, stop
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEVICE

public static final GraphicsDevice DEVICE
The graphics device that constructs this graphics engine.


CONFIG

public static final GraphicsConfiguration CONFIG
The graphics configuration that constructs this graphics engine.

Constructor Detail

AppletMode

public AppletMode()
Creates new instance of Applet Graphics Engine, please see note below.

Note:
Do not make any overloading constructors.
The engine is initialized in start() method, therefore do not use any graphics function before the start() method is being called by the browser.

See Also:
start()
Method Detail

start

public void start()
Initializes this applet graphics engine, do not attempt to use any graphics function before this method is automatically called by the browser.

Overrides:
start in class Applet

getBackBuffer

public Graphics2D getBackBuffer()
Description copied from interface: BaseGraphics
Returns backbuffer where the rendering perform.

Specified by:
getBackBuffer in interface BaseGraphics

flip

public boolean flip()
Description copied from interface: BaseGraphics
Flips backbuffer to the screen (primary surface). Since most graphics engine backbuffer is VolatileImage type, thus the flipping data could be lost and need to be restored. Therefore, if this method return false, backbuffer need to be rerendered.

For example:

    do {
        Graphics2D g = BaseGraphics.getBackBuffer();
        //.... do graphics operation
    } while (BaseGraphics.flip() == false);
 
See VolatileImage for detail information.

Specified by:
flip in interface BaseGraphics
Returns:
true, if the flipping is successfully proceed.
See Also:
BaseGraphics.getBackBuffer()

cleanup

public void cleanup()
Description copied from interface: BaseGraphics
Releases any system graphics resources and do finalization.

Specified by:
cleanup in interface BaseGraphics

destroy

public void destroy()
Override Applet.destroy() to release any graphics resource by calling cleanup().

Overrides:
destroy in class Applet

getSize

public Dimension getSize()
Description copied from interface: BaseGraphics
Returns graphics engine dimension.

Specified by:
getSize in interface BaseGraphics
Overrides:
getSize in class Component

getComponent

public Component getComponent()
Description copied from interface: BaseGraphics
Returns the component where the rendering perform.

Specified by:
getComponent in interface BaseGraphics

getGraphicsDescription

public String getGraphicsDescription()
Description copied from interface: BaseGraphics
Returns graphics engine description, for example: fullscreen, windowed, applet, fullscreen with bufferstrategy, etc.

Specified by:
getGraphicsDescription in interface BaseGraphics

setWindowTitle

public void setWindowTitle(String st)
Description copied from interface: BaseGraphics
Sets graphics engine window title.

Note: Not all graphics engine support for setting window title, for example applet graphics engine.

Specified by:
setWindowTitle in interface BaseGraphics

getWindowTitle

public String getWindowTitle()
Description copied from interface: BaseGraphics
Returns graphics engine window title or String "" if setting window title is not supported.

Specified by:
getWindowTitle in interface BaseGraphics

setWindowIcon

public void setWindowIcon(Image icon)
Description copied from interface: BaseGraphics
Sets graphics engine window icon image.

Note: Not all graphics engine support for setting window icon, for example applet graphics engine.

Specified by:
setWindowIcon in interface BaseGraphics
See Also:
ImageUtil.getImage(java.net.URL)

getWindowIcon

public Image getWindowIcon()
Description copied from interface: BaseGraphics
Returns graphics engine window icon image or null if setting window icon image is not supported.

Specified by:
getWindowIcon in interface BaseGraphics

GTGE API

Copyright © 2003-2005 Golden T Studios. All rights reserved. Use is subject to license terms.
GoldenStudios.or.id