Java Swing O Reilly If (Web server type) you wish to
Java Swing O Reilly If you wish to activate debugging for the component’s graphics, you can pass one or more debugging flags into the setDebugGraphicsOptions() method of JComponent. The debugging flags are given in Table 3.6. Table 3.6, Constants for Debug Graphics Options DebugGraphics Constant Description Causes each graphics primitive to flash a user-configurable number of DebugGraphics.FLASH_OPTION times as it is being rendered. DebugGraphics.LOG_OPTION Prints a text message to the screen as each graphics primitive is drawn. Raises a window that shows the drawing that is taking place in the DebugGraphics.BUFFERED_OPTION offscreen buffer. This is useful in the event that the double-buffered feature has been activated. DebugGraphics.NONE_OPTION Disables all debug graphics options. The debug options outlined in Table 3.6 are bits in a binary mask; you can set more than one at the same time by using the bitwise OR ( | ) operator, as shown here: JButton myButton = new JButton(”Hello”); // JButton extends JComponentmyButton.setDebugGraphicsOptions(DebugGraphics.FLASH_OPTION | DebugGraphics.LOG_OPTION); When any of the debug graphics options are set, the getComponentGraphics() method of JComponent returns a DebugGraphics object, instead of a normal Graphics object. As we mentioned above, this is the same type of object that is passed to the UI delegate of the component. When a component draws itself, it calls upon the functionality of the DebugGraphics object to perform the task, just as it would with a typical Graphics object. The drawing primitives are then slowed or logged so that the user can help identify any problems. 3.3.2.11 Focus and Focus Cycle The term focus refers to the active component on the screen. We typically think of the active component as the frame or window that is the current recipient of mouse and keyboard events. Other components, such as buttons and text fields, can have the focus as well. Visual cues, like a colored title bar or a dashed outline, often help us determine where the current focus resides. When we click on another component with the mouse, the focus is typically shifted, and that component is now responsible for consuming mouse and keyboard events. You can also traverse the focus by pressing the TAB key to move forward or the TAB and the SHIFT key together to move backward. This causes the focus to cycle from one component to the next, eventually completing a loop and returning to its original position. This loop is called the focus cycle . A group of components within a single container can define a focus cycle of its own. If the container has its own focus cycle, the focus repeatedly traverses through all of its children that accept the focus. The focus cycle is typically determined by the location of components in the container, although you can create your own focus manager if you require a different behavior. With the default focus manager, the component closest to the top-left corner of the container always receives the focus first. The focus then moves from left to right across the components, and from top to bottom. Figure 3.9 shows how the default focus cycle shifts focus between components in a container. Figure 3.9. The default container focus cycle - 65 -
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision j2ee hosting services