Advanced Java Class GUI, part 2. JComponent methods addXXXListener(XXXListener) repaint() – [optional arguments: delay and coordinates of sub-area to.

Slides:



Advertisements
Similar presentations
Components and Containers
Advertisements

Introduction to Java 2 Programming
Introduction to Computers Section 6A. home The Operating System (OS) The operating system (OS) is software that controls the interaction between hardware.
Chapter 11 Creating User Interfaces F What is JavaBean? F JComponent F JButton  ImageIcon  JLabel  JTextField  JTextArea  JComboBox  JList  JCheckBox.
Graphical User Interfaces (Part IV)
 The Java Foundation Classes (JFC) are a set of packages encompassing the following APIs:  Abstract Window Toolkit (AWT) : native GUI components  Swing.
User Interface Design CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
Fall 2007CS 225 Graphical User Interfaces Event Handling Appendix C.
 What are the basic GUI components we’ve learned so far? › JFrame › JPanel › JButton › JLabel › JTextArea › JTextField › JCheckBox › JRadioButton › Paint.
FIRST COURSE Getting Started with Microsoft Office 2007.
Chapter 6 Graphical User Interface (GUI) and Object-Oriented Design (OOD)
Lecture 15 Graphical User Interfaces (GUI’s). Objectives Provide a general set of concepts for GUI’s Layout manager GUI components GUI Design Guidelines.
FIRST COURSE Getting Started with Microsoft Office 2007.
CPSC150 Week 12 Graphical User Interfaces Chapter 11.
1 GUI Elements in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Scott Grissom, copyright 2006Ch 11: GUI Slide 1 Graphical User Interfaces (Ch 11) Careful design of a graphical user interface is key to a viable software.
GUI and Event-Driven Programming Part 2. Event Handling An action involving a GUI object, such as clicking a button, is called an event. The mechanism.
Graphical User Interface (GUI) Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
1 L46 Advanced GUI Component (1). 2 OBJECTIVES  To create and manipulate sliders, and menus,
CPSC150 Week 12 Graphical User Interfaces Chapter 11.
More on Creating GUIs in Java using Swing David Meredith Aalborg University.
CC1007NI: Further Programming Week 5 Dhruba Sen Module Leader (Islington College)
Graphic User Interfaces Part 1. Typical GUI Screen from Microsoft Word What GUI “components” can you see? –Menus? Buttons? Labels? What else? –Anything.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 13 Creating User.
CS377A: A Programming Approach to HCI Jan Borchers Spring Swing Refresher David Merrill 5/14/2002
Object Oriented Programming Ders 11: Interfaces Mustafa Emre İlal
3461A Readings from the Swing Tutorial. 3461A Overview  The follow is the Table of Contents from the trail “Creating a GUI with JFC/Swing” in the “The.
CSE 219 Patterns in Programming More Design Patterns.
GUI in Java. Graphical User Interface Graphical User Interface (GUI) –Gives program distinctive “look” and “feel” –Provides users with basic level of.
SWING. AbstractButton Swing Buttons are subclasses of the AbstractButton class, which extends JComponent. Abstract class javax.swing.AbstractButton AbstractButton.
Java Programming: Advanced Topics 1 Components and Facilities for Rich Graphical User Interfaces Chapter 7.
FIRST COURSE Getting Started with Microsoft Office 2007 COM111 Introduction to Computer Applications.
1 Java Swing - Lecture 2 Components and Containment Boriana Koleva
Object Oriented Programming Engr. M. Fahad Khan Lecturer, Software Engineering Department University of Engineering & Technology, Taxila.
Graphical User Interfaces (Part 2) 1. View  view  presents the user with a sensory (visual, audio, haptic) representation of the model state  a user.
CSE1030-HR GUI The Big Picture Building the View Building the Controller Separating the Concerns Going Further.
JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River,
CS324e - Elements of Graphics and Visualization Java GUIs - Event Handling.
University of Limerick1 Software Architecture Java Layout Managers.
3461A Widgets More GUI goo. 3461A Outline  What is a widget?  Buttons  Combo boxes  Tool bars  Text components  Sliders  Scrollbars.
CHAPTER:07 JAVA IDE PROGRAMMING-II Prepared By Prepared By : VINAY ALEXANDER ( विनय अलेक्सजेंड़र ) PGT(CS),KV JHAGRAKHAND.
CS1054: Lecture 21 - Graphical User Interface. Graphical User Interfaces vs. Text User Interface.
Swing / Session1 / 1 of 30 Module Introduction Distributed Computing in Java.
Swing Components. Introduction Swing – A set of GUI classes – Part of the Java's standard library –Much better than the previous library: AWT Abstract.
Swing - 2 Session 13. Swing - 2 / 2 of 38 Objectives (1) Discuss trees and tables Discuss progress bars Discuss MVC architecture Describe menus.
Swing. Introduction to Swing What is Swing? “ Swing is a diverse collection of lightweight components that can be used to build sophisticated user interfaces.”
5-Jan-16 R Ramesh Swing. 5-Jan-16 R Ramesh An Introduction to Java Foundation Classes (JFC) A suite of libraries to assist programmers create enterprise.
The Swing GUI Components Chapter 29 An enhanced alternative to AWT The PC does not need an appletviewer or browser Swing overcomes some AWT drawbacks.
Basics of GUI Programming Chapter 11 and Chapter 22.
1 Chapter 16: Creating Windows. 2 Basics of GUI Programming How to create a Window. TryWindow.java You always need a JFrame component before creating.
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.
Software Construction LAB 08 Java Programming with SWING GUI Builder.
Computer Science [3] Java Programming II - Laboratory Course Lab 4 -1 : Introduction to Graphical user interface GUI Components Faculty of Engineering.
Oct 091 Example Program DemoInputValidation1.java DemoInputValidation2.java.
Slides prepared by Rose Williams, Binghamton University ICS201 Lecture 15 : Swing III King Fahd University of Petroleum & Minerals College of Computer.
Lecture # 6 Graphical User Interface(GUI). Introduction A graphical user interface (GUI) presents a user- friendly mechanism for interacting with an application.
Chapter 10 - Writing Graphical User Interfaces1 Chapter 10 Writing Graphical User Interfaces.
View  view  presents the user with a sensory (visual, audio, haptic) representation of the model state  a user interface element (the user interface.
Menus Pull-downs and popups. Tooltips –a ToolTip is a context-sensitive text string that is displayed in a popup window when the mouse rests over a particular.
Objects First With Java A Practical Introduction Using BlueJ Building Graphical User Interfaces (GUIs) Week
CIS 270—Application Development II Chapter 11—GUI Components: Part I.
A Quick Java Swing Tutorial
Advanced User Interfaces
Graphical user interface with Swing by jose maria gonzalez pinto
Example Program DemoLowLevelEvents.java DemoHighLevelEvents.java
GUIS: Graphical User Interfaces
IFS410: Advanced Analysis and Design
CS Problem Solving and Object Oriented Programming Spring 2019
Java GUI programming with Swing
Presentation transcript:

Advanced Java Class GUI, part 2

JComponent methods addXXXListener(XXXListener) repaint() – [optional arguments: delay and coordinates of sub-area to repaint] setBackground(Color) setForeground(Color) setBorder(Border) setEnabled(boolean) setFont(Font) setPreferredSize(Dimension) & setSize(Dimension) setToolTipText(String) setVisible(boolean)

Containers Containers have Components inside them. The arrangement of the components is arranged by a LayoutManager. Some types of Containers: –Windows: top-level elements that may be placed anywhere on the screen. No menu bars or title bars. Frames: top-level windows that also have title bars and menu bars Dialog: gets information from user. –belongs to a Frame –can be modal or not (prevents other interaction with application while it’s open) –Panels: generic containers, which must be inside a window of some type.

Labels, Buttons, and Icons JLabels: shows some text AbstractButton –JButtons: push button with text label –JToggleButtons: stays down after one push, comes back up after another. Has text label. JCheckBox: usually more than one can be selected at a time. JRadioButton: placed in ButtonGroups so that only one may be selected at any given time. –JMenuItem: goes in a menu: see next slide ImageIcon: shows an icon

Menus JMenuBar: –goes at the top of a JFrame –contains menus JMenu: –goes in a JMenuBar –contains JMenuItems and JSeparators JMenuItem: –goes in a JMenu –can have an icon and/or a text label –you can set an Action on it (see slides on Actions) Two subtypes: JCheckBoxMenuItem & JRadioButtonMenuItem JPopUpMenu: a menu that is not tied to a MenuBar

Representing a range, rather than a fixed list of items Sliders: User can move a slider along a line to choose a value Spinners: User gets arrows to go through possible values ProgressBars: Shows percent progress, as in file down loads ScrollBars: Controls what part of contents is currently in the view.

Text Entry JTextField (for shorter amounts of text) –JPasswordField –JFormattedTextField JTextArea (for longer amounts of text) JTextPane (for longer amounts of text, with graphical mark up capabilities that JTextArea doesn’t have)

Complex Components Choosers: –JColorChooser: lets user pick a color –JFileChooser: lets user pick a file Data Structure Representations: –JTable: graphical representation of a table. –JTree: graphical representation of a tree structure. –Both have their own package and Model classes.

Printing java.awt.print.PrinterJob –to obtain one, call PrinterJob.getPrinterJob() –uses PageFormat objects to control formatting –uses Printable objects to do the printing –uses Pageable objects as documents –can print, cancel, setCopies, optionally give the user a dialog box, etc. (Don’t use old java.awt.PrinterJob class!)

Example No task here See the SwingExample class for a visual description of several of these GUI classes