Package codedraw
Class FullScreen
java.lang.Object
codedraw.Image
codedraw.FullScreen
- All Implemented Interfaces:
AutoCloseable
The Fullscreen class lets you create fullscreen application and draw on it.
It works very similarly to the
CodeDraw class.
The fullscreen window can be closed by pressing Alt + F4.-
Constructor Summary
ConstructorsConstructorDescriptionCreates a full screen CodeDraw window on your default screen.FullScreen(Screen screen) Creates a full screen CodeDraw window on the specified screen. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidThis method is called each time right after a shape is drawn.voidclose()Closes the window and disposes all resources associated with this instance.voidclose(boolean terminateProcess) Closes the window and disposes all resources associated with this instance.Defines the style of the cursor while hovering over the CodeDraw canvas.Gets the EventScanner of this CodeDraw window.Gets the screen the full screen window is currently displayed on.getTitle()The title is the description displayed in many places on your operating system.intGets the distance in pixel from the top left corner of the default screen to the top left corner of the fullscreen window.intGets the distance in pixel from the top left corner of the default screen to the top left corner of the fullscreen window.booleanAlways on top defines whether this window is placed on top of all other windows.booleanisClosed()Checks whether this CodeDraw window is already closed.booleanWhen InstantDraw is enabled CodeDraw will immediately draw all shapes to the canvas without callingshow().static voidRuns theAnimationinterface using a fullscreen window.static voidRuns theAnimationinterface using a fullscreen window.static voidRuns theAnimationinterface using a fullscreen window.static voidRuns theAnimationinterface using a fullscreen window.voidsetCursorStyle(CursorStyle cursorStyle) Defines the style of the cursor while hovering over the CodeDraw canvas.voidsetInstantDraw(boolean isInstantDraw) When InstantDraw is enabled CodeDraw will immediately draw all shapes to the canvas without callingshow().voidsetIsAlwaysOnTop(boolean isAlwaysOnTop) When set to true this CodeDraw window will always be displayed on top of other windows.voidThe title is the description displayed in many places on your operating system.voidshow()Displays all the shapes and images that were drawn onto the canvas.voidshow(long waitMilliseconds) Displays all the shapes and images that were drawn onto the canvas and waits for the given amount of milliseconds.toString()Methods inherited from class codedraw.Image
beforeDrawing, clear, clear, copyTo, crop, drawArc, drawArc, drawBezier, drawCircle, drawCurve, drawEllipse, drawImage, drawImage, drawImage, drawLine, drawOver, drawPathStartingAt, drawPie, drawPie, drawPoint, drawPolygon, drawRectangle, drawSquare, drawText, drawTriangle, fillCircle, fillEllipse, fillPathStartingAt, fillPie, fillPie, fillPolygon, fillRectangle, fillSquare, fillTriangle, fromBase64String, fromDPIAwareSize, fromFile, fromResource, fromUrl, getColor, getCorner, getCornerRadius, getHeight, getLineWidth, getPixel, getTextFormat, getTransformation, getWidth, isAntiAliased, mirrorHorizontally, mirrorVertically, resetProperties, rotateClockwise, rotateCounterClockwise, save, scale, scale, setAntiAliased, setColor, setCorner, setCornerRadius, setDrawOver, setLineWidth, setPixel, setTextFormat, setTransformation, setTransformationToIdentity, toBufferedImage, toBufferedImage
-
Constructor Details
-
FullScreen
public FullScreen()Creates a full screen CodeDraw window on your default screen. The fullscreen window can be closed by pressing Alt + F4. -
FullScreen
Creates a full screen CodeDraw window on the specified screen. You can pick any screen fromScreen.getAllScreens(). The fullscreen window can be closed by pressing Alt + F4.- Parameters:
screen- A screen on your computer.
-
-
Method Details
-
run
Runs theAnimationinterface using a fullscreen window. This function returns when the fullscreen window is closed by the user. The fullscreen animation will appear on the default screen running at 60 frames per second and 60 simulation per second.- Parameters:
animation- any class implementing the animation interface.
-
run
Runs theAnimationinterface using a fullscreen window. This function returns when the fullscreen window is closed by the user. The animation will run at 60 frames per second and 60 simulations per second.- Parameters:
animation- any class implementing the animation interface.screen- the screen which the animation should be displayed on.
-
run
Runs theAnimationinterface using a fullscreen window. This function returns when the fullscreen window is closed by the user. The animation will run at 60 simulations per second.- Parameters:
animation- any class implementing the animation interface.screen- the screen which the animation should be displayed on.framesPerSecond- the rate at which theAnimation.draw(Image)method should be called.
-
run
public static void run(Animation animation, Screen screen, int framesPerSecond, int simulationsPerSecond) Runs theAnimationinterface using a fullscreen window. This function returns when the fullscreen window is closed by the user.- Parameters:
animation- any class implementing the animation interface.screen- the screen which the animation should be displayed on.framesPerSecond- the rate at which theAnimation.draw(Image)method should be called.simulationsPerSecond- the rate at which theAnimation.simulate()method should be called.
-
getScreen
Gets the screen the full screen window is currently displayed on.- Returns:
- A screen.
-
getEventScanner
Gets the EventScanner of this CodeDraw window. See theEventScannerfor more details on how to use it.- Returns:
- an EventScanner.
-
isInstantDraw
public boolean isInstantDraw()When InstantDraw is enabled CodeDraw will immediately draw all shapes to the canvas without callingshow(). When InstantDraw is disabled CodeDraw will only draw shapes to the window onceshow()is called. InstantDraw is disabled per default.- Returns:
- whether InstantDraw is enabled.
-
setInstantDraw
public void setInstantDraw(boolean isInstantDraw) When InstantDraw is enabled CodeDraw will immediately draw all shapes to the canvas without callingshow(). When InstantDraw is disabled CodeDraw will only draw shapes to the window onceshow()is called. InstantDraw is disabled per default.- Parameters:
isInstantDraw- defines whether InstantDraw is enabled.
-
isAlwaysOnTop
public boolean isAlwaysOnTop()Always on top defines whether this window is placed on top of all other windows.- Returns:
- whether the CodeDraw window is always displayed on top of other windows.
-
setIsAlwaysOnTop
public void setIsAlwaysOnTop(boolean isAlwaysOnTop) When set to true this CodeDraw window will always be displayed on top of other windows. When set to false this CodeDraw window will disappear behind other windows when CodeDraw loses focus.- Parameters:
isAlwaysOnTop- defines whether this CodeDraw window is displayed on top of other windows.
-
getWindowPositionX
public int getWindowPositionX()Gets the distance in pixel from the top left corner of the default screen to the top left corner of the fullscreen window. The fullscreen window position cannot be changed.- Returns:
- The distance in pixel from the left side of the default screen to the left of the fullscreen window.
-
getWindowPositionY
public int getWindowPositionY()Gets the distance in pixel from the top left corner of the default screen to the top left corner of the fullscreen window. The fullscreen window position cannot be changed.- Returns:
- The distance in pixel from the top side of the default screen to the top of the fullscreen window.
-
getTitle
The title is the description displayed in many places on your operating system.- Returns:
- the text of the title.
-
setTitle
The title is the description displayed in many places on your operating system.- Parameters:
title- Sets the text of the title.
-
getCursorStyle
Defines the style of the cursor while hovering over the CodeDraw canvas. See alsoCursorStyle.- Returns:
- the cursor style of this CodeDraw canvas.
-
setCursorStyle
Defines the style of the cursor while hovering over the CodeDraw canvas. See alsoCursorStyle.- Parameters:
cursorStyle- Sets the cursor style of this CodeDraw canvas.
-
show
public void show()Displays all the shapes and images that were drawn onto the canvas. Since showing the drawn elements in the CodeDraw window is slow, calling this method frequently will slow down your program. -
show
public void show(long waitMilliseconds) Displays all the shapes and images that were drawn onto the canvas and waits for the given amount of milliseconds. Since showing the drawn elements in the CodeDraw window is slow, calling this method frequently will slow down your program. This method might take longer to return from show if you specify only a small amount of milliseconds. The amount of milliseconds this method must be called with to display a certain amount of frames per second:
30 fps ~ 33ms
60 fps ~ 16ms
120 fps ~ 8ms- Parameters:
waitMilliseconds- Minimum time it takes this function to return.
-
isClosed
public boolean isClosed()Checks whether this CodeDraw window is already closed. The window can close if the user closes the window or when theclose()method is called.- Returns:
- whether this CodeDraw window is closed.
-
close
public void close()Closes the window and disposes all resources associated with this instance. Any methods associated with the graphical user interface can no longer be accessed afterwards.- Specified by:
closein interfaceAutoCloseable
-
close
public void close(boolean terminateProcess) Closes the window and disposes all resources associated with this instance. Any methods associated with the graphical user interface can no longer be accessed afterwards.- Parameters:
terminateProcess- When true terminates the process when all CodeDraw instances are closed. When false lets the process continue even though all CodeDraw instances have been closed.
-
toString
-
afterDrawing
protected void afterDrawing()Description copied from class:ImageThis method is called each time right after a shape is drawn. You can override this method to implement custom behavior when drawing in the inheriting class.- Overrides:
afterDrawingin classImage
-