1 / 44

Advance Java Programming

Advance Java Programming. Abstract Window Toolkit. Contains Classes and Methods. To create and manage windows. AWT Framework. Component Container Panel Window Frame. Diagram. Frame Constructor. Frame() Frame (String Title). Frame Methods. setSize (int width, int height) getSize ()

bmcclendon
Télécharger la présentation

Advance Java Programming

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Advance Java Programming

  2. Abstract Window Toolkit • Contains Classes and Methods. • To create and manage windows.

  3. AWT Framework • Component • Container • Panel • Window • Frame

  4. Diagram

  5. Frame Constructor • Frame() • Frame (String Title)

  6. Frame Methods • setSize (int width, int height) • getSize () • setTitle (String Title) • getTitle () • setVisible (boolean state)

  7. Color Constructor • Color (int r,int g,int b) Value of r,g,b must be in 0-255

  8. Color Methods • getRed () • getGreen () • getBlue ()

  9. Font • Font (String Fname, int style, int size) • getName() • getStyle() • getSize() • isPlain() • isItalic() • isBold()

  10. AWT Controls • Component • Layout Manager • Menu bar • add () • remove ()

  11. Label • Label () • Label (String str) • Label (String str, int Alignment) • setAlignment () • getAlignment () • setText () • getText ()

  12. Button • Button () • Button (String str) • setLabel(String str) • getLabel()

  13. Checkbox • Checkbox () • Checkbox (String str) • Checkbox (String str, Boolean state) • Checkbox (String str, Checkboxgroup, boolean state) • getLabel() • setLabel(String str) • setState(boolean State) • getState()

  14. CheckboxGroup CheckboxGroup() setSelectedCheckbox( Checkbox ch) getSelectedCheckbox()

  15. Choice • Choice() • add (String name) • getSelectedItem () • getSelectedIndex () • getItemCount () • select (String name/ int index) • getItem (int index) • remove (String name/int index) • removeAll () • Insert (String name, int index)

  16. List • List () • List (int noofrows) • List (no of rows, boolean multiselect)

  17. List Methods • add (String name) • getSelectedItem () • getSelectedIndex () • getItemCount () • select (String name/ int index) • getItem (int index) • remove (String name/int index) • removeAll () • Insert (String name, int index) • isIndexSelected (int index) • isMultipleMode() • setEnabled (boolean state) • makeVisible (boolean state) • replaceItem (string newname, int index) • getSelectedItems () • getSelectedIndexs ()

  18. TextField TextField () TextField (int noofcoloumn) TextField (String str) TextField (String str, int noofcoloumn) setText (String text) getText () select (int si, int ei) getSelectedText () getColumns () setEditable (boolean state) isEditable () setEchoChar (char ch) getEchoChar()

  19. TextArea • TextArea () • TextArea (int height, int width) • TextArea (String str) • TextArea (String str, int height, int width) • TextArea (String str, int height, int width, int sbars) • append (String str) • insert (String str, int index)

  20. Scrollbar • Scrollbar() • Scrollbar (int Style) • Scrollbar (int Style, int ivalue, int tsize, int min, int max) • setValues (int Style, int ivalue, int tsize, int min, int max) • getMinimum() • getMaximum() • getValue()

  21. MenuBar • MenuBar () • setMenuBar() • countMenus() • remove(int index/String Name) • getMenu(int index) • add(Menu m)

  22. Menu Menu() • Menu (String name) • add(MenuItem m) • addSeparator() • insertSeparator(int index) • getItemCount() • getItem(int index) • remove(int index) • removeAll() • Insert(MenuItem m, int index)

  23. MenuItem • MenuItem() • MenuItem(String name) • MenuItem(String name, MenuShortcut m) • setLabel(String name) • getLabel() • setEnabled(boolean value)

  24. CheckboxMenuItem • CheckboxMenuItem() • CheckboxMenuItem(String name) • CheckboxMenuItem(String name, boolean value)

  25. LayoutManager • Arrange Components • FlowLayout • BorderLayout • GridLayout • NullLayout • setLayout (Type of Layout)

  26. FlowLayout • FlowLayout() • FlowLayout(int alignment) • FlowLayout(int alignment,int hgap,int vgap) • setAlignment(int alignment) • getAlignment() • setVgap(int gap) • setHgap(int gap) • getHgap() • getVgap()

  27. BorderLayout • BorderLayout() • BorderLayout(int hgap, int vgap) • BorderLayout.CENTER • BorderLayout.NORTH • BorderLayout.EAST • BorderLayout.WEST • BorderLayout.SOUTH

  28. GridLayout • GridLayout() • GridLayout(int rows, int columns) • GridLayout(int rows, int columns, int hgap, int vgap) • setRows(int rows) • setColumns(int columns) • setHgap(int gap) • setVgap(int gap) • getVgap() • getHgap() • getRows() • getColumns()

  29. Null Layout • setBounds (int x, int y, int width, int height)

  30. Dialogbox • Top level window or sub window to take input from user • Modes: modal or modless • Dialog(Frame f) • Dialog(Frame f, String Title) • Dialog(Frame f, String Title, bolean mode) • show(), setVisible(), setTitle(), getTitle(), isModal(), setResizable(), getResizable()

  31. FileDialog • Top level window to load or save file • Modes: modal • FileDialog(Frame f) • FileDialog(Frame f, String Title) • FileDialog(Frame f, String Title, int operation) • show(), setVisible(), setTitle(), getTitle(), getDirectory(), getFile(), setDirectory(String path), setFile(String file)

  32. Event Handling • Applet are event driven program • Comes in java.awt.event.* package • Event • Event Source • Event Listener

  33. ActionListener • Applicable for Button,TextField, MenuItem • Event: ActionEvent • Method: actionPerformed() • getSource() • getActionCommand()

  34. ItemListener • Applicable for Checkbox, Radiobutton, Choice, List • Event: ItemEvent • Method: itemStateChanged() • getState()

  35. AdjustmentListener • Applicable for Scrollbar • Event: AdjustmentEvent • Method: adjustmentValueChanged() • getSource()

  36. ComponentListener • Applicable for all Component • Event: ComponentEvent • Method: componentHidden() • componentShown() • componentResized() * • componentMoved() *

  37. FocusListener • Applicable for All Components • Event: FocusEvent • Method: focusGained() • focusLost() • getComponent()

  38. TextListener • Applicable for TextField, TextArea • Event: TextEvent • Method: textValueChanged()

  39. ContainerListener • Applicable for Panel,Frame,Applet • Event: ContainerEvent • Method: componentAdded() • componentRemoved() • getChild()

  40. KeyListener • Applicable for All Components • Event: KeyEvent • Method: keyTyped() • keyPressed() • keyReleased()

  41. MouseListener • Applicable for All Components • Event: MouseEvent • Method: mouseEntered() • mouseExited() • mouseClicked() • mousePressed() • mouseReleased()

  42. WindowListener • Applicable for Frame • Event: WindowEvent • Method: windowOpened() • windowClosed() • windowClosing() • windowActivated() • windowDeactivated() • windowIconified() • windowDeiconified()

  43. MouseMotionListener • Applicable for AllComponents • Event: MouseEvent • Method: mouseMoved() • mouseDragged()

  44. AdapterClass Provide empty implementation of methods of listener It provide empty implementation of some or all methods of listener Class must extend adapterclass E.g MouseAdapter,MouseMotionAdapter KeyAdapter,FocusAdapter,ComponentAdapter,ContainerAdapter,

More Related