CC1007NI: Further Programming Week 6-7 Dhruba Sen Module Leader (Islington College)

Slides:



Advertisements
Similar presentations
Swing! Components and Images. Example Swing Components (also called “widgets”) Graphic from sun.com.
Advertisements

Java Software Development Paradigm Lecture # 12. Basics of GUI.
1 Chapter 8 Objects and Classes Lecture 2 Prepared by Muhanad Alkhalisy.
Graphical User Interfaces CS 2110 Spring Ivan Sutherland: “Sketchpad”,
Lecture 16: GUI programming JFrame windows (p.247) Containers and layout managers (p.290) Inheriting GUI components (p.330) Chapter 12: GUI programming.
Graphical User Interfaces (GUIs) GUI: An application that uses graphical objects to interact with users GUI applications consist of: –Events: A user or.
1 Lecture 11Lecture 14 Graphical User Interfaces (GUI) with AWT and Swing Overview  GUI Programming Issues.  GUI Programming in Java: Then and Now. 
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved L03 (Chapter 15) Creating.
Chapter 13: Advanced GUIs and Graphics J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program Design, Second Edition.
GUI Programming in Java Tim McKenna GUI Programming Concepts l conventional programming: sequence of operations is determined by the program.
CC1007NI: Further Programming Week 5 Dhruba Sen Module Leader (Islington College)
PROGRAMMING REVIEW Lab 2 EECS 448 Dr Fengjun Li and Meenakshi Mishra.
GUI Programming in Java
Chapter 13 Advanced GUIs and Graphics. Chapter Objectives Learn about applets Explore the class Graphics Learn about the class Font Explore the class.
CC1007NI: Further Programming Week 8-9 Dhruba Sen Module Leader (Islington College)
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington User Interface COMP 112 #30.
Combo Box, Check Boxes, and Radio Buttons. Radio Buttons User can click radio buttons, just like other buttons BUT Radio buttons are mutually exclusive.
Using Inheritance to Customize Frames Use inheritance for complex frames to make programs easier to understand Design a subclass of JFrame Store the components.
Java Programming: From Problem Analysis to Program Design, 4e Chapter 12 Advanced GUIs and Graphics.
Review Session for EXCEPTIONS & GUIS -David Gries 1 Adapted from Previous Review Slides.
Applets and Frames CS 21a: Introduction to Computing I First Semester,
Introduction to GUI in Java 1. Graphical User Interface Java is equipped with many powerful,easy to use GUI component such as input and output dialog.
By: Stag and Fish; Party Animals.  Radio buttons are a way of letting users choose only one option of a list.
GUI Components and Design Here we add one more component to our programs, JButtons –JButtons can only be inserted into JPanels (or JApplets) –Clicking.
Copyright © Curt Hill First Window Builder Program Easy GUIs in Eclipse.
MT311 Java Application Development and Programming Languages Li Tak Sing ( 李德成 )
1 Outline 1 Introduction 2 Overview of Swing Components 3 JLabel 4 Event Handling 5 TextFields 6 How Event Handling Works 7 JButton 8 JCheckBox and JRadioButton.
Dale Roberts GUI Programming using Java - GUI Components Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.
MT311 Java Application Development and Programming Languages Li Tak Sing ( 李德成 )
Layout Managers Arranges and lays out the GUI components on a container.
GUI Graphical User Interface. Outline Introduction Packages Components Layout Manager Events and Listeners Examples.
ITEC 109 Lecture 27 GUI. GUIs Review Sounds –Arrays hold sample values –Creating a keyboard –Sound effects Homework 3 –The big two –Due after break –Lab.
Java Applets: GUI Components, Events, Etc. Ralph Westfall June, 2010.
Applets and Frames. Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved L14: GUI Slide 2 Applets Usually.
GUI Programming using NetBeans. RHS – SOC 2 GUI construction We have previously talked about elements in a (simple) GUI –Frames, Panes and Dialogs –Text.
GUI Basics. What is GUI? A graphical user interface (GUI) is a type of user interface item that allows people to interact with programs in more ways than.
1 / 67 COP 3503 FALL 2012 SHAYAN JAVED LECTURE 14 Programming Fundamentals using Java 1.
1 Class 6. 2 Objectives Objectives Enable your applications to perform actions in response to JButton clicks Get the text the user enters in a textfield.
Class Class 20 Objectives Use JCheckbox, JRadioButton, and a JComboBox in a UID.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 15 Creating User.
Introduction to Java Chapter 9 - Graphical User Interfaces and Applets1 Chapter 9 Graphical User Interfaces and Applets.
GUI Basics. Agenda What GUI How to make in java Creating frames Frequently used GUI components Layout Managers.
Basics of GUI Programming Chapter 11 and Chapter 22.
Creating a Window. A basic window in Java is represented by an object of the class Window in the package java.awt.
Ajmer Singh PGT(IP) JAVA IDE Programming - I. Ajmer Singh PGT(IP) GUI (Graphical User Interface) It is an interface that uses a graphic entities along.
GUI Components CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
Sadegh Aliakbary Sharif University of Technology Fall 2011.
Computer Science [3] Java Programming II - Laboratory Course Lab 4 -1 : Introduction to Graphical user interface GUI Components Faculty of Engineering.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Chapter 7-3 ( Book Chapter 14) GUI and Event-Driven Programming.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 17.1 Test-Driving the Student Grades Application.
Event Handler Methods Text field Object Responder JAVA AWT Environment: Messages are sent between JAVA Objects Screen Event Notification Press Button.
1 Lecture 8: User Interface Components with Swing.
Introduction to GUI in 1 Graphical User Interface 3 Nouf Almunyif.
CIS 270—Application Development II Chapter 11—GUI Components: Part I.
GUIs & Event-Driven Programming Chapter 11 Review.
Prepared by: Dr. Abdallah Mohamed, AOU-KW Unit 6 Graphical user interfaces 1.
Christopher Budo, Davis Nygren, spencer franks, Luke miller
Lecture 16 More GUI programming
Advanced User Interfaces
Java GUI.
Graphical user interface with Swing by jose maria gonzalez pinto
Ellen Walker Hiram College
Chapter 13: Advanced GUIs and Graphics
GUIS: Graphical User Interfaces
Basic Elements of The GUI
Graphical User Interface
Chapter 7-3 (Book Chapter 14)
Tooltip -Radio Button.
Advanced Programming in Java
Advanced GUIs and Graphics
Presentation transcript:

CC1007NI: Further Programming Week 6-7 Dhruba Sen Module Leader (Islington College)

2.0

Overview Buttons Text fields Layout

Adding a button private JButton button; button = new JButton(“Press me!”); contentPane.add(button); button.addActionListener(this); String command = event.getActionCommand(); if (command.equals(“Press me!”)) {... }

Adding a text field private JTextField textField; textField = new JTextField(10); contentPane.add(textField); String inputText = textfield.getText(); textfield.setText(outputText);

Inputting numbers using a text field String inputText = textfield.getText(); int wholeNumber = Integer.parseInt(inputText); double decimal = Double.parseDouble(inputText);

Flow Layout Frame.setLayout(new FlowLayout()); Is a basic layout in which GUI components are placed in a left to right flow. For more precise arrangement: Frame.setLayout(null);.setBounds(x,y,width,height); E.g. btnsubmit.setBounds(5,5,100,25);

More Components JCheckBox JCheckBox(“ ”) Used for multiple selection at once.

More Components JRadioButton JRadioButton(“ ”) Used for single selection out of multiple options. For the same, button group must be created; ButtonGroup() Add radio buttons to the group. buttonGroup.add(RadioButton);

More Components JComboBox (Drop down menu) JComboBox() Array can also be added as menu items: JComboBox( ); To add (append) Items: comboBox.addItem(“ ”);

More Components JTextArea: Input box for more than one line of input. JTextArea(); Jtextarea.setLineWrap(true);

More Controls for frame FrameObject.setResizable(false); //true default FrameObject.setSize(,<height in pixels); FrameObject.setDefaultCloseOperation(JFrame.EXIT_ON_ CLOSE);

THANK YOU.