The java.awt.peer package is interesting because it contains no classes. Every object defined within the java.awt.peer package is an interface. By examining the contents of the classes in the java.awt package, you will find that all the GUI components in that package implement the interfaces found in the java.awt.peer package. Nearly all the methods defined in the java.awt.peer interfaces are friendly methods, meaning that they can only be accessed from within java.awt package classes.
Extends: ComponentPeer
The ButtonPeer interface extends interface java.awt.peer.ComponentPeer. The ButtonPeer interface provides the basic structure required for button component functionality.
void setLabel(String label)
The setLabel method should set the displayed label for the button using the specified label string.
Parameters: label-a string that will be displayed as the button's label.
Extends: ComponentPeer
The CanvasPeer interface extends interface java.awt.peer.ComponentPeer. The CanvasPeer interface provides the basic structure required for canvas component functionality.
Extends: MenuItemPeer
The CheckboxMenuItemPeer interface extends interface java.awt.peer.MenuItemPeer. The CheckboxMenuItemPeer interface provides the basic structure required for check box menu item component functionality.
void setState(boolean t)
The setState method sets the checked state of a check box menu item.
Parameters: t-a boolean value that will be true if the check box is to be checked, false if not.
Extends: ComponentPeer
The CheckboxPeer interface extends interface java.awt.peer.ComponentPeer. The CheckboxPeer interface provides the basic structure required for check box component functionality.
void setState(boolean state)
The setState method sets the checked state of a check box.
Parameters: t-a boolean value that will be true if the check box is to be checked, false if not.
void setCheckboxGroup(CheckboxGroup g)
The setCheckboxGroup method should set which check box group the check box belongs to, using the specified check box group.
Parameters: g-a CheckboxGroup object that this check box will be a member of.
void setLabel(String label)
The setLabel method should set the displayed label for the check box using the specified label string.
Parameters: label-a String that will be displayed as the check box's label.
Extends: ComponentPeer
The ChoicePeer interface extends interface java.awt.peer.ComponentPeer. The ChoicePeer interface provides the basic structure required for Choice component functionality.
void addItem(String item, int index)
The addItem method adds the specified item to the choice list at the specified list index.
Parameters: item-a string value representing the item to be added to the choice list.
Parameters: index-the integer index into the choice list where the item parameter is to be added.
void select(int index)
The select method selects the choice list item at the specified index.
Parameters: index-the index into the choice list to be selected.
The ComponentPeer interface extends class java.lang.Object. The ComponentPeer interface provides the basic structure required for component functionality.
void show()
The show method should be implemented to make the Component object visible.
void hide()
The hide method should hide the component so that is not visible.
void enable()
The enable method should enable the component so that it can be selected by the user.
void disable()
The disable method should disable the component (gray it out, and so on) so that it cannot be selected by the user.
void paint(Graphics g)
The paint method should display the component using the specified Graphics context.
Parameters: g-a Graphics object used for drawing purposes.
void repaint(long tm, int x, int y, int width, int height)
The repaint method repaints a part of the component at some specified time in the Qfuture.
Parameters:
tm-maximum time in milliseconds before the update.
x-the x coordinate of the component's bounding rectangle to repaint.
y-the y coordinate of the component's bounding rectangle to repaint.
width-the width of the component's bounding rectangle to repaint.
height-the height of the component's bounding rectangle to repaint.
void print(Graphics g)
The print method should print the component using the specified Graphics object.
Parameters: g-a Graphics object used for drawing purposes.
void reshape(int x, int y, int width, int height)
The reshape method reshapes the component to the specified bounding rectangle.
Parameters:
x-the x coordinate of the component's new bounding rectangle.
y-the y coordinate of the component's new bounding rectangle.
width-the width of the component's new bounding rectangle.
height-the height of the component's new bounding rectangle.
boolean handleEvent(Event e)
The handleEvent method should handle the specified event for the component.
Parameters: e-an Event object encapsulating some system event.
Dimension minimumSize()
The minimumSize method returns the minimum size allowable for the component.
Returns: A Dimension object containing the component's minimum size.
Dimension preferredSize()
The preferredSize method returns the preferred size allowable for the component.
Returns: A Dimension object containing the component's preferred size.
ColorModel getColorModel()
The getColorModel method returns the color model used for this component.
Returns: A ColorModel object that contains the component's color model information.
Toolkit getToolkit()
The getToolkit method returns the component's managing tool kit.
Returns: A Toolkit object.
Graphics getGraphics()
The getGraphics method returns a Graphics context for the component.
Returns: A Graphics object used for drawing purposes.
FontMetrics getFontMetrics(Font font)
The getFontMetrics method returns the font metrics information for the specified Font.
Parameters: font-a Font object.
Returns: A FontMetrics object containing metrics information on the specified font.
void dispose()
The dispose method disposes of a component's resources and the component itself.
void setForeground(Color c)
The setForeground method sets the foreground color for the component using the specified color.
Parameters: c-a Color object specifying which color to use for the foreground color.
void setBackground(Color c)
The setBackground method sets the background color for the component using the specified color.
Parameters: c-a Color object specifying which color to use for the background color.
void setFont(Font f)
The setFont method sets the font to use for this component using the specified font.
Parameters: f-a Font object specifying which font to use for the component.
void requestFocus()
The requestFocus method requests the input focus for the component.
void nextFocus()
The nextFocus method shifts the focus to the next component on the screen.
Image createImage(ImageProducer producer)
The createImage method creates an Image object using the specified ImageProducer interface.
Parameters: producer-an ImageProducer derived object used to produce an image.
Returns: An Image object.
Image createImage(int width, int height)
This createImage method creates an image for offscreen use using the specified sizes.
Parameters:
width-the width of the image to be created.
height-the height of the image to be created.
Returns: An Image object.
boolean prepareImage(Image img, int w, int h, ImageObserver o)
The prepareImage method prepares the image for rendering on this component using the specified parameters.
Parameters:
img-an Image object to be rendered.
w-the width of the rectangle to render the image in.
h-the height of the rectangle to render the image in.
o-the image observer used to monitor the image rendering.
Returns: A boolean value that is true if the image was rendered successfully, false if not.
int checkImage(Image img, int w, int h, ImageObserver o)
The checkImage method returns the status of a scaled rendering of a specified Image.
Parameters:
img-an Image object to be rendered.
w-the width of the rectangle to render the image in.
h-the height of the rectangle to render the image in.
o-the image observer used to monitor the image rendering.
Returns: An integer value containing the boolean OR of the image observer status flags.
Extends: ComponentPeer
The ContainerPeer interface extends interface java.awt.peer.ComponentPeer. The ContainerPeer interface provides the basic structure required for container component functionality.
Insets insets()
The insets method returns an Insets object representing the insets of the container.
Returns: An Insets object.
Extends: WindowPeer
The DialogPeer interface extends interface java.awt.peer.WindowPeer. The DialogPeer interface provides the basic structure required for dialog box component functionality.
void setTitle(String title)
The setTitle method sets the title to be displayed on the dialog's title bar.
Parameters: title-a string value that will be used as the dialog's title.
void setResizable(boolean resizeable)
The setResizable method determines the dialog's resize state.
Parameters: resizeable-a boolean value that is true if the dialog can be resized, false if not.
Extends: DialogPeer
The FileDialogPeer interface extends interface java.awt.peer.DialogPeer. The FileDialogPeer interface provides the basic structure required for file selection dialog component func-tionality.
void setFile(String file)
The setFile method sets the filename to be displayed in the file dialog.
Parameters: file-a string value representing a filename.
void setDirectory(String dir)
The setDirectory method sets the directory to be selected in the file dialog.
Parameters: dir-a string value representing the directory name.
void setFilenameFilter(FilenameFilter filter)
The setFilenameFilter() sets the filter to be used in the file dialog.
Parameters: filter-a FilenameFilter object used to filter filenames.
Extends: WindowPeer
The FramePeer interface extends interface java.awt.peer.WindowPeer. The FramePeer interface provides the basic structure required for frame component functionality.
void setTitle(String title)
The setTitle method sets the title of the frame to the specified title string.
Parameters: title-a string value representing the frame's title.
void setIconImage(Image im)
The setIconImage method sets the image to be used when the frame is iconized.
Parameters: im-an Image object.
void setMenuBar(MenuBar mb)
The setMenuBar method sets the menu bar to be used for the frame.
Parameters: mb-A MenuBar object.
void setResizable(boolean resizeable)
The setResizable method determines the resize state of the frame.
Parameters: resizeable-a boolean value that is true if the frame can be resized, false if not.
void setCursor(int cursorType)
The setCursor method sets the cursor type for the frame.
Parameters: cursorType-an integer value representing the cursor type.
Extends: ComponentPeer
The LabelPeer interface extends interface java.awt.peer.ComponentPeer. The LabelPeer interface provides the basic structure required for label component functionality.
void setText(String label)
The setText method sets the text to be displayed on the label.
Parameters: label-a string value that is used as the label string.
void setAlignment(int alignment)
The setAlignment method sets the alignment type of the label.
Parameters: alignment-an integer value that determines the alignment of the label (LEFT, RIGHT, or CENTER).
Extends: ComponentPeer
The ListPeer interface extends interface java.awt.peer.ComponentPeer. The ListPeer interface provides the basic structure required for list component functionality.
int[] getSelectedIndexes()
The getSelectedIndexes method returns an array containing the selected indexes in the list.
Returns: An integer array containing the indexes that are currently selected in the list.
void addItem(String item, int index)
The addItem method adds a String item at the specified index.
Parameters:
item-a string value to be added to the list.
index-an integer value representing the index into the list.
void delItems(int start, int end)
The delItems method deletes a range of values from the list using the specified range values.
Parameters:
start-an integer value marking the start of the deletion range.
end-an integer value marking the end of the deletion range.
void clear()
The clear method clears all elements from the list.
void select(int index)
This select method selects the specified index.
Parameters: index-an integer value specifying the item in the list to be selected.
void deselect(int index)
The deselect method deselects an item within the list.
Parameters: index-an integer value specifying the item in the list to be deselected.
void makeVisible(int index)
The makeVisible method forces the list to scroll, if necessary, so that the specified index will be made visible to the user.
Parameters: index-an integer value representing the index to be made visible.
void setMultipleSelections(boolean v)
The setMultipleSelections method specifies whether the list should allow multiple selections or not.
Parameters: v-a boolean value that is true if multiple selections are to be allowed, false if not.
Dimension preferredSize(int v)
The preferredSize method sets the preferred size for a list of the specified number of items.
Parameters: v-an integer value specifying the number of items within the list.
Returns: A Dimension object containing the preferred size of the list.
Dimension minimumSize(int v)
The minimumSize method sets the minimum size for a list of the specified number of items.
Parameters: v-an integer value specifying the number of items within the list.
Returns: A Dimension object containing the minimum size of the list.
Extends: MenuComponentPeer
The MenuBarPeer interface extends interface java.awt.peer.MenuComponentPeer. The MenuBarPeer interface provides the basic structure required for menu bar component functionality.
void addMenu(Menu m)
The addMenu method adds the specified Menu to the menu bar.
Parameters: m-the Menu object to be added to the menu bar.
void delMenu(int index)
The delMenu method deletes the menu at the specified index from the menu bar.
Parameters: index-an integer value representing the index to be deleted from the menu bar.
void addHelpMenu(Menu m)
The addHelpMenu adds a help menu to the menu bar.
Parameters: m-the Menu object to be added to the menu bar.
Extends: MenuComponentPeer
The MenuComponentPeer interface extends interface java.awt.peer.MenuComponentPeer. The MenuComponentPeer interface provides the basic structure required for menu component functionality.
void dispose()
The dispose method disposes of a MenuComponent's allocated resources.
Extends: MenuComponentPeer
The MenuItemPeer interface extends interface java.awt.peer.MenuComponentPeer. The MenuItemPeer interface provides the basic structure required for menu item component functionality.
void setLabel(String label)
The setLabel method sets the label string that will be displayed on the menu item.
Parameters: label-a string value that will be displayed as the menu item's label.
void enable()
The enable method enables the menu item for user selection.
void disable()
The disable method disables the menu item for user selection.
Extends: MenuItemPeer
The MenuPeer interface extends interface java.awt.peer.MenuItemPeer. The MenuPeer interface provides the basic structure required for menu component functionality.
void addSeparator()
The addSeparator method adds a separator element to the menu. A separator is an item like a line that cannot be selected by the user and that will not trigger a menu selection event.
void addItem(MenuItem item)
The addItem method adds a menu item to the menu.
Parameters: item-a MenuItem object.
void delItem(int index)
The delItem method deletes the menu item at the specified index.
Parameters: index-an integer value representing the index on the menu to be deleted.
Extends: ContainerPeer
The PanelPeer interface extends interface java.awt.peer.ContainerPeer. The PanelPeer interface provides the basic structure required for panel component functionality.
Extends: ComponentPeer
The ScrollbarPeer interface extends interface java.awt.peer.ComponentPeer. The ScrollbarPeer interface provides the basic structure required for scrollbar component functionality.
void setValue(int value)
The setValue method sets the value of the scrollbar.
Parameters: value-an integer value representing the value (position) of the scrollbar.
void setValues(int value, int visible, int minimum, int maximum)
The setValues method sets the specified properties of the scrollbar.
Parameters:
value-the new value of the scrollbar.
visible-the number of units to be displayed by the scrollbar.
Parameters:
minimum-the minimum value of the scrollbar.
maximum-the maximum value of the scrollbar.
void setLineIncrement(int l)
The setLineIncrement method sets the increment value represented by a user clicking on a scrollbar line up/down widget.
Parameters: l-an integer value representing the line increment value.
void setPageIncrement(int l)
The setPageIncrement method sets the increment value represented by a user clicking on a scrollbar page up/down widget.
Parameters: l-an integer value representing the page increment value.
Extends: TextComponentPeer
The TextAreaPeer interface extends interface java.awt.peer.TextAreaPeer. The TextAreaPeer interface provides the basic structure required for text area component functionality.
void insertText(String txt, int pos)
The insertText method inserts the specified text at the specified position within the text area.
Parameters:
txt-a string value representing the text to be inserted.
pos-an integer value representing the position within the text area to insert the text at.
void replaceText(String txt, int start, int end)
The replaceText method replaces text at the specified positions with the new text.
Parameters:
txt-a string value representing the text to be inserted into the text area.
start-an integer value containing the start position of the text to be replaced.
end-an integer value containing the end position of the text to be replaced.
Dimension preferredSize(int rows, int cols)
The preferredSize method returns the preferred size of a text area of the specified dimensions.
Parameters:
rows-the number of rows in the text area.
cols-the number of columns in the text area.
Returns: A Dimension object containing the preferred size of the text area.
Dimension minimumSize(int rows, int cols)
The minimumSize method returns the minimum size of a text area of the specified dimensions.
Parameters:
rows-the number of rows in the text area.
cols-the number of columns in the text area.
Returns: A Dimension object containing the minimum size of the text area.
Extends: ComponentPeer
The TextComponentPeer interface extends interface java.awt.peer.ComponentPeer. The TextComponentPeer interface provides the basic structure required for text component functionality.
void setEditable(boolean editable)
The setEditable method is used to set the text component's editable state.
Parameters: A boolean value that is true if the text can be edited, false if not.
String getText()
The getText method returns the text component's displayed text.
Returns: A string value representing the text contained in the text component.
void setText(String l)
The setText method sets the text to be displayed in the text component.
Parameters: l-a string value to be displayed by the text component.
int getSelectionStart()
The getSelectionStart method returns the position of the first selected character in the text component.
Returns: An integer value specifying the position of the first selected character in the text component.
int getSelectionEnd()
The getSelectionEnd method returns the position of the last selected character in the text component.
Returns: An integer value specifying the position of the last selected character in the text component.
void select(int selStart, int selEnd)
The select method selects the specified text within the TextComponent.
Parameters:
selStart-an integer value representing the starting character to be selected.
selEnd-an integer value representing the ending character to be selected.
Extends: TextComponentPeer
The TextFieldPeer interface extends class java.lang.Object. The TextFieldPeer interface provides the basic structure required for text field component functionality.
void setEchoCharacter(char c)
The setEchoCharacter method sets the echo character to be echoed to the screen as the user types.
Parameters: c-a character value to be displayed no matter what character the user types.
Dimension preferredSize(int cols)
The preferredSize method returns the preferred size of the text field based on the specified number of characters.
Parameters: cols-an integer value containing the number of characters in the text field.
Returns: A Dimension object containing the preferred size of the text field.
Dimension minimumSize(int cols)
The minimumSize method returns the minimum size of the text field based on the specified number of characters.
Parameters: cols-an integer value containing the number of characters in the text field.
Returns: A Dimension object containing the minimum size of the text field.
Extends: ContainerPeer
The WindowPeer interface extends interface java.awt.peer.ContainerPeer. The WindowPeer interface provides the basic structure required for window component functionality.
void toFront()
The toFront method moves the window to the front of the display.
void toBack()
The toBack method moves the window to the back of the display.