1 / 12

Introduction to GUI in

Introduction to GUI in. Graphical User Interface. Graphical User Interface. Java is equipped with many powerful ,easy to use GUI component such as input and output dialog boxes that you can use them to make your program attractive and user friendly

ralpht
Download Presentation

Introduction to GUI in

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. Introduction to GUI in Graphical User Interface Nouf Almunyif

  2. Graphical User Interface Java is equipped with many powerful ,easy to use GUI component such as input and output dialog boxes that you can use them to make your program attractive and user friendly GUI-based programs are implemented by using classes from the javax.swing and java.awt packages. Nouf Almunyif

  3. Using Dialog Boxes for Input/Output JOptionPanethis class is contained in the package javax.swing We will use two methods of this class : showInputDialog showMessageeDialog Nouf Almunyif

  4. ShowInputDialog General syntax Str= JOptionPane.showInputDialog(stringexpression); This method returns the input as a String value Example: str=JOptionPane.showInputDialog("Enter your name "); Nouf Almunyif

  5. showMessageeDialog General syntax JOptionPane.showMessageDialog(ParentComponent, message string, box title , msseg type); Example: JOptionPane.showMessageDialog(null,"Hello","Title", JOptionPane.INFORMATION_MESSAGE); Nouf Almunyif

  6. Messagee Type JOptionPane.showMessageDialog(null,"Hello","Title", JOptionPane. ????????????); ERROR_MESSAGE WARNING_MESSAGE INFORMATION_MESSAGE PLAIN_MESSAGE QUESTION_MESSAGE Nouf Almunyif

  7. Short form showMessageeDialog General syntax JOptionPane.showMessageDialog (ParentComponent, message string); Example: JOptionPane.showMessageDialog(null,"Hello"); Nouf Almunyif

  8. Example for adding two numbers Nouf Almunyif

  9. Nouf Almunyif

  10. Sample GUI Object Window Nouf Almunyif

  11. Creating a JFrame • a JFrame class have the following component: • JFrame(); JFrame(string Title); • setTitle(String title ); • setSize(intWedth , int length); • setVisible(booleanvar); • setLocation (FRAME_X_ORIGIN, FRAME_Y_ORIGIN) Nouf Almunyif

  12. Example Nouf Almunyif

More Related