Java Swing O Reilly With double buffering, transparency (Domain and web hosting)
Java Swing O Reilly With double buffering, transparency is maintained in non-opaque components because the graphics underneath the component are copied into the buffer first before any off-screen rendering takes place. However, there is a slight penalty for double buffering non-opaque components, because Swing is performing two area copies instead of one: one to copy the background over, and one to copy the background plus the component back. Buffers also chew up a great deal of memory. Therefore, the repaint manager tries to avoid initializing and using more than one off-screen buffer at a time. For example, if an off-screen buffer has been set for both a container and one of its children, the buffer for the parent container is used for both components. 3.3.2.9 Serialization Objects that extend JComponent are serializable; that is, the object’s data at that point can be written out, or serialized, and written onto an output stream, which might send it over a network or save it in a file.[4] The serialized output can later be deserialized back into memory, where the object will continue to operate from its original state. Object serialization gives Java programmers a powerful and convenient way to store and retrieve object data, as opposed to saving or transmitting state data in custom-made storage files. Serialization also provides the ability to transfer quickly active components from one virtual machine to another, which can be useful in remote method invocation (RMI) and other forms of distributed computing. [4] The only exceptions to this are fields marked with the transient keyword. You can serialize components in Swing as you normally would in Java: by passing a reference to the object into the writeObject() method of an ObjectOutputStream object. In the event that the serialized object contains a reference to another object, the serialization algorithm recursively calls writeObject() on that object as well, continuing until all objects in the class hierarchy are serialized. The resulting object graph is then written out to the output stream. Conversely, you can deserialize a component back in by using the readObject() method of an ObjectInputStream , which reverses the entire process. The baseline for serialization is JDK 1.2. If you serialized objects with JDK 1.1/Swing 1.0, they may be incompatible with JDK 1.2/Swing 1.1 objects. 3.3.2.10 Debug Graphics Lightweight components are rendered entirely in Java, as opposed to off-loading their work to a native heavyweight peer. The abstract Graphics class outlines platform-independent implementations for line-drawing, image-painting, and area-copying and filling that a lightweight peer can call upon to draw itself. If you create your own component, or extend an already existing one, a Graphics object is often passed to the UI delegate’s paint() method to help out with the drawing. Sometimes the way you intend a component to be painted, however, isn’t how it appears on the screen. Debugging painting problems can prove to be troublesome, especially when dealing with transparency, opaqueness, and double buffering. JComponent, however, can generate a special version of the Graphics object, called DebugGraphics , which it can pass to a UI delegate’s paint() method that aids in debugging. This object can take a set of user-configurable debugging options that modify how a component is drawn to the screen. - 64 -
Visit our web design programs services for an affordable and reliable webhost to suit all your needs.