The Java Tutorials have been written for JDK 8.Java教程是为JDK 8编写的。Examples and practices described in this page don't take advantage of improvements introduced in later releases and might use technology no longer available.本页中描述的示例和实践没有利用后续版本中引入的改进,并且可能使用不再可用的技术。See Java Language Changes for a summary of updated language features in Java SE 9 and subsequent releases.有关Java SE 9及其后续版本中更新的语言特性的摘要,请参阅Java语言更改。
See JDK Release Notes for information about new features, enhancements, and removed or deprecated options for all JDK releases.有关所有JDK版本的新功能、增强功能以及已删除或不推荐的选项的信息,请参阅JDK发行说明。
Programmers who use Microsoft's DirectX API may already be familiar with full-screen exclusive mode. Other programmers may be somewhat new to the concept. 使用微软DirectX API的程序员可能已经熟悉全屏独占模式。其他程序员可能对这个概念有些陌生。In either case, full-screen exclusive mode is a powerful feature of J2SE™ version 1.4 that allows the programmer to suspend the windowing system so that drawing can be done directly to the screen.无论哪种情况,全屏独占模式都是J2SE™版本1.4的强大功能,允许程序员暂停窗口系统,以便可以直接在屏幕上绘制。
This is a slight paradigm shift from the usual kind of GUI program in many ways. 这在许多方面与通常的GUI程序略有不同。In traditional Java GUI programs, the AWT is responsible for propagating paint events from the operating system, through the event dispatch thread, and by calling AWT's Component.paint method when appropriate. 在传统的JavaGUI程序中,AWT负责通过事件调度线程从操作系统传播绘制事件,并在适当时调用AWT的Component.paint方法。In full-screen exclusive applications, painting is usually done actively by the program itself. 在全屏独占应用程序中,绘画通常由程序本身主动完成。Additionally, a traditional GUI application is limited to the bit depth and size of the screen chosen by the user. 此外,传统的GUI应用程序仅限于用户选择的屏幕的位深度和大小。In a full-screen exclusive application, the program can control the bit depth and size (display mode) of the screen. Finally, many more advanced techniques, such as page flipping (discussed below) and stereo buffering (utilizing systems which use a separate set of frames for each eye) require, on some platforms, that an application first be in full-screen exclusive mode.在全屏专用应用程序中,程序可以控制屏幕的位深度和大小(显示模式)。最后,在一些平台上,许多更先进的技术,如页面翻转(下文讨论)和立体声缓冲(利用为每只眼睛使用一组单独的帧的系统),要求应用程序首先处于全屏独占模式。
To understand the full-screen exclusive mode API, you need to understand some basic principles of hardware-accelerated images. 要了解全屏独占模式API,您需要了解硬件加速映像的一些基本原理。The VolatileImage interface encapsulates a surface which may or may not take advantage of hardware acceleration. VolatileImage接口封装了一个可以利用或不利用硬件加速的表面。Such surfaces may lose their hardware acceleration or their memory at the behest of the operating system (hence, the name 'volatile'). 在操作系统的要求下,这些表面可能会失去硬件加速或内存(因此,名称为“易失性”)。See the 有关volatile图像的更多信息,请参阅VolatileImage
Tutorial (coming soon) for more information on volatile images.VolatileImage
教程(即将推出)。
Full-screen exclusive mode is handled through a java.awt.GraphicsDevice object. 全屏独占模式通过java.awt.GraphicsDevice对象处理。For a list of all available screen graphics devices (in single or multi-monitor systems), you can call the method getScreenDevices on the local java.awt.GraphicsEnvironment; for the default (primary) screen (the only screen on a single-monitor system), you can call the method getDefaultScreenDevice.对于所有可用屏幕图形设备的列表(在单监视器或多监视器系统中),您可以在本地java.awt.GraphicsEnvironment上调用方法getScreenDevices;对于默认(主)屏幕(单监视器系统上的唯一屏幕),可以调用方法getDefaultScreenDevice。
Once you have the graphics device, you can call one of the following methods:拥有图形设备后,可以调用以下方法之一:
Here are some tips about programming using full-screen exclusive mode:以下是有关使用全屏独占模式编程的一些提示:
GraphicsDevice myDevice; Window myWindow; try { myDevice.setFullScreenWindow(myWindow); ... } finally { myDevice.setFullScreenWindow(null); }