psychWithJava
Class FullScreen

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by psychWithJava.FullScreen
All Implemented Interfaces:
java.awt.event.KeyListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
Direct Known Subclasses:
BitsPP, BitsPPFake

public class FullScreen
extends javax.swing.JFrame
implements java.awt.event.KeyListener

FullScreen class provides methods to display visual stimuli and interact with the observer in full screen exclusive mode (FSEM).

FullScreen is capable of chosing the best available mode and strategy on a particular software (OS) and hardware. By default user does not have to change any of these strategies. However it provides methods for expert users who wish to modify those strategies. Needs Java SE version 5.0 or higher.

Methods provided include: displayImage() to display images, displayText() to display text messages, and getKeyPressed() to get observer's keyboard responses. Because it is inherited from the Java core class JFrame, all its methods are also available, such as setForeground().

Some demos using the FullScreen class can be found here.

This implementation of this class is explained in great detail in The Guide to psychophysics programming with Java.

FullScreen class utilizes the Full screen exclusive mode (FSEM), a feature of Java (after J2SE 1.4) that allows programmers to suspend the windowing system of the underlying OS, and directly access the video card and draw on the screen. If exclusive full screen is not supported a regular window is positioned at (0,0) and resized to fit the whole screen to mimic full screen exclusive mode. Whether in full screen exclusive mode or not, FullScreen usues active rendering as opposed to passive rendering - in passive rendering the underlying OS may intervene and send directives to the rendering program, whereas in active rendering the program itself is responsible of drawing and re-drawing the contents on the screen without the OS's directives.

For more details, developers can see JSE API definitions at http://java.sun.com. See also Full-Screen Exclusive Mode API tutorial, Programmer's Guide to the Java 2D API, and Painting in AWT and Swing, and http://java.sun.com/j2se/1.5.0/docs/guide/2d/new_features.html.

Note: Java 2D API (and rest of the entire platform) is improved with JSE 5.0, and FullScreen needs at least version 5.0. This version is available on all platforms (Linux, Mac OS X (only Tiger), MS Windows).

Note: Real full screen exclusive mode is not supported on Linux in Java 5.0, but it simulates the exclusive mode. However this situation is fixed and the new version of Java (1.6 Mustang) has the exclusive mode for Linux. FSEM on Linux works fine now especially with opengl pipeline enabled. To enable opengl pipeline user must specify the following system property on the command line: -Dsun.java2d.opengl=True. See The Guide, "Chapter XXX: Fine tune your strategies to eliminate artifacts" (coming soon!).

Matlab and Mathematica development:
It is possible to create Java objects from within Matlab and Mathematica. You can, therefore, create a FullScreen object in Matlab or Mathematica and invoke its methods. In other words, if you choose, you could use this class as a tool for psychophysics programming much like the well known Psychtoolbox package.
Instructions on Matlab and Mathematica development can be found here.

Author:
Huseyin Boyaci
See Also:
NormalWindow, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
 
Fields inherited from class javax.swing.JFrame
EXIT_ON_CLOSE
 
Fields inherited from class java.awt.Frame
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
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
FullScreen()
          Constructs a FullScreen object on the default screen.
FullScreen(int displayID)
          Constructs a FullScreen object on the screen designated with displayID.
 
Method Summary
 void blankScreen()
          Blanks the whole screen using the current background color.
 void closeScreen()
          Closes the full screen exclusive mode screen.
 void displayImage(java.awt.image.BufferedImage bi)
          Displays a BufferedImage at the center of the screen.
 void displayImage(int x, int y, java.awt.image.BufferedImage bi)
          Displays a BufferedImage at the specified position.
 void displayText(int x, int y, java.lang.String text)
          Displays text at the specified position.
 void displayText(java.lang.String text)
          Displays text at the center of the screen.
 void flushKeyPressed()
          Clears both key pressed and when key pressed queues.
 void flushKeyReleased()
          Clears both key released and when key released queues.
 void flushKeyTyped()
          Clears both keyTyped and whenKeyTyped queues.
 java.awt.Color getBackground()
          Returns the current background color.
 java.awt.DisplayMode getDisplayMode()
          Returns the current DisplayMode.
 java.awt.DisplayMode[] getDisplayModes()
          Returns all available DisplayModes on client's system.
 java.lang.Integer getKeyPressed()
          Returns the key pressed by the observer.
 java.lang.Integer getKeyPressed(long ms)
          Returns the key pressed by the observer.
 java.lang.Integer getKeyReleased()
          Returns the key released by the observer.
 java.lang.Integer getKeyReleased(long ms)
          Returns the key released by the observer.
 java.lang.String getKeyTyped()
          Returns the key typed by the observer.
 java.lang.String getKeyTyped(long ms)
          Returns the key typed by the observer.
 int getNBuffers()
          Returns number of video buffers (including the front (visible) one) used by this FullScreen object.
 java.lang.Long getWhenKeyPressed()
          Returns the time of the key pressed event.
 java.lang.Long getWhenKeyReleased()
          Returns the time of the key released event.
 java.lang.Long getWhenKeyTyped()
          Returns the time of the key typed event.
 void hideCursor()
          Renders the cursor invisible.
 boolean isDisplayChangeSupported()
          Returns whether or not DisplayMode change is available on client's system.
 boolean isDisplayModeAvailable(java.awt.DisplayMode dm)
          Returns whether or not given DisplayMode is applicable to client's screen.
 boolean isFullScreenSupported()
          Returns whether or not Full Screen Exclusive Mode (FSEM) is supported on client's system.
 void keyPressed(java.awt.event.KeyEvent ke)
           
 void keyReleased(java.awt.event.KeyEvent ke)
           
 void keyTyped(java.awt.event.KeyEvent ke)
           
 java.lang.String reportDisplayMode()
          Returns the current screen resolution, vertical synchronization rate and color depth in a readable form.
 java.lang.String[] reportDisplayModes()
          Reports all available DisplayMode parameters in a readable format.
 void setBackground(java.awt.Color bg)
          Sets the background color.
 void setDisplayMode(java.awt.DisplayMode dm)
          Sets a new DisplayMode: secreen resolution, vertical synchronization rate, and color depth.
 void setNBuffers(int n)
          Sets number of video buffers (including the front (visible) one).
 void showCursor()
          Renders the cursor visible using default cursor
 void updateScreen()
          Updates the entire screen by bringing the back video buffer front (if there exists a back buffer, if not it has no effect).
 
Methods inherited from class javax.swing.JFrame
getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setTransferHandler, update
 
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, show, toBack, toFront
 
Methods inherited from class java.awt.Container
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, paint, paintComponents, preferredSize, print, printComponents, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
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, getGraphics, 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, isOpaque, 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, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Constructor Detail

FullScreen

public FullScreen(int displayID)
Constructs a FullScreen object on the screen designated with displayID. By default it uses a single video buffer and the current display mode of the client's OS. Once it is constructed, FullScreen captures the entire screen immediately. At the end user's program must terminate this mode and go back to system's default display. To do this use the method closeScreen().

Parameters:
displayID - a numerical id indicating the screen device
See Also:
setDisplayMode(DisplayMode), setNBuffers(int), closeScreen()

FullScreen

public FullScreen()
Constructs a FullScreen object on the default screen. By default it uses a single video buffer and the current display mode. Once it is constructed, FullScreen captures the entire screen immediately. At the end user's program must terminate this mode and go back to system's default display. To do this use the method closeScreen().

See Also:
setDisplayMode(DisplayMode), setNBuffers(int), closeScreen()
Method Detail

keyTyped

public void keyTyped(java.awt.event.KeyEvent ke)
Specified by:
keyTyped in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent ke)
Specified by:
keyReleased in interface java.awt.event.KeyListener

keyPressed

public void keyPressed(java.awt.event.KeyEvent ke)
Specified by:
keyPressed in interface java.awt.event.KeyListener

setNBuffers

public void setNBuffers(int n)
Sets number of video buffers (including the front (visible) one). If the number is 1, it implies no back buffer. 2 implies one front one back buffer.

Parameters:
n - number of buffers requested; must not be less than 1
See Also:
getNBuffers()

getNBuffers

public int getNBuffers()
Returns number of video buffers (including the front (visible) one) used by this FullScreen object.

Returns:
number of video buffers used by this FullScreen object
See Also:
setNBuffers(int)

updateScreen

public void updateScreen()
Updates the entire screen by bringing the back video buffer front (if there exists a back buffer, if not it has no effect). The methods in FullScreen class (displayImage(), displayText() or blankScreen(), see below) always manipulate the video bufer, not necessarily the screen. In case there is a back video buffer those methods affect only the back (invisible) buffer. Upon invoking those methods user has to invoke this updateScreen() method to actually bring the back buffer to front, in other words to make it actually visible on the screen device.

See Also:
displayImage(int, int, BufferedImage), displayText(int, int, String), blankScreen()

displayImage

public void displayImage(java.awt.image.BufferedImage bi)
Displays a BufferedImage at the center of the screen. Note that, in case there is a back video buffer this method draws the image on the back buffer. In that case user has to invoke the updateScreen() method to actually display the image on the screen.

Parameters:
bi - BufferedImage to display
See Also:
displayImage(int, int, BufferedImage), updateScreen()

displayImage

public void displayImage(int x,
                         int y,
                         java.awt.image.BufferedImage bi)
Displays a BufferedImage at the specified position. Note that, in case there is a back video buffer this method draws the image on the back buffer. In that case user has to invoke the updateScreen() method to actually display the image on the screen.

Parameters:
x - horizontal offset of the upper left corner of the image from the upper left corner of the screen
y - vertical offset of the upper left corner of the image from the upper left corner of the screen
bi - BufferedImage to display
See Also:
displayImage(BufferedImage), updateScreen()

displayText

public void displayText(java.lang.String text)
Displays text at the center of the screen. Note that, in case there is a back video buffer this method draws the text on the back buffer. In that case user has to invoke the updateScreen() method to actually display the text on the screen.

Parameters:
text - a text message to display
See Also:
displayText(int, int, String), updateScreen()

displayText

public void displayText(int x,
                        int y,
                        java.lang.String text)
Displays text at the specified position. Note that, in case there is a back video buffer this method draws the text on the back buffer. In that case user has to invoke the updateScreen() method to actually display the text on the screen.

Parameters:
x - horizontal offset of the upper left corner of the text from the upper left corner of the screen
y - vertical offset of the upper left corner of the text from the upper left corner of the screen
text - a text message to display
See Also:
displayText(String), updateScreen()

blankScreen

public void blankScreen()
Blanks the whole screen using the current background color. Note that, in case there is a back video buffer this method blanks the back buffer. In that case user has to invoke the updateScreen() method to actually blank the screen.

See Also:
updateScreen()

getBackground

public java.awt.Color getBackground()
Returns the current background color.

Overrides:
getBackground in class java.awt.Component
Returns:
current background color
See Also:
setBackground(Color)

setBackground

public void setBackground(java.awt.Color bg)
Sets the background color.

Overrides:
setBackground in class java.awt.Component
Parameters:
bg - new background color
See Also:
getBackground()

hideCursor

public void hideCursor()
Renders the cursor invisible.

See Also:
showCursor()

showCursor

public void showCursor()
Renders the cursor visible using default cursor

See Also:
hideCursor()

closeScreen

public void closeScreen()
Closes the full screen exclusive mode screen. This method performs also the following additional steps: It switches the resolution back to system setting, releases all the screen resources to the operating system. User must invoke this method to re-gain access to normal desktop.

See Also:
FullScreen(int), FullScreen()

getKeyTyped

public java.lang.String getKeyTyped(long ms)
Returns the key typed by the observer.

If the specified wait time is positive: This method either (i) returns the top element in the keyTyped queue immediately if there is at least one element in the keyTyped event queue or (ii) waits up to the specified amount of time for an element to become available. If no key is typed within the specified amount of time it returns null.

If the specified time is zero: Returns the top element in the keyTyped event queue or null if queue is empty.

If the specified wait time is negative: This method either returns the top element in the queue or if the queue is empty it waits indefinetely untill the observer types a character.

In all cases, the element returned is removed from the event queue.

General principles of event handling in FullScreen: FullScreen captures the key events in a seperate Thread and stores them in Thread safe BlockingQueue objects. Anytime observer types, presses or releases a key, that key and the time of the event are inserted to the end (tail) of the respective queues. When one of the getKeyTyped(), getKeyPressed() or getKeyReleased() methods is invoked, the top (head) of the respective queue is retrived and removed. Similarly, getWhenKeyTyped(), getWhenKeyPressed() and getWhenKeyReleased() methods retrive and remove the head in event time queues. flushKeyTyped(), flushKeyPressed() and flushKeyReleased() methods clear all queues, including the event time queues.

For more information see Chapter 6: Getting observer response of the Guide to Psychophysics programming with Java.

Parameters:
ms - time in milliseconds to wait for a response
Returns:
the key typed
See Also:
getKeyTyped(), flushKeyTyped(), getWhenKeyTyped()

getKeyTyped

public java.lang.String getKeyTyped()
Returns the key typed by the observer. Returns the top element in keyTyped queue or null if queue is empty. Equivelent to invoking getKeyTyped(0).

The element returned is removed from the event queue. See also general principles of event handling in FullScreen above.

For more information see Chapter 6: Getting observer response of the Guide to Psychophysics programming with Java.

Returns:
the key typed
See Also:
getKeyTyped(long), flushKeyTyped(), getWhenKeyTyped()

getWhenKeyTyped

public java.lang.Long getWhenKeyTyped()
Returns the time of the key typed event. Returns the top element in the whenKeyTyped queue, null if queue is empty.

The element returned is removed from the event queue. See also general principles of event handling in FullScreen above.

For more information see Chapter 6: Getting observer response of the Guide to Psychophysics programming with Java.

Returns:
the time of key typed event
See Also:
getKeyTyped(long), flushKeyTyped()

flushKeyTyped

public void flushKeyTyped()
Clears both keyTyped and whenKeyTyped queues. See also general principles of event handling in FullScreen above.

For more information see Chapter 6: Getting observer response of the Guide to Psychophysics programming with Java.

See Also:
getKeyTyped(long), getWhenKeyTyped()

getKeyPressed

public java.lang.Integer getKeyPressed(long ms)
Returns the key pressed by the observer.

If the specified wait time is positive: This method either (i) returns the top element in the keyPressed queue immediately if there is at least one element in the keyPressed event queue or (ii) waits up to the specified amount of time for an element to become available. If no key is pressed within the specified amount of time it returns null.

If the specified time is zero: Returns the top element in the keyPressed event queue or null if queue is empty.

If the specified wait time is negative: This method either returns the top element in the queue or if the queue is empty it waits indefinetely untill the observer presses a key.

In all cases, the element returned is removed from the event queue. See also general principles of event handling in FullScreen above.

For more information see Chapter 6: Getting observer response of the Guide to Psychophysics programming with Java.

Parameters:
ms - time in milliseconds to wait for a response
Returns:
numeric code of the key pressed
See Also:
getKeyPressed(), flushKeyPressed(), getWhenKeyPressed()

getKeyPressed

public java.lang.Integer getKeyPressed()
Returns the key pressed by the observer. Returns the top element in keyPressed queue or null if queue is empty. Equivelent to invoking getKeyPressed(0).

The element returned is removed from the event queue. See also general principles of event handling in FullScreen above.

For more information see Chapter 6: Getting observer response of the Guide to Psychophysics programming with Java.

Returns:
numeric code of the key pressed
See Also:
getKeyPressed(long), flushKeyPressed(), getWhenKeyPressed()

getWhenKeyPressed

public java.lang.Long getWhenKeyPressed()
Returns the time of the key pressed event. Returns the top element in the whenKeyPressed queue, null if queue is empty.

The element returned is removed from the event queue. See also general principles of event handling in FullScreen above.

For more information see Chapter 6: Getting observer response of the Guide to Psychophysics programming with Java.

Returns:
the time of key pressed event
See Also:
getKeyPressed(long), flushKeyPressed()

flushKeyPressed

public void flushKeyPressed()
Clears both key pressed and when key pressed queues. See also general principles of event handling in FullScreen above.

For more information see Chapter 6: Getting observer response of the Guide to Psychophysics programming with Java.

See Also:
getKeyPressed(long), getWhenKeyPressed()

getKeyReleased

public java.lang.Integer getKeyReleased(long ms)
Returns the key released by the observer.

If the specified wait time is positive: This method either (i) returns the top element in the keyReleased queue immediately if there is at least one element in the keyReleased event queue or (ii) waits up to the specified amount of time for an element to become available. If no key is released within the specified amount of time it returns null.

If the specified time is zero: Returns the top element in the keyReleased event queue or null if queue is empty.

If the specified wait time is negative: This method either returns the top element in the queue or if the queue is empty it waits indefinetely untill the observer releases a key.

In all cases, the element returned is removed from the event queue. See also general principles of event handling in FullScreen above.

For more information see Chapter 6: Getting observer response of the Guide to Psychophysics programming with Java.

Parameters:
ms - time in milliseconds to wait for a response
Returns:
numerical code of the key released
See Also:
getKeyReleased(), flushKeyReleased(), getWhenKeyReleased()

getKeyReleased

public java.lang.Integer getKeyReleased()
Returns the key released by the observer. Returns the top element in keyReleased queue or null if queue is empty. Equivelent to invoking getKeyReleased(0).

The element returned is removed from the event queue. See also general principles of event handling in FullScreen above.

For more information see Chapter 6: Getting observer response of the Guide to Psychophysics programming with Java.

Returns:
numerical code of the key released
See Also:
getKeyReleased(long), flushKeyReleased(), getWhenKeyReleased()

getWhenKeyReleased

public java.lang.Long getWhenKeyReleased()
Returns the time of the key released event. Returns the top element in the whenKeyReleased queue, null if queue is empty.

The element returned is removed from the event queue. See also general principles of event handling in FullScreen above.

For more information see Chapter 6: Getting observer response of the Guide to Psychophysics programming with Java.

Returns:
the time of key released event
See Also:
getKeyReleased(long), flushKeyReleased()

flushKeyReleased

public void flushKeyReleased()
Clears both key released and when key released queues. See also general principles of event handling in FullScreen above.

For more information see Chapter 6: Getting observer response of the Guide to Psychophysics programming with Java.

See Also:
getKeyReleased(long), getWhenKeyReleased()

isFullScreenSupported

public boolean isFullScreenSupported()
Returns whether or not Full Screen Exclusive Mode (FSEM) is supported on client's system.


setDisplayMode

public void setDisplayMode(java.awt.DisplayMode dm)
Sets a new DisplayMode: secreen resolution, vertical synchronization rate, and color depth. If the requested DisplayMode is not applicable or DisplayMode change is not supported it causes the termination of the user's program, in order to avoid an erronous experimental session.

Parameters:
dm - new display mode to apply
See Also:
isDisplayChangeSupported(), isDisplayModeAvailable(DisplayMode)

isDisplayModeAvailable

public boolean isDisplayModeAvailable(java.awt.DisplayMode dm)
Returns whether or not given DisplayMode is applicable to client's screen.

Parameters:
dm - DisplayMode to check
Returns:
whether dm is applicable or not

reportDisplayMode

public java.lang.String reportDisplayMode()
Returns the current screen resolution, vertical synchronization rate and color depth in a readable form.

Returns:
current DisplayMode in readable form

getDisplayMode

public java.awt.DisplayMode getDisplayMode()
Returns the current DisplayMode.

Returns:
current DisplayMode

isDisplayChangeSupported

public boolean isDisplayChangeSupported()
Returns whether or not DisplayMode change is available on client's system.

Returns:
whether DisplayMode change is available

reportDisplayModes

public java.lang.String[] reportDisplayModes()
Reports all available DisplayMode parameters in a readable format.

Returns:
all available DisplayMode parameters.

getDisplayModes

public java.awt.DisplayMode[] getDisplayModes()
Returns all available DisplayModes on client's system.

Returns:
all available DisplayModes.