Upcoming SlideShare
Loading in...5








Total Views
Views on SlideShare
Embed Views



2 Embeds 4 3 1



Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

    java java Presentation Transcript

      • Is an abstract class which encapsulates all the attributes of a visual components.
      • Include almost 100 public methods in components.
      • Are responsible for managing keyboard input, mouse input and entry/exit etc.
      • CONTAINER:
      • Is an abstract subclass of component, which has an additional methods that allow other components to be nested inside it.
      • PANEL:
      • is a concrete subclass of a component.
      • We can give any kind of behavior and appearance onto a canvas .
      • Eg On a blank canvas we can paint any style component we want.
      • Label
      • Subclass of Canvas that has an additional functionality of knowing how to paint a particular string aligned inside the bound of label components.
      • These attributes may be manipulated using the getFont/setFont and getForeground/setForeground method pairs.
      • Three constants defined in Label to indicate alignment; LEFT, RIGHT and CENTER.
      • Button
      • Is a component use to invoke some action when the user presses and releases it.
      • It is labeled with String which can’t be aligned like Label object; (they are always centered inside the button.
      • Checkbox
      • Is like a Label with a small button next to it that you can click to toggle the state of a check mark.
      • Is often used to select a boolean condition.
      • We can get/set current state of check mark with getState/checkState methods.
      • While constructing checkbox we can use String label and optionally Boolean to specify initial state of check mark.
      • CheckboxGroup
      • Similar to Checkbox.
      • Allows u to create a group of choices which can only be selected one at a time.
      • getCheckboxGroup/setCheckboxGroup method use to set and get particular group.
      • getCurrent/setCurrent used to get/set currently selected checkbox.
      • Last eg. Using checkboxGroup.
      • Choice
      • Is used for creating a pop-up selection menu.
      • A choice component takes up only enough space to show the currently selected item.
      • When user clicks on it, the whole menu of choices pops up and a new selection can be made.
      • Each item in menu is a String which are left-justified label in order they are added to choice object.
      • Method addItem is used to add new string to Choice.
      • Countitem- returns no of items in choice menu.
      • Getselecteditem method- to get currently selected label
      • getselectedIndex method- to get the zero based index integer index.
      • List
      • It provides a compact, multiple choice, scrolling selection list.
      • Its unlike choice object which always show the single selected item in menu.
      • Scrollbar
      • Is used to select a continuous values between a specified minimum and maximum.
      • The scrollbar class has number of methods f or different operations.
      • Constructor allows us to specify orientation using constants HORIZANTAL/VERTICAL.
      • Methods getValue/setValue used to get /set current value of a scrollbar.
      • getMinimum/getMaximum used to get minimum/maximum values .
      • TextField
      • It implements a single-line text-entry area,often used for form and other typed user input.
      • TextField constructor allows us to create TextFields of specific character width and default value.
      • Methods setText/getText used to set/get its current value.
      • Method echoCharIsset is used to disable/enable echoing of character.
      • TextArea
      • It is used when single line of text input is not enough for given task.
      • AWT includes a very simple ,plain text , multiline editor called TextArea.
      • Constructor takes string value as a initial text , no of rows and no of columns to be displayed.
      • 3 methods to modify contents
      • AppendText
      • InsertText
      • ReplaceText
      • Layout
      • Means how all of the above discussed components are arranged or laid out on panel.
      • Arrangement of components when size ie. Width or height of component is not available
      • Manual layout of all above discussed components is tedious.
      • So to overcome above problems, each class uses LayoutManager keps track of number of components.
      • Layoutmanager is notified each time a component is added to panel.
      • Whenever a panel is resized LayoutManager is consulted via minimumlayoutsize or prefferedlayoutsize.
      • Different layout manager java includes are
      • Flowlayout
      • It implements simple layout style, similar to how words flow in a text-editor.
      • Components are laid out from the upper-left corner, left to right and top to bottom.
      • When no more components fit on the line, the next one appears on the next line.
      • Each line is either left , right or center aligned using constants LEFT,RIGHT,CENER.
      • ii)Borderlayout
      • It implements a common layout style for top level windows which has four fixed width components at the edges and one large area in center that grows in two dimensions.
      • Each area named with areas North, South, East , West represents four sides and center is the middle area.
      • iii)GridLayout
      • It arranges all the components in a simple uniform grid
      • Constructer is used to define number of rows and columns in a panel layout.
      • Eg 3 X 3 grid with 8 components.
      • Insets
      • It is used to inset a panel so that it has a bored much like the horizantal and vertical gap in layout managers.
      • In order to cause a panel to have its edges inset, we should override the inset to return a new instance of Inset with four integer representing the width of the top, bottom, left and right edges.
      • public Insets insets(){
      • return new Insets(10,10,10,10);
      • }
      • CardLayout
      • Is unique from other layout managers in that it represents several different layouts that can be thought of as living on separate index cards that can be shuffled so that anyone card is on top at a given time.
      • Used for interfaces that have optional components which can be dynamically enabled and disabled upon user input.
      • Thank you
      • All