may have a few chances to use, but the JDK provides us with this functionality. Like the print preview feature in many software and some text editors that use Full-screen mode in order to get bigger edits, if you're interested in writing a software like ACDSee, using Full-screen mode allows users to see larger picture images.
How do I use Full-screen mode?
key is the java.awt.* inside the two classes related to display devices: Graphicsenvironment and GraphicsDevice.
Graphicsenvironment provides a platform-specific graphicsdevice for Java applications
objects and a collection of Font objects. These graphicsdevice can be resources for a variety of native and remote machines, such as screens, printers, or image Buffer, or even target objects for graphics2d drawing methods.
and GraphicsDevice refers to the specific graphics environment, such as screen and printing equipment. In this way, we can use GraphicsDevice to manipulate the screen. The Setfullscreenwindow () method provided by GraphicsDevice is set up for full-screen use.
because the Graphicsenvironment constructor is protected (protected), we cannot directly construct a
Graphicsenvironment object to obtain the GraphicsDevice object. Fortunately it provides a getlocalgraphicsenvironment () method for obtaining a Graphicsenvironment instance:
graphicsenvironment ge = graphicsenvironment.getlocalgraphicsenvironment ();
has graphicsenvironment can invoke the Getdefaultscreendevice method to get the current screen device:
GraphicsDevice gd = Ge.getdefaultscreendevice ();
Hands-on Experience
with the above introduction, write an example to experience it:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service