J2SE 5.0 User Interface

xiaoxiao2021-03-06  38

J2SE 5.0 User Interface

Author (dry wood)

1.1. Pillage

"It has been 9 years since Java has been 9 years, and there is also five years from the second generation Java platform J2SE. In this background, the next version version number is changed from 1.5 to 5.0 can be better reflected. The new version of J2SE maturity, stability, scalability, and safety. "Sun is just a far-reaching change of Java. It is well known that Sun has been alert-wing, especially after the change of the version 1 to version I, especially after the change of the version of the IT industry, especially after the change of the version 1 to version two, especially after the version 1 to version 2, this is a relatively stable period, which is in front of the IT industry. Mainstream technology is really unimaginable.

It may be a kind of "unwavering, a pop-up" temperament from the bones. Java has already begun to japan from the leap of the version, then what will this Java change? From the three months of evaluation, it is also possible to explore one or two. Other temporaries, from this change, I will see it on the face involved in this change, this is not produced in a DPRK, from the macro language characteristics to the specific API, from the bottom of Java to the high-level core library, there is almost no exception The addition of this change. Such a big change, even if I have a unbearable person in Java language, I can sprout one or two, but I don't dare to deeply, just learn to be small, write some ideas, and learn from all. Here I will make some brief introduction to the user interface (UI) section in J2SE (TM) 5.0.

1.2. Review

Java has always been a very successful performance in the desktop system. It is mainly due to the fact that the UI is not satisfactory. Although Sun is the same as the UI, it is true, but a truly Successful design cannot stay only on the theoretical level, but to be recognized by developers, it is favored in the market to be successful, but Java is doing very good. This J2SE (TM) 5.0 has made great adjustments in UI, which makes up the momentum of this deficiencies, which is ambiguous for the territory of robbing on the desktop system. Regarding the relevant comment information of this adjustment, you can consult online, which is limited to the space or no matter. The following will be described in the UI adjustment of J2SE (TM) 5.0, including:

1, internationalization

2, Java sound technology

3, Java 2D (TM) technology

4, image I / O

5, AWT

6, SWING

The above topics may not be detailed in accordance with their level and space limit, some can only introduce here, as a group, the rest, readers will think more, go to explore.

1.3. Internationalization

The Java language is the first language that supports internationalization. In the beginning of the Internet, there is an inherent nature of other languages ​​from the beginning: All strings are written in Unicode. However, theory is always unable to make completely, because Unicode itself is constantly changing.

In J2SE (TM) 5.0, the main change is to adjust the java.lang, java.text, java.util.Regex, etc., so that the entire character is based on Unicode 4.0 standard, and strengthen the pair of supplementary characters. Support (For more information) Please refer to: "Supplementary Characters in the Java Platform" by norbert lindenberg and masayoshi okutsu,). In addition, these adjustments have been more comprehensively solved by the writing and display issues such as Southeast Asian countries in Vietnam. Although there is no major test. Viewing the language supported by Java and the corresponding version information can be queried using the following code. Import java.util. *;

Import java.text. *;

Public class test {

Public static void main (String [] args) {

/ / Output the language supported by JVM

Locale locale [] = dateformat.getavailablelocales ();

System.out.println ("====== Local system support language: ========");

For (int i = 0; i

System.out.println (Locale [i] .tostring () "/ t" local [i] .GetdisplayName ());

}

// Output JVM default properties

System.out.println ("====== System attribute =========");

System.getProperties (). List (system.out);

}

}

In the desktop system, this change in J2SE (TM) 5.0 is primarily manifested in successfully handling multi-language text support for logical fonts, for example, if you have a Korean-speaking font, you can Rendering Thai language and Korean, it is only necessary to make the corresponding targets through the Java.util.Locale class. Also addressed in Windows 2000 / XP, AWT calls Unicode API issues. In this way, some of the text components thereof can be used in J2SE (TM) 5.0, which can be used for text processing without being limited by the Windows Locale setting, enhances the Java cross-platform function, so that Java can really be able to relatively independent of the Windows platform. For example, the AWT text component can accept and display text in Sanskrit writing system, and do not care about the settings of Windows Locale, but only rely on the processing mechanism within the Java program.

In addition, support for I / O transmission internationalization is also enhanced in the Java.nio package. This has already been introduced in the core library, and it is not repeated here.

1.4. Java sound technology

Sound technology should be a more professional in Java, for many non-professional developers may be very unfamiliar, readers want to know more comprehensive knowledge about this knowledge, please refer to "Java (TM) Sound Programmer Guide" . Only J2SE (TM) 5.0 is listed below to improve the part of sound processing technology:

1. Now the port can be used on all platforms (RFE 4782900).

2, now the MIDI device I / O can be used on all platforms (RFE 4812168 and RFE 4782924). 3. Optimized direct audio access (RFE 4908240 and RFE 4908879) is achieved on all platforms. It is enabled by default on a system that provides this unit (such as Linux ALSA with hardware mixing).

4, the new real-time sequence works together with all MIDI devices and allows unlimited transmission (RFE 4773012).

5, Sound.Properties profile allows you to select the default device (RFE 4776511). For more information, see MidiSystem and Audiosystem.

6, MIDIDEVICES can query the connected receiver and transmitter (RFE 4931387, MIDIDEVICE.GETRECEIVER and MIDIDEVICE.GETTRANSMITER methods).

7. Audioformat, AudiofileFormat and MidiFileformat have some properties to allow further formats (RFE 4925767 and RFC 4666845).

8, a group of easy-to-use method sets allow more easily to search line from Audiosystem (RFE 4896221).

The sequence interface is expanded with a loop method, which can seamlessly cycle at a specific portion of the MIDI sequence. (RFE 4204105).

9, Java Sound no longer prohibit VM to exit (BUG 4735740).

1.5. Java 2D Technology and Image I / O

J2SE (TM) 5.0 In Java 2D Technology and Image I / O, there is no too much change in application, mostly in the original state, but many changes plays an important role in the Java language, and The changed part of the change still represents the forward direction of Java language consistent. Before J2SE (TM) 5.0, all read functions are added to the bufferedimage before j2se (TM) 5.0, and some hardware acceleration processing methods are added to the image processing, such as: The setaccelerationpriority and getAccelerationPriority and getAccelerationPriority in the Image class.

In addition, 2D features include extended Linux and Solaris printers support for new methods for creating fonts from files and streams and new methods related to hardware compression with VolatileImages and images. A large number of changes to text presentation code greatly increase its strongness, performance, and scalability. Other performance work includes hardware acceleration rendering on Linux and Solaris (disabled by default). The introduction of the above performance will make the application of the Java language in the desktop system more simple and practical.

In terms of image I / O, an reader and writer with a BMP and WBMP format are added, that is, the corresponding image can be performed with an XML language to enhance the reuse of the entire system.

1.5.1. AWT and SWING

The J2SE (TM) version 5.0 provides many AWT enhancements and patches, including some enhancements and patches that are often required by customers. Especially the new MouseInfo class makes it possible to determine the location of the mouse on the desktop. The new Window method makes it possible to specify the default location of the most recently created form (or frame) based on the platform. Another window enhancement makes it possible to ensure that the form (or frame) is always at the top layer (this characteristic is uncomfortable) for some form processors on Solaris / Linux. In terms of data conversion, the new DROPTARGETDRAGEVENT API allows the target to access the transmitted data during the drag. The introduction of these APIs has greatly enhanced the ease of use of Java languages ​​regardless of which aspect. Swing plays an extremely important role in this Java change, but it has not only stayed in changing several APIs, but adding new implementation elements in the idea of ​​implementing, this is bound to affect Java. Desktop system application UI frame design. Swing is the most important application technology in Java in the desktop system. From its appearance, it is widely concerned about people, and Sun has also promoted it as Java's mainstream technology in the desktop system. In J2SE (TM)

1.4.2

Swing provides two appearances: XP and GTK. But this did not stop this, Swing provided in J2SE (TM) 5.0 provided us with two appearances: Synth - the appearance of the skin and Ocean - a new topic for Metal. After discarding 1.4 default old Metal appearance, J2SE (TM) 5.0 introduced a new Ocean look. Taking Sun SwingSet2 Demo as a wizard, comparing the original topic of the Meta's appearance Steel and METAL Ocean topic (as shown below). In addition, we must not

Metal's Steel Topic Metal's Ocean Theme

Not mentioned is Synth, it is a complete look, not a topic, it is not a programmer, but the interface designer, let them do not have the Java knowledge to customize the selection customization. After SYNTH, we cannot send students, modify fonts or colors from existing appearances or themes, but by reprinting different XML files to achieve control of the corresponding interface. The actual steps include setting the appearance of the program to the SYNTH mode and edit the corresponding XML file. Set the SYNTH look mode, you can use the following code:

Synthlookandfeel synth = new synthlookandfeel ();

Class Aclass = Synthtest.class;

InputStream IS = ACLASS.GETRESOURCEASSTREAM ("File1.xml");

SYNTH.LOAD (IS, ACLASS);

UIManager.SetLookAndfeel (Synth);

For most things in XML, the contents of the file are described by the Document Type Definition (DTD). As long as the components are described in the XML file, the application's appearance will be different from the LOAD () method of the SYNTHLOOKANDFEEL instance. The following is the code of the XML control program appearance: