AWT Section Index | Page 20
Here's some sample code that can display a tooltip in an AWT GUI. Users can see information each time they move the mouse on a GUI. This little class displays tips given by a String. The String c...more
The setState() method introduced to Java 1.2 provides support for iconifying and deiconifying. frame.setState(Frame.ICONIFIED); frame.setState(Frame.NORMAL);
There is no direct support for this. The best you can do is make sure the frame is deiconified then set its size to the screen size. frame.setState(Frame.NORMAL); Toolkit toolkit = Toolkit.getDef...more
The AWT Label does not support multiple lines on Label. You would need to create multiple Label components and place them in a Panel (or create your own component). In Swing 1.1.1 and later, yo...more
AWT TextArea components only support displaying text. You cannot display images in them. If you don't mind using the Swing components, you can use either the JEditorPane or JTextPane to display im...more
How can I display Text strings of different style on different lines of an TextArea. i.e I want Hello on first line as PLAIN String. Hello World on second line as BOLD. or might be in different Color.
On Windows 95 machines, the AWT TextArea is limited to about 32K characters. This is a limitation of the underlying operating system. Since AWT components rely on native components, you cannot ove...more
JFC supports robust and portable user interfaces. The Swing classes are robust, compatible with AWT, and provide you with a great deal of control over a user interface. Since source code is availa...more
Sun's online tutorial describes what you need to do to create a layout manager at http://java.sun.com/docs/books/tutorial/uiswing/layout/custom.html.more
AWT applets (those that subclass java.applet.Applet) cannot include an AWT MenuBar. Swing applets (those that subclass javax.swing.JApplet) can use the JMenuBar. To display menus in an AWT you wou...more
You can register a ComponentListener with the window and have the componentResized() method validate the window size. If the window is outside acceptable limits, you can return things to the desir...more
If you flush() an Image between calls to drawImage(), the Image will be refetched instead of using the local cached version.
When adding a component to a container, it is removed from any previous container. Because of this, you cannot have the same component/menu items in multiple containers/menus.
You can use the printAll() method of Component to accomplish this. As an example Component comp = ... ; // the top-level component // you want to capture // create an im...more
Jef Poskanzer has a 1.1-compliant GIF writer: http://www.acme.com/java/software/Acme.JPM.Encoders.GifEncoder.html