Java Swing O Reilly tooltip by declaring your (Web host forum)

Java Swing O Reilly tooltip by declaring your own JToolTip object and overriding the createToolTip() method of JComponent to return it to the ToolTipManager on demand. We cover the JToolTip object and the ToolTipManager in more detail in Chapter 27. 3.3.2.7 Client Properties Swing components can maintain a special table of properties called “client properties.” The purpose is to provide specialized properties that can be meaningful in components only in certain instances. For example, let’s assume that a specific look-and-feel uses a client property to store information about how a component should display itself when that L&F is activated. As you might guess, this client property would be meaningless when another look-and-feel is activated. Using the client properties approach allows various look-and-feels to expand their component properties without deluging the Swing source base with L&F-specific data. The name “client properties” is somewhat confusing, because client properties are distinct from JavaBeans-style properties. Obviously, there’s a big difference: unlike JavaBeans properties, you can create new client properties without subclassing; you can even create new client properties at runtime. These two methods in JComponent store and retrieve client properties: myComponent. putClientProperty(”aClientProperty”, Boolean.TRUE); Boolean result = (Boolean)getClientProperty(”aClientProperty”); Note that because we are using a hashtable, the properties must be objects and not primitive data types. Hence, we are forced to use the Boolean object, instead of simplysetting true and false. 3.3.2.8 Double Buffering The JComponent class allows all Swing components to take advantage of double buffering. The idea behind double buffering is that it takes longer for a component to render its individual parts on screen than it does for a rectangular area-copy to take place. If the former occurs with multiple refreshes, the human eye is likely to catch the component in the process of being drawn, and it may appear to flicker. With the latter, the screen is usually updated as fast as the monitor can refresh itself.[3] [3] Area copies are always faster because they are performed by the operating system or even the graphics card of the computer. At this level, they are commonly referred to as “bit-block transfers” or BitBLTs. When double buffering is activated in Swing, all component rendering performed by the repaint manager is done to an off-screen buffer. Upon completion, the contents of the off-screen buffer are quickly copied (not redrawn) on the screen at the component’s position. You can activate double buffering by accessing the boolean doubleBuffered property of JComponent. Passing in true to the setDoubleBuffered() method enables double buffering; false shuts it off: JButton button = new JButton(”Test Button”); button.setDoubleBuffered(true); // Turns on double buffering You can use the isDoubleBuffered() method to check if double buffering is currently enabled on a Swing component. - 63 -
Please visit Domain Name Hosting services for high quality webhost to host and run your jsp applications.