Download Java AWT Reference (J. Zukowski) Download free online book chm pdf. . PDFs for the Java AWT Reference are available at this book's web site, .. of you still working with JDK , we've included a PDF containing the " Keyboard. Java in a Nutshell. Java Language Reference. Java AWT Reference. Java Fundamental Classes Reference. Exploring Java. Combined Index. Combined.
|Language:||English, Spanish, Portuguese|
|ePub File Size:||26.71 MB|
|PDF File Size:||18.46 MB|
|Distribution:||Free* [*Register to download]|
19 ronaldweinland.info Reference. AWTError ronaldweinland.info ronaldweinland.infoble ronaldweinland.info, which is only used for the Java event model. In Java Java AWT Reference In PDF Format. Preface · Chapter 1: Abstract Window Toolkit Overview · Chapter 2: Simple Graphics · Chapter 3: Fonts and Colors. The Java AWT Reference provides complete reference documentation on the Abstract Window Toolkit (AWT), a large collection of classes for building graphical.
Thrown when a serious Abstract Window Toolkit error has occurred. Package java. A user interface object such as a button or a scrollbar is called, in AWT terminology, a component. The Component class is the root of all AWT components. See Component for a detailed description of properties that all AWT components share. Some components fire events when a user interacts with the components. A container is a component that can contain components and other containers.
Reviews and Rating: site Related Book Categories: All Categories. Recent Books. IT Research Library. Miscellaneous Books. Computer Languages.
Computer Science. All items in a menu must belong to the class MenuItem , or one of its subclasses. The MenuShortcut class represents a keyboard accelerator for a MenuItem. MouseInfo provides methods for getting information about the mouse, such as mouse pointer location and the number of mouse buttons. This is the superclass for Paints which use a multiple color gradient to fill in their raster.
A point representing a location in x,y coordinate space, specified in integer precision. The Polygon class encapsulates a description of a closed, two-dimensional region within a coordinate space. A class that implements a menu which can be dynamically popped up at a specified position within a component. The RadialGradientPaint class provides a way to fill a shape with a circular radial color gradient pattern.
A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's upper-left point x,y in the coordinate space, its width, and its height. The RenderingHints class defines and manages collections of keys and associated values which allow an application to provide input into the choice of algorithms used by other classes which perform rendering and image manipulation services.
Defines the base type of all keys used along with the RenderingHints class to control various algorithm choices in the rendering and imaging pipelines. This class is used to generate native system input events for the purposes of test automation, self-running demos, and other applications where control of the mouse and keyboard is needed. The Scrollbar class embodies a scroll bar, a familiar user-interface object.
This class represents the state of a horizontal or vertical scrollbar of a ScrollPane. A class to encapsulate symbolic colors representing the color of native GUI objects on a system. The TextComponent class is the superclass of any component that allows the editing of some text. A TextField object is a text component that allows for the editing of a single line of text.
The TexturePaint class provides a way to fill a Shape with a texture that is specified as a BufferedImage. This class is the abstract superclass of all actual implementations of the Abstract Window Toolkit.
A TrayIcon object represents a tray icon that can be added to the system tray. A Window object is a top-level window with no borders and no menubar. Enumeration of the common ways the baseline of a component can change as the size changes. The message type determines which icon will be displayed in the caption of the message, and a possible system sound a message may generate upon showing. Thrown by method createFont in the Font class to indicate that the specified font is bad.
Thrown when code that is dependent on a keyboard, display, or mouse is called in an environment that does not support a keyboard, display, or mouse. Signals that an AWT component is not in an appropriate state for the requested operation.
Contains all of the classes for creating user interfaces and for painting graphics and images. A user interface object such as a button or a scrollbar is called, in AWT terminology, a component. The Component class is the root of all AWT components. See Component for a detailed description of properties that all AWT components share. An interface for events that know how to dispatch themselves. An abstract class which provides a print graphics context for a page.
A CardLayout object is a layout manager for a container. This class represents a check box that can be included in a menu. The Choice class presents a pop-up menu of choices. A class to encapsulate the bitmap representation of the mouse cursor.
A Frame is a top-level window with a title and a border. A type-safe enumeration of possible default selection states. A type-safe enumeration of possible dialogs to display to the user.
In the above figure, there are three containers: a Frame and two Panels.
A Frame is the top-level container of an AWT program. A Panel is a rectangular area used to group related GUI components in a certain layout. In the above figure, the top-level Frame contains two Panels.
There are five components: a Label providing description , a TextField for users to enter text , and three Buttons for user to trigger certain programmed actions. In a GUI program, a component must be kept in a container.
You need to identify a container to hold the components. Every container has a method called add Component c. A container say c can invoke c. To write a GUI program, we typically start with a subclass extending from java. Frame to inherit the main window as follows: import java. A Dialog has a title-bar containing an icon, a title and a close button and a content display area, as illustrated. An AWT Applet in package java. Secondary Containers: Panel and ScrollPane Secondary containers are placed inside a top-level container or another secondary container.
AWT provides these secondary containers: Panel: a rectangular box used to layout a set of related GUI components in pattern such as grid or flow. Label A java.
Label provides a descriptive text string. Take note that System. You could use a Label to label another component such as text field to provide a text description. Note that three static constants Label.
LEFT, Label. CENTER are defined in the class for you to specify the alignment rather than asking you to memorize arbitrary integer values. The second constructor constructs a Label object with the given text string in default of left-aligned. The third constructor constructs a Label object with an initially empty string.
You could set the label text via the setText method later. Similarly, the getAlignment and setAlignment methods can be used to retrieve and modify the alignment of the text.
Constructing a Component and Adding the Component into a Container Three steps are necessary to create and place a GUI component: Declare the component with an identifier name ; Construct the component by invoking an appropriate constructor via the new operator; Identify the container such as Frame or Panel designed to hold this component. The container can then add this component onto itself via aContainer. Every container has a add Component method.
Take note that it is the container that actively and explicitly adds a component onto itself, NOT the other way. In the case, the Java compiler will assign an anonymous identifier for the allocated object. You will not be able to reference an anonymous instance in your program after it is created.
This is usually alright for a Label instance as there is often no need to reference a Label after it is constructed. Button A java. Button is a GUI component that triggers a certain programmed action upon clicking. The first constructor creates a Button object with the given label painted over the button. The second constructor creates a Button object with no label. Disabled Button cannot be clicked. The getLabel and setLabel methods can be used to read the current label and modify the label of a button, respectively.
We will describe Swing later. Event Clicking a button fires a so-called ActionEvent and triggers a certain programmed action.
I will explain event-handling later. TextField A java. TextField is single-line text box for users to enter texts. There is a multiple-line text box called TextArea. You can convert a String to a primitive, such as int or double via static method Integer.
To convert a primitive to a String, simply concatenate the primitive with an empty String. It has a top-level container Frame, which contains three components - a Label "Counter", a non-editable TextField to display the current count, and a "Count" Button. The TextField shall display count of 0 initially. Each time you click the button, the counter's value increases by 1.
This is because we have yet to write the handler for the Frame's close button. We shall do that in the later example. Dissecting the AWTCounter. In other words, this class AWTCounter is a Frame, and inherits all the attributes and behaviors of a Frame, such as the title bar and content pane.
Lines 12 to 46 define a constructor, which is used to setup and initialize the GUI components. In Line 13, the setLayout inherited from the superclass Frame is used to set the layout of the container. FlowLayout is used which arranges the components in left-to-right and flows into next row in a top-to-bottom manner.
A Label, TextField non-editable , and Button are constructed. We invoke the add method inherited from the superclass Frame to add these components into container. In Line , we invoke the setSize and the setTitle inherited from the superclass Frame to set the initial size and the title of the Frame.
The setVisible true method Line 42 is then invoked to show the display. The statement btnCount. In brief, whenever the button is clicked, the actionPerformed will be called. In the actionPerformed Lines , the counter value increases by 1 and displayed on the TextField.