AWT Section Index | Page 22
How can I change the size of an Applet/JApplet in a Web Page?
Short answer: you can't.
The browser defines a fixed-sized area in the web page for the Applet. If you need dynamic sizing, your only choice is to have your Applet display a Frame, Window, or Dia...more
Can you create custom cursors in JDK 1.1?
You cannot create custom cursors in JDK 1.1. This support is only available in the Java2 platform.
In JDK 1.1, you can only set cursors to the constant values provided in the java.awt.Cursor clas...more
What exactly is the "Event Dispatch" thread (aka "AWT" Thread)?
When you run a GUI applet or application, the code in your main() method creates a GUI and sets up event handling. When you call setVisible(true) for your Frame, Window, Dialog, or when the browse...more
Why must I override getPreferredSize() for Canvas to appear on the screen?
Whenever you use a component in a layout manager, it may be asked for its preferredSize. This is a layout manager's way of respecting the sizing wishes of components that it manages. Some layout m...more
How do I make text typed in a TextArea appear in uppercase only?
The key to solving this problem is to subclass TextArea and intercept
any KeyEvent sent. You need to check to see if the typed
key is a lower case character (be careful to keep this independent ...more
How do I get all the font names supported by java using jdk1.1.8?
There are two "types" of font names you can deal with in Java
Logical Font Names
System Font Names
Logical font names are the names Java uses for platform independence. These are na...more
How do I find out which mouse button is pressed for a MouseEvent?
For AWT programs, you need to compare the modifiers of the event to the button masks of the INPUT_EVENT.
Left
InputEvent.BUTTON1_MASK
Middle
InputE...more
How do I find out the screen size of the user's machine?
The AWT Toolkit object provides information about the user's runtime platform. To find out what size in pixels the users's screen is, use the getScreenSize() method.
import java.awt.*;
public cla...more
My graphics card only supports 16 colors. Can I still use Java?
All graphical applications require at least 256 colors. Console-based programs like servlets or the compiler are not limited by this capability.