Java Reference
In-Depth Information
After clicking the Install (or Install in All) button, you'll see a success window, as shown in
Figure 22-2 (assuming everything succeeded). Installation is quick.
Figure 22-2. Java Access Bridge successfully installed
Once you've installed the bridge, you can run programs like Java Monkey and Java Ferret
(yes, those are their real names). Once running, these programs attach themselves to any Java
programs that run through the same JVM. For instance, you can try running the tooltip sample
program presented in Chapter 4 with Java Monkey, repeated here in Listing 22-1.
Listing 22-1. Tooltip Sample
import javax.swing.*;
import java.awt.*;
public class TooltipSample {
public static void main(String args[]) {
Runnable runner = new Runnable() {
public void run() {
JFrame frame = new JFrame("Tooltip Sample");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel panel = new JPanel();
panel.setToolTipText("<HtMl>Tooltip<br>Message");
frame.add(panel, BorderLayout.CENTER);
JButton button = new JButton("Hello, World") {
public JToolTip createToolTip() {
JToolTip tip = super.createToolTip();
tip.setBackground(Color.YELLOW);
tip.setForeground(Color.RED);
return tip;
}
public boolean contains(int x, int y) {
if (x < 100) {
setToolTipText("Got Green Eggs?");
} else {
setToolTipText("Got Ham?");
}
 
Search WWH ::




Custom Search