AWT Section Index | Page 20
The Communicator 4.x browsers do not implement the Class.getResource(), ClassLoader.getResource(), and ClassLoader.getSystemResource() methods. You need to use the Class.getResourceAsStream(), Cla...more
Java uses the Unicode character encodings. While 0-127 map directly from Unicode to ASCII, how they display may appear different. For instance, while u0001 might appear as a smiley face under ASCI...more
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 setState() method introduced to Java 1.2 provides support for iconifying and deiconifying. frame.setState(Frame.ICONIFIED); frame.setState(Frame.NORMAL);
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 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
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
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
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.
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
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
If you flush() an Image between calls to drawImage(), the Image will be refetched instead of using the local cached version.
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
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.
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