Awt components chapter 9 l.jpg
This presentation is the property of its rightful owner.
Sponsored Links
1 / 13

AWT Components (Chapter 9) PowerPoint PPT Presentation


  • 153 Views
  • Updated On :
  • Presentation posted in: General

AWT Components (Chapter 9). Java Certification Study Group January 21, 1999 Mark Roth. Components. java.awt.Component “A component is an object having a graphical representation that can be displayed on the screen and that can interact with the user.” - Javadoc java.awt.MenuComponent

Related searches for AWT Components (Chapter 9)

Download Presentation

AWT Components (Chapter 9)

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Awt components chapter 9 l.jpg

AWT Components(Chapter 9)

Java Certification Study Group

January 21, 1999

Mark Roth


Components l.jpg

Components

java.awt.Component

“A component is an object having a graphical representation that can be displayed on the screen and that can interact with the user.” - Javadoc

java.awt.MenuComponent

“The abstract class MenuComponent is the superclass of all menu-related components.” - Javadoc


Java awt compoennt l.jpg

java.awt.Compoennt

Dimension getSize()

void setForeground( java.awt.Color )

void setBackground( java.awt.Color )

setFont( java.awt.Font )

setEnabled( boolean )

setSize( width, height )

These Only Work Well for Frames:

setBounds( Rectangle ) or (x, y, w, h)

setVisible( boolean )


Component categories l.jpg

Component Categories

(11) Visual Components

(4) Container Components

(4) Menu Components


Visual components l.jpg

Visual Components

“…the ones that users can actually see and interact with.” - S. Roberts

To Use:

Create a new instance

Add component to a container


Constructing visual components l.jpg

Constructing Visual Components

Button( String label ) --> ActionEvent

Canvas() --> MouseEvent, MouseMotionEvent, KeyEvent

Checkbox( String label, boolean initialState ) --> ItemEvent

Choice() --> ItemEvent

FileDialog( Frame parent, String title, int mode )

Label( String text, int alignment )


Constructing visual components8 l.jpg

Constructing Visual Components

List( int nVisibleRows, boolean multiSelectOk ) --> ItemEvent, ActionEvent

ScrollPane( int scrollbarPolicy ) --> MouseEvent, MouseMotionEvent

Scrollbar( int orientation, int initialValue, int sliderSize, int minValue, int maxValue ) --> AdjustmentEvent


Constructing visual textcomponents l.jpg

Constructing Visual TextComponents

TextField( String text, int nCols )

TextArea( String text, int nRows, int nCols, int scrollbarPolicy )

Events

TextEvent (both, when text is typed)

ActionEvent (Enter in TextField)


Constructing container components l.jpg

Constructing Container Components

Applet()

Frame( String title )

Panel()

Dialog()


Menu components l.jpg

Menu Components

Creation

Create a menu bar and attach it to the frame.

Create and populate the menu.

Attach the menu to the menu bar.

Populating the Menu

Menu items

Check-box menu items

Separators

Menus


Slide12 l.jpg

MenuItem( text ) --> ActionEvent

CheckBoxMenuItem() --> ItemEvent

menu.addSeparator()

setHelpMenu()

Menu


References l.jpg

References

  • All Material in this Presentation is heavily based on:Roberts, Simon and Heller, Philip, Java 1.1 Certification Study Guide, 1997: SYBEX™. ISBN: 0-7821-2069-5

  • Selected portions from JDK 1.1.6 JavaDoc HTML pages.


  • Login