devxlogo

Tip Bank

Paint Outside The GUI Thread

A call to repaint() will schedule a component to be repainted when the gui thread is free. But what if we can’t wait till then? Well, we can use the

Load an HTML Page From Within an Applet

Applets are executed within a web browser, and there’s an easy way to load show a specific URL. 1. Get a reference to the applet context 2. Call the showDocument

See Which Fonts Are Installed With Your VM

Sometimes, it is useful to know which fonts are installed. This can differ from one Java Virtual Machine (JVM) implementation to another. The following code displays the names of all

Get a Hold of the Bits in Your Integers

Sometimes, it is useful to obtain a binary representation of integer, or a character. For example, we might want to represent the character ‘a’ by its binary 01100001, the letter

Trigonometry With Java

The java.lang.Math package has useful trigonometric functions such as: public static native double sin(double a) public static native double asin(double a). So, if we write code: double x = 90;

Using ShowHelp with Windows 95 and NT

Question: When we call the ShowHelp function in Windows 95, it works with a topic ID but not with a keyword. However, the same source works just the opposite in

Swap Images With JavaScript

A nice touch to a Web page is a button that changes appearance when clicked. All you need is two GIFs and a little JavaScript. The following code initially displays