public final class Application extends JApplet implements AppletStub, XdevApplicationContainer
Desktop and webstart applications are started via the main(String[])
method, applets per default via init()
and start()
.
The user application on top of the framework is started afterwards. This is because runtime environment specific init routines of the framwork are performed in this class.
The system or program parameter 'main' is used to define the user application's main class. Ensure that this main class is in a package, not in the default package.
Desktop application:
java [vm args] -Dmain=myapp.Start xdev.Application [application args]
Applet:
<applet code="xdev.Application.class">
<param name="main" value="myapp.Start" />
<param...
</applet>
Webstart:
<jnlp...
...
<resources>
<property name="application.type" value="webstart" />
<property name="main" value="start.Main" />
<property...
</resources>
...
<application-desc main-class="xdev.Application">
<argument...
</application-desc>
...
</jnlp>
main(String[])
,
initApplication(String[])
,
startApplication()
,
isApplet()
,
isApplication()
,
isWebstart()
,
Serialized FormModifier and Type | Class and Description |
---|---|
static class |
Application.State |
JApplet.AccessibleJApplet
Applet.AccessibleApplet
Panel.AccessibleAWTPanel
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
XdevRootPaneContainer.Util
Modifier and Type | Field and Description |
---|---|
static int |
APPLET
Application type constant.
|
static int |
APPLICATION
Application type constant.
|
static int |
WEBSTART
Application type constant.
|
accessibleContext, rootPane, rootPaneCheckingEnabled
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, NORMAL
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
Application() |
Modifier and Type | Method and Description |
---|---|
static void |
addExitListener(ApplicationExitListener l)
Registers an
ApplicationExitListener to obsorve the exit of this
Application . |
void |
addWindowListener(WindowListener listener)
Implemented with no action for
XdevApplicationContainer . |
void |
appletResize(int width,
int height) |
void |
close()
Closes this container and releases all used resources.
|
void |
destroy() |
static void |
exit(Object source)
Exits the current running XDEV Application Framwork and Java Virtual
Machine.
|
static void |
gc()
Runs the garbage collector.
|
static String[] |
getArguments()
Return the arguments handed over to the application in
main(String[]) . |
static XdevApplicationContainer |
getContainer()
Returns the applications top level container.
|
int |
getExtendedState()
Implemented with no action for
XdevApplicationContainer . |
static Extension |
getExtension(String name)
Returns the extension named
name or null if not
found. |
static Extension[] |
getExtensions()
Returns all available extensions.
|
static Image |
getIconImage() |
Image |
getImage(URL url)
Returns an
Image object that can then be painted on the
screen. |
static GraphicsConfiguration |
getLocalGraphicsConfiguration()
Returns the default
GraphicsConfiguration associated with the
GraphicsDevice this application is showing on. |
static XdevLogger |
getLogger()
Returns the
XdevLogger of this Application which is used to log
messages for the XDEV Application Framework. |
static String |
getParam(String name)
Returns the value of the named parameter in the HTML tag.
|
static XdevDate |
getServerTime()
Returns the time of the hosting server of this applet / webstart
application.
|
static Application.State |
getState() |
static int |
getType() |
Window |
getWindow()
Returns the
Window of this XdevRootPaneContainer . |
XdevWindow |
getXdevWindow()
Returns the internal
XdevWindow of this
XdevRootPaneContainer . |
void |
init() |
static void |
initApplication(String[] args)
Initializes the XDEV Application Framework.
|
static boolean |
isApplet() |
static boolean |
isApplication() |
static boolean |
isWebstart() |
static void |
main(String[] args)
This is the entry point of the XDEV Application Framwork for desktop and
webstart appications.
|
void |
pack()
Implemented with no action for
XdevApplicationContainer . |
static void |
removeExitListener(ApplicationExitListener l)
|
void |
removeWindowListener(WindowListener listener)
Implemented with no action for
XdevApplicationContainer . |
void |
setExtendedState(int extendedState)
Implemented with no action for
XdevApplicationContainer . |
void |
setIconImage(Image img)
Implemented with no action for
XdevApplicationContainer . |
void |
setLocationRelativeTo(Component c)
Implemented with no action for
XdevApplicationContainer . |
void |
setResizable(boolean b)
Implemented with no action for
XdevApplicationContainer . |
void |
setTitle(String title)
Sets the title of this
XdevRootPaneContainer . |
void |
setXdevWindow(XdevWindow window)
Sets the content of this
XdevRootPaneContainer . |
void |
showDocument(URL url)
Requests that the application container shows the Web page indicated by
the
url argument. |
void |
showDocument(URL url,
String target)
Requests that the application container shows the Web page indicated by
the
url argument. |
void |
start() |
static void |
startApplication()
Starts the application after the XDEV application framwork has been
initialized.
|
void |
toBack()
Implemented with no action for
XdevApplicationContainer . |
void |
toFront()
Implemented with no action for
XdevApplicationContainer . |
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isRootPaneCheckingEnabled, paramString, remove, repaint, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getLocale, getParameter, getParameterInfo, isActive, isValidateRoot, newAudioClip, play, play, resize, resize, setStub, showStatus, stop
add, add, add, add, add, addContainerListener, 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, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
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, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, 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, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, revalidate, 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, transferFocusBackward, transferFocusUpCycle
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getAppletContext, getCodeBase, getDocumentBase, getParameter, isActive
getCodeBase, getFontMetrics, getGraphics, getGraphicsConfiguration, getToolkit
getBounds, getLocation, getSize, setBounds, setLocation, setVisible
getContentPane, getGlassPane, getLayeredPane, getRootPane, setContentPane, setGlassPane, setLayeredPane
public static final int APPLICATION
public static final int APPLET
public static final int WEBSTART
public static int getType()
APPLICATION
,
APPLET
or WEBSTART
public static boolean isApplication()
true
if this is a desktop application started via
main(String[])
, false
otherwisepublic static boolean isApplet()
true
if this is a applet running in a browser or
another applet container, false
otherwisepublic static boolean isWebstart()
true
if this is a webstart application started via a
webstart descriptor, false
otherwisepublic static Extension getExtension(String name)
name
or null
if not
found.
Note: The extensions are only available after init()
has been
called.
name
- the extension's namenull
public static Extension[] getExtensions()
Note: The extensions are only available after init()
has been
called.
public static void main(String[] args)
It initializes the framework and starts the application based on the framework.
First initApplication(String[])
is called, then
startApplication()
.
Hint: Can be used to start XdevWindow
s.
Therefore set the VM Argument
-Dmain=FULL_QUALIFIED_CLASSNAME
. Where
FULL_QUALIFIED_CLASSNAME
is the full qualified classname
like xdev.ui.MyClass.
args
- The application's argumentspublic static void initApplication(String[] args)
args
fullscreen
is
true
or an applet
This method is called by main(String[])
.
If you want to start your application without using
main(String[])
of this class, call
initApplication(String[])
at the beginning of your application
to initialize the XDEV Application Framwork properly.
args
- The application's argumentspublic static void startApplication() throws IllegalStateException
This method is called by main(String[])
after
initApplication(String[])
.
The system property main is used to determine the main class.
initApplication(String[])
.XdevWindow
it is initialized
via the default constructor and shown in the application's top level
container.JComponent
it is initialized
via the default constructor, placed in a XdevWindow
and shown in
the application's top level container.IllegalStateException
- if the framework has not been initialized via
initApplication(String[])
main(String[])
,
initApplication(String[])
public static String[] getArguments() throws IllegalStateException
main(String[])
.IllegalStateException
- if this Application
is an Applet
getType()
public static String getParam(String name) throws IllegalStateException
then a call to getParameter("Color") returns the value "blue".
The name argument is case insensitive.
name
- a parameter name.IllegalStateException
- if this Application
is not an Applet
getType()
public static Image getIconImage()
public static XdevApplicationContainer getContainer()
It is either a frame, a fullscreen window or an applet.
public static Application.State getState()
public static void addExitListener(ApplicationExitListener l)
ApplicationExitListener
to obsorve the exit of this
Application
.l
- the listener to addpublic static void removeExitListener(ApplicationExitListener l)
l
- the listener to removepublic static void exit(Object source)
If a registered ApplicationExitListener
vetos the process, the
exit is terminated and the XDEV Application Framework remains running.
source
- The initiator of the exit processApplicationExitListener
,
ApplicationExitEvent.vetoExit()
public static XdevDate getServerTime()
public static void gc()
Calling the gc method suggests that the Java Virtual Machine expend effort toward recycling unused objects in order to make the memory they currently occupy available for quick reuse. When control returns from the method call, the Java Virtual Machine has made a best effort to reclaim space from all discarded objects.
public static GraphicsConfiguration getLocalGraphicsConfiguration()
GraphicsConfiguration
associated with the
GraphicsDevice
this application is showing on.GraphicsConfiguration
of this
GraphicsDevice
.public Window getWindow()
Window
of this XdevRootPaneContainer
.getWindow
in interface XdevRootPaneContainer
Window
of this XdevRootPaneContainer
public Image getImage(URL url)
Image
object that can then be painted on the
screen. The url
that is passed as an argument must specify
an absolute URL.
This method always returns immediately, whether or not the image exists. When this XdevApplicationContainer attempts to draw the image on the screen, the data will be loaded. The graphics primitives that draw the image will incrementally paint on the screen.
getImage
in interface XdevApplicationContainer
getImage
in class Applet
url
- an absolute URL giving the location of the image.Image
public void showDocument(URL url)
url
argument. The browser or applet viewer determines
which window or frame to display the Web page.showDocument
in interface XdevApplicationContainer
url
- an absolute URL giving the location of the document.public void showDocument(URL url, String target)
url
argument. The target
argument indicates
in which HTML frame the document is to be displayed. The target argument
is interpreted as follows:
Target Argument | Description |
---|---|
"_self"
| Show in the window and frame that contain the applet. |
"_parent"
| Show in the applet's parent frame. If the applet's frame has no parent frame, acts the same as "_self". |
"_top"
| Show in the top-level frame of the applet's window. If the applet's frame is the top-level frame, acts the same as "_self". |
"_blank"
| Show in a new, unnamed top-level window. |
name | Show in the frame or window named name. If a target named name does not already exist, a new top-level window with the specified name is created, and the document is shown there. |
An applet viewer or browser is free to ignore this method.
showDocument
in interface XdevApplicationContainer
url
- an absolute URL giving the location of the document.target
- a String
indicating where to display the page.public void appletResize(int width, int height)
appletResize
in interface AppletStub
public void setXdevWindow(XdevWindow window)
XdevRootPaneContainer
.setXdevWindow
in interface XdevRootPaneContainer
window
- the XdevWindow
for this XdevRootPaneContainer
public XdevWindow getXdevWindow()
XdevWindow
of this
XdevRootPaneContainer
.getXdevWindow
in interface XdevRootPaneContainer
XdevWindow
public void setTitle(String title)
XdevRootPaneContainer
.setTitle
in interface XdevRootPaneContainer
title
- the title to be displayedpublic void setIconImage(Image img)
XdevApplicationContainer
.setIconImage
in interface XdevApplicationContainer
img
- the image to be displayedpublic void pack()
XdevApplicationContainer
.pack
in interface XdevRootPaneContainer
Component.isDisplayable()
public void setLocationRelativeTo(Component c)
XdevApplicationContainer
.setLocationRelativeTo
in interface XdevRootPaneContainer
c
- the component in relation to which the
XdevRootPaneContainer
location is determinedpublic void setResizable(boolean b)
XdevApplicationContainer
.setResizable
in interface XdevRootPaneContainer
b
- true
if the user can resize this
XdevRootPaneContainer
; false
otherwise.public void setExtendedState(int extendedState)
XdevApplicationContainer
.setExtendedState
in interface XdevRootPaneContainer
extendedState
- a bitwise mask of frame state constantsXdevRootPaneContainer.getExtendedState()
,
Toolkit.isFrameStateSupported(int)
public int getExtendedState()
XdevApplicationContainer
.getExtendedState
in interface XdevRootPaneContainer
XdevRootPaneContainer.setExtendedState(int)
public void toFront()
XdevApplicationContainer
.toFront
in interface XdevRootPaneContainer
XdevRootPaneContainer.toBack()
public void toBack()
XdevApplicationContainer
.toBack
in interface XdevRootPaneContainer
XdevRootPaneContainer.toFront()
public void addWindowListener(WindowListener listener)
XdevApplicationContainer
.addWindowListener
in interface XdevRootPaneContainer
listener
- the window listenerpublic void removeWindowListener(WindowListener listener)
XdevApplicationContainer
.removeWindowListener
in interface XdevRootPaneContainer
listener
- the window listenerpublic void close()
close
in interface XdevRootPaneContainer
public static XdevLogger getLogger()
XdevLogger
of this Application which is used to log
messages for the XDEV Application Framework.
Hint: Consider using local loggers instead of using one application global logger. With local loggers you benefit from many advantages i.e. name based filtering and message routing.
XdevLogger
of this Application.Copyright © 2003–2022 XDEV Software. All rights reserved.