1 GUI GUI GUI GUI GUI. GUI(Graphical User Interface) JDK java.awt. ? Component
|
|
- Gerard Little
- 5 years ago
- Views:
Transcription
1 GUI GUI JDK 1.1 GUI 1 GUI GUI GUI(Graphical User Interface) GUI (GUI ) / ( GUI ) Java GUI JDK Swing 1.1 java.awt GUI? Component setbounds(int, int, int, int) (x,y) setforeground(color) setbackground(color) setfont(font) 2 1
2 import java.applet.applet; import java.awt.*; public class R6Sample1 extends Applet { Font fn = new Font("Helvetica", Font.BOLD, 24); TextField txf = new TextField("text..."); Button b1 = new Button("B1"); Button b2 = new Button("B2"); setlayout(null); add(txf); txf.setforeground(color.red); txf.setbounds(20, 20, 200, 40); add(b1); b1.setfont(fn); b1.setbounds(20, 80, 60, 40); add(b2); b2.setfont(fn); b2.setbounds(120, 80, 60, 40); ( GUI ) init() Component add() setlayout(null) off ( ) ( ) ( ) Label Button Choice Checkbox CheckboxGroup TextField TextArea List Frame * MenuBar * Menu * PopupMenu * 1 2 (API ) * 3 GUI ( ) GUI Java a. 2
3 b. ( ) c. ( ) d. 2 ( ) GUI???? JDK Java JDK 1.1 GUI addactionlistener(actionlistner) ActionListener ActionListener actionperformed(actionevent) ActionListener implements actionperformed() GUI addactionlistener() GUI * import java.applet.applet; import java.awt.*; import java.awt.event.*; public class R6Sample2 extends Applet { Font fn = new Font("Helvetica", Font.BOLD, 16); Label l1 = new Label("*"); Button b1 = new Button("Press Me!"); setlayout(null); l1.setbackground(color.white); add(l1); l1.setfont(fn); l1.setbounds(20, 20, 160, 40); add(b1); b1.setfont(fn); b1.setbounds(20, 80, 100, 40); b1.addactionlistener(new R6Sample2Adapter(this)); public void press() { l1.settext(l1.gettext() + "*"); repaint(); class R6Sample2Adapter implements ActionListener { R6Sample2 app; public R6Sample2Adapter(R6Sample2 a) { app = a; public void actionperformed(actionevent e) { app.press(); 3
4 R6Sample2Adapter actionperformed() press() addactionlistener() press() * R6Sample2 ActionListener implements?? 3 ( ) import java.applet.applet; import java.awt.*; import java.awt.event.*; public class R6Sample3 extends Applet { Font fn = new Font("Helvetica", Font.BOLD, 16); Label l1 = new Label("*"); Button b1 = new Button("Press Me!"); setlayout(null); l1.setbackground(color.white); add(l1); l1.setfont(fn); l1.setbounds(20, 20, 160, 40); add(b1); b1.setfont(fn); b1.setbounds(20, 80, 100, 40); b1.addactionlistener(new MyAdapter()); class MyAdapter implements ActionListener { public void actionperformed(actionevent e) { l1.settext(l1.gettext() + "*"); repaint();?! implements 1 4
5 class MyXXXClass extends/implements YYY { //... new MyXXXClass( )... new MyXXXClass ( )... new YYY( ) { //... new import java.applet.applet; import java.awt.*; import java.awt.event.*; public class R6Sample4 extends Applet { Font fn = new Font("Helvetica", Font.BOLD, 16); Label l1 = new Label("*"); Button b1 = new Button("Press Me!"); setlayout(null); l1.setbackground(color.white); add(l1); l1.setfont(fn); l1.setbounds(20, 20, 160, 40); add(b1); b1.setfont(fn); b1.setbounds(20, 80, 100, 40); b1.addactionlistener(new ActionListener() { public void actionperformed(actionevent e) { l1.settext(l1.gettext() + "*"); repaint(); ); GUI ( 1 (1) implements GUI 5
6 1: interface R6Model { public String gettitle(); public String getbutton1label(); public String getbutton2label(); public String button1action(string s); public String button2action(string s); implements / class R6Sample5Model implements R6Model { public String gettitle() { return "Temperature Calc."; public String getbutton1label() { return "F to C"; public String getbutton2label() { return "C to F"; public String button1action(string s) { try { double f = new Double(s).doubleValue(); double c = 5.0*(f )/9.0; return (new Double(c)).toString(); catch(exception e) { return e.tostring(); public String button2action(string s) { try { double c = new Double(s).doubleValue(); double f = 9.0*c/ ; return (new Double(f)).toString(); catch(exception e) { return e.tostring(); import java.applet.applet; 6
7 import java.awt.*; import java.awt.event.*; public class R6Sample5 extends Applet { R6Model model = new R6Sample5Model(); Font fn = new Font("Helvetica", Font.BOLD, 16); Label l1 = new Label(model.getTitle()); Label l2 = new Label(""); TextField tf = new TextField(""); Button b1 = new Button(model.getButton1Label()); Button b2 = new Button(model.getButton2Label()); setlayout(null); l2.setbackground(color.white); add(l1); l1.setfont(fn); l1.setbounds(20, 10, 160, 40); add(l2); l2.setfont(fn); l2.setbounds(20, 60, 160, 40); add(tf); tf.setfont(fn); tf.setbounds(20, 110, 160, 40); add(b1); b1.setfont(fn); b1.setbounds(20, 160, 80, 40); add(b2); b2.setfont(fn); b2.setbounds(120, 160, 80, 40); b1.addactionlistener(new ActionListener() { public void actionperformed(actionevent e) { l2.settext(model.button1action(tf.gettext())); tf.settext(""); repaint(); ); b2.addactionlistener(new ActionListener() { public void actionperformed(actionevent e) { l2.settext(model.button2action(tf.gettext())); tf.settext(""); repaint(); ); interface R6Model { public String gettitle(); public String getbutton1label(); public String getbutton2label(); public String button1action(string s); public String button2action(string s); class R6Sample5Model implements R6Model { public String gettitle() { return "Temperature Calc."; public String getbutton1label() { return "F to C"; public String getbutton2label() { return "C to F"; public String button1action(string s) { try { double f = new Double(s).doubleValue(); 7
8 double c = 5.0*(f )/9.0; return (new Double(c)).toString(); catch(exception e) { return e.tostring(); public String button2action(string s) { try { double c = new Double(s).doubleValue(); double f = 9.0*c/ ; return (new Double(f)).toString(); catch(exception e) { return e.tostring(); (R6Model ) 5 6 ( : )
) / Java ( )
2002 3 2003.1.29 1 3 ( ) ( ) / Java ( ) 1 ( )? ( ) 2 (3 ) 3 Java Java Java (dynamic dispatch) ( ) import java.awt.*; import java.awt.event.*; public class Sample30 extends Frame { boolean go; double time;
More informationISO-2022-JP (JIS ) 1 2. (Windows95/98 MacOS ) Java UNICODE UNICODE. Java. .java.java.txt native2ascii. .java
2000 8 2000.1.24-27 0 4 1 ( (1 8 ) ASCII 1 8 1 1 8 2 ISO-2022-JP (JIS ) 1 2 EUC ( EUC) 8 Unix SJIS (MS ) EUC 8 ( (Windows95/98 MacOS Java UNICODE UNICODE ( Java.java.java.txt native2ascii.java native2ascii
More informationJava - Applets. C&G criteria: 1.2.2, 1.2.3, 1.2.4, 1.3.4, 1.2.4, 1.3.4, 1.3.5, 2.2.5, 2.4.5, 5.1.2, 5.2.1,
Java - Applets C&G criteria: 1.2.2, 1.2.3, 1.2.4, 1.3.4, 1.2.4, 1.3.4, 1.3.5, 2.2.5, 2.4.5, 5.1.2, 5.2.1, 5.3.2. Java is not confined to a DOS environment. It can run with buttons and boxes in a Windows
More informationGUI. interface. CUI Character-Based User Interface Command-Based User Interface GUI. Graphical User Interface GUI. Frame Frame.
JavaGUI I interface ] CUI Character-Based User Interface Command-Based User Interface GUI Graphical User Interface GUI GUI 1. ( ) 2. Frame Frame Frameextends ::= [public] class {[ ] [ ] ::= [extends ]
More informationJava - Applets. public class Buttons extends Applet implements ActionListener
Java - Applets Java code here will not use swing but will support the 1.1 event model. Legacy code from the 1.0 event model will not be used. This code sets up a button to be pushed: import java.applet.*;
More informationJava Applet Basics. Life cycle of an applet:
Java Applet Basics Applet is a Java program that can be embedded into a web page. It runs inside the web browser and works at client side. Applet is embedded in a HTML page using the APPLET or OBJECT tag
More information(listener)... MouseListener, ActionLister. (adapter)... MouseAdapter, ActionAdapter. java.awt AWT Abstract Window Toolkit GUI
51 6!! GUI(Graphical User Interface) java.awt javax.swing (component) GUI... (container) (listener)... MouseListener, ActionLister (adapter)... MouseAdapter, ActionAdapter 6.1 GUI(Graphics User Interface
More informationJava Applets / Flash
Java Applets / Flash Java Applet vs. Flash political problems with Microsoft highly portable more difficult development not a problem less so excellent visual development tool Applet / Flash good for:
More informationMIT AITI Swing Event Model Lecture 17
MIT AITI 2004 Swing Event Model Lecture 17 The Java Event Model In the last lecture, we learned how to construct a GUI to present information to the user. But how do GUIs interact with users? How do applications
More information1.1 GUI. JFrame. import java.awt.*; import javax.swing.*; public class XXX extends JFrame { public XXX() { // XXX. init() main() public static
18 7 17 1 1.1 GUI ( ) GUI ( ) JFrame public class XXX extends JFrame { public XXX() { // XXX // init()... // ( )... init() main() public static public class XXX extends JFrame { public XXX() { // setsize(,
More informationWhat Is an Event? Some event handler. ActionEvent. actionperformed(actionevent e) { }
CBOP3203 What Is an Event? Events Objects that describe what happened Event Sources The generator of an event Event Handlers A method that receives an event object, deciphers it, and processes the user
More informationJava. GUI building with the AWT
Java GUI building with the AWT AWT (Abstract Window Toolkit) Present in all Java implementations Described in most Java textbooks Adequate for many applications Uses the controls defined by your OS therefore
More informationChapter #1. Program to demonstrate applet life cycle
Chapter #1. Program to demonstrate applet life cycle import java.applet.applet; import java.awt.*; public class LifeCycle extends Applet{ public void init(){ System.out.println(" init()"); public void
More informationThe AWT Event Model 9
The AWT Event Model 9 Course Map This module covers the event-based GUI user input mechanism. Getting Started The Java Programming Language Basics Identifiers, Keywords, and Types Expressions and Flow
More informationProgramming Mobile Devices J2SE GUI
Programming Mobile Devices J2SE GUI University of Innsbruck WS 2009/2010 thomas.strang@sti2.at Graphical User Interface (GUI) Why is there more than one Java GUI toolkit? AWT write once, test everywhere
More informationThe AWT Component Library 10
The AWT Component Library 10 Course Map The JDK offers many components from which GUIs an be built. This module examines these AWT Components, and covers noncomponent AWT classes such as Color and Font,
More informationUser interfaces and Swing
User interfaces and Swing Overview, applets, drawing, action listening, layout managers. APIs: java.awt.*, javax.swing.*, classes names start with a J. Java Lectures 1 2 Applets public class Simple extends
More informationJAVA PROGRAM EXAMPLE WITH OUTPUT PDF
JAVA PROGRAM EXAMPLE WITH OUTPUT PDF Created By: Umar Farooque Khan 1 How to compile and run java programs Compile: - javac JavaFileName Run Java: - java JavaClassName Let s take an example of java program:
More informationCOMPSCI 230. Software Design and Construction. Swing
COMPSCI 230 Software Design and Construction Swing 1 2013-04-17 Recap: SWING DESIGN PRINCIPLES 1. GUI is built as containment hierarchy of widgets (i.e. the parent-child nesting relation between them)
More informationJava Applet & its life Cycle. By Iqtidar Ali
Java Applet & its life Cycle By Iqtidar Ali Java Applet Basic An applet is a java program that runs in a Web browser. An applet can be said as a fully functional java application. When browsing the Web,
More informationDUKE UNIVERSITY Department of Computer Science. Midterm Solutions
DUKE UNIVERSITY Department of Computer Science CPS 001 Fall 2001 J. Forbes Midterm Solutions PROBLEM 1 : (Quick Ones (4 points)) A. Give an example of a variable declaration. int a; B. Given that you wrote
More informationAn Introduction To Graphical User Interfaces
An Introduction To Graphical User Interfaces The event-driven model Building simple graphical user interfaces (GUI s) in Java Note: GUI Code Cannot Be Run Through A Text- Only Connection: SSH [csb exampletwo
More informationDEMONSTRATION OF AWT CONTROLS
Ex.No: 1(A) DATE: 02.07.11 DEMONSTRATION OF AWT CONTROLS Aim: To write a java program for demonstrating the following AWT controls 1. Button 2.Checkbox 3.Choice 4.List 5.TextField 6.Scrollbar Hardware
More informationIntroduction. Introduction
Introduction Many Java application use a graphical user interface or GUI (pronounced gooey ). A GUI is a graphical window or windows that provide interaction with the user. GUI s accept input from: the
More informationEVENTS, EVENT SOURCES AND LISTENERS
Java Programming EVENT HANDLING Arash Habibi Lashkari Ph.D. Candidate of UTM University Kuala Lumpur, Malaysia All Rights Reserved 2010, www.ahlashkari.com EVENTS, EVENT SOURCES AND LISTENERS Important
More informationAn Introduction To Graphical User Interfaces
An Introduction To Graphical User Interfaces The event-driven model Building simple graphical interfaces in Java Components They are all types of graphical controls and displays available: Button, Canvas,
More informationASSIGNMENT NO 14. Objectives: To learn and demonstrated use of applet and swing components
Create an applet with three text Fields and four buttons add, subtract, multiply and divide. User will enter two values in the Text Fields. When any button is pressed, the corresponding operation is performed
More informationUnit 1- Java Applets. Applet Programming. Local Applet and Remote Applet ** Applet and Application
Applet Programming Applets are small Java applications that can be accessed on an Internet server, transported over Internet, and can be automatically installed and run as a part of a web document. An
More informationGracefulness of TP-Tree with Five Levels Obtained by Java Programming
International Journal of Scientific and Research Publications, Volume 2, Issue 12, December 2012 1 Gracefulness of TP-Tree with Five Levels Obtained by Java Programming A.Solairaju 1, N. Abdul Ali 2 and
More informationGUI in Java TalentHome Solutions
GUI in Java TalentHome Solutions AWT Stands for Abstract Window Toolkit API to develop GUI in java Has some predefined components Platform Dependent Heavy weight To use AWT, import java.awt.* Calculator
More informationJava - Dates and Threads
Java - Dates and Threads Thread example Java uses threads to allow 1 event to break into another. If an action is to occur a number of times with a loop or to occur until some condition is satisfied then
More informationCHAPTER 2. Java Overview
Networks and Internet Programming (0907522) CHAPTER 2 Java Overview Instructor: Dr. Khalid A. Darabkh Objectives The objectives of this chapter are: To discuss the classes present in the java.awt package
More informationPackages: Putting Classes Together
Packages: Putting Classes Together 1 Introduction 2 The main feature of OOP is its ability to support the reuse of code: Extending the classes (via inheritance) Extending interfaces The features in basic
More informationG51PRG: Introduction to Programming Second semester Applets and graphics
G51PRG: Introduction to Programming Second semester Applets and graphics Natasha Alechina School of Computer Science & IT nza@cs.nott.ac.uk Previous two lectures AWT and Swing Creating components and putting
More informationChapter 1 GUI Applications
Chapter 1 GUI Applications 1. GUI Applications So far we've seen GUI programs only in the context of Applets. But we can have GUI applications too. A GUI application will not have any of the security limitations
More informationModule 5 The Applet Class, Swings. OOC 4 th Sem, B Div Prof. Mouna M. Naravani
Module 5 The Applet Class, Swings OOC 4 th Sem, B Div 2016-17 Prof. Mouna M. Naravani The Applet Class Types of Applets (Abstract Window Toolkit) Offers richer and easy to use interface than AWT. An Applet
More informationGraphical Interfaces
Weeks 9&11 Graphical Interfaces All the programs that you have created until now used a simple command line interface, which is not user friendly, so a Graphical User Interface (GUI) should be used. The
More informationTopic 9: Swing. Swing is a BIG library Goal: cover basics give you concepts & tools for learning more
Swing = Java's GUI library Topic 9: Swing Swing is a BIG library Goal: cover basics give you concepts & tools for learning more Assignment 5: Will be an open-ended Swing project. "Programming Contest"
More informationTopic 9: Swing. Why are we studying Swing? GUIs Up to now: line-by-line programs: computer displays text user types text. Outline. 1. Useful & fun!
Swing = Java's GUI library Topic 9: Swing Swing is a BIG library Goal: cover basics give you concepts & tools for learning more Why are we studying Swing? 1. Useful & fun! 2. Good application of OOP techniques
More informationDay before tests of Java Final test. IDM institution of Bandarawela. Project for department of education
Day before tests of Java Final test. IDM institution of Bandarawela Project for department of education import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Doenets extends JApplet
More informationJava - Applications. The following code sets up an application with a drop down menu, as yet the menu does not do anything.
Java - Applications C&G Criteria: 5.3.2, 5.5.2, 5.5.3 Java applets require a web browser to run independently of the Java IDE. The Dos based console applications will run outside the IDE but have no access
More informationDecisions: Logic Java Programming 2 Lesson 7
Decisions: Logic Java Programming 2 Lesson 7 In the Java 1 course we learned about if statements, which use booleans (true or false) to make decisions. In this lesson, we'll dig a little deeper and use
More informationDCS235 Software Engineering Exercise Sheet 2: Introducing GUI Programming
Prerequisites Aims DCS235 Software Engineering Exercise Sheet 2: Introducing GUI Programming Version 1.1, October 2003 You should be familiar with the basic Java, including the use of classes. The luej
More informationAn array is a type of variable that is able to hold more than one piece of information under a single variable name.
Arrays An array is a type of variable that is able to hold more than one piece of information under a single variable name. Basically you are sub-dividing a memory box into many numbered slots that can
More informationJApplet. toy example extends. class Point { // public int x; public int y; } p Point 5.2. Point. Point p; p = new Point(); instance,
35 5 JApplet toy example 5.1 2 extends class Point { // public int x; public int y; Point x y, 5.2 Point int Java p Point Point p; p = new Point(); Point instance, p Point int 2 36 5 Point p = new Point();
More informationJava JavaBeans JavaBeans Builder (vitsual) Java JavaBeans JavaBeans http://java.sun.com/j2se/1.3/ja/docs/ja/guide/beans/ http://java.sun.com/products/javabeans/software/bdk_download.html Beans Development
More information/* Write a Program implementing GUI based Calculator using Swing */
/* Write a Program implementing GUI based Calculator using Swing */ import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.*; public class Calculator extends JFrame
More informationProgramming Language Concepts: Lecture 8
Programming Language Concepts: Lecture 8 Madhavan Mukund Chennai Mathematical Institute madhavan@cmi.ac.in http://www.cmi.ac.in/~madhavan/courses/pl2009 PLC 2009, Lecture 8, 11 February 2009 GUIs and event
More informationModule 5 The Applet Class, Swings. OOC 4 th Sem, B Div Prof. Mouna M. Naravani
Module 5 The Applet Class, Swings OOC 4 th Sem, B Div 2017-18 Prof. Mouna M. Naravani The Applet Class Types of Applets (Abstract Window Toolkit) Offers richer and easy to use interface than AWT. An Applet
More informationOutline. Topic 9: Swing. GUIs Up to now: line-by-line programs: computer displays text user types text AWT. A. Basics
Topic 9: Swing Outline Swing = Java's GUI library Swing is a BIG library Goal: cover basics give you concepts & tools for learning more Assignment 7: Expand moving shapes from Assignment 4 into game. "Programming
More informationExample 3-1. Password Validation
Java Swing Controls 3-33 Example 3-1 Password Validation Start a new empty project in JCreator. Name the project PasswordProject. Add a blank Java file named Password. The idea of this project is to ask
More informationClass 16: The Swing Event Model
Introduction to Computation and Problem Solving Class 16: The Swing Event Model Prof. Steven R. Lerman and Dr. V. Judson Harward 1 The Java Event Model Up until now, we have focused on GUI's to present
More informationWeek 9. Abstract Classes
Week 9 Abstract Classes Interfaces Arrays (Assigning, Passing, Returning) Multi-dimensional Arrays Abstract Classes Suppose we have derived Square and Circle subclasses from the superclass Shape. We may
More informationSwing - JButton. Adding buttons to the main window
Swing - JButton Adding buttons to the main window An empty JFrame is not very useful // In some GUI class: window = new JFrame("Window example"); window.setsize(800,600); window.setdefaultcloseoperation(jframe.exit_on_close);
More informationDEMYSTIFYING PROGRAMMING: CHAPTER SIX METHODS (TOC DETAILED) CHAPTER SIX: METHODS 1
DEMYSTIFYING PROGRAMMING: CHAPTER SIX METHODS (TOC DETAILED) CHAPTER SIX: METHODS 1 Objectives 1 6.1 Methods 1 void or return 1 Parameters 1 Invocation 1 Pass by value 1 6.2 GUI 2 JButton 2 6.3 Patterns
More informationSD Module-1 Advanced JAVA
Assignment No. 4 SD Module-1 Advanced JAVA R C (4) V T Total (10) Dated Sign Title: Transform the above system from command line system to GUI based application Problem Definition: Write a Java program
More informationPart 3: Graphical User Interface (GUI) & Java Applets
1,QWURGXFWLRQWR-DYD3URJUDPPLQJ (( Part 3: Graphical User Interface (GUI) & Java Applets EE905-GUI 7RSLFV Creating a Window Panels Event Handling Swing GUI Components ƒ Layout Management ƒ Text Field ƒ
More informationSD Module-1 Advanced JAVA. Assignment No. 4
SD Module-1 Advanced JAVA Assignment No. 4 Title :- Transform the above system from command line system to GUI based application Problem Definition: Write a Java program with the help of GUI based Application
More informationProgramming graphics
Programming graphics Need a window javax.swing.jframe Several essential steps to use (necessary plumbing ): Set the size width and height in pixels Set a title (optional), and a close operation Make it
More informationThe AWT Package, An Overview
Richard G Baldwin (512) 223-4758, baldwin@austin.cc.tx.us, http://www2.austin.cc.tx.us/baldwin/ The AWT Package, An Overview Java Programming, Lecture Notes # 110, Revised 02/21/98. Preface Introduction
More informationExtra Credit Lab. Your job is to catch any syntax errors a user might make. Two examples follow. In the panel on the left the user has used
Extra Credit Lab The object of this lab is to write an applet that will take a string and check to see that it is a well defined polynomial in x. A polynomial in x, recall, is an expression of the form
More informationDatenbank-Praktikum. Universität zu Lübeck Sommersemester 2006 Lecture: Swing. Ho Ngoc Duc 1
Datenbank-Praktikum Universität zu Lübeck Sommersemester 2006 Lecture: Swing Ho Ngoc Duc 1 Learning objectives GUI applications Font, Color, Image Running Applets as applications Swing Components q q Text
More informationCORBA Java. Java. Java. . Java CORBA. Java CORBA (RMI) CORBA ORB. . CORBA. CORBA Java
CORBA Java?? OMG CORBA IDL C, C++, SmallTalk, Ada Java COBOL, ORB C Ada Java C++ CORBA Java CORBA Java (RMI) JDK12 Java CORBA ORB CORBA,, CORBA? CORBA,,, CORBA, CORBA CORBA Java (, ) Java CORBA Java :
More informationDEMYSTIFYING PROGRAMMING: CHAPTER FOUR
DEMYSTIFYING PROGRAMMING: CHAPTER FOUR Chapter Four: ACTION EVENT MODEL 1 Objectives 1 4.1 Additional GUI components 1 JLabel 1 JTextField 1 4.2 Inductive Pause 1 4.4 Events and Interaction 3 Establish
More informationJava Event Handling -- 1
Java Event Handling -- 1 Event Handling Happens every time a user interacts with a user interface. For example, when a user pushes a button, or types a character. 2 A Typical Situation: Scrollbar AWTEvent
More informationVinayaka Missions University
Vinayaka Missions University VMKV Engineering College Salem - 636308. Department of Computer Science & Software Engineering [CSSE] LAB MANUAL JAVA PROGRAMMING (V Semester) Prepared by A.RAMESH KUMAR List
More informationCPS122 Lecture: Graphical User Interfaces and Event-Driven Programming
CPS122 Lecture: Graphical User Interfaces and Event-Driven Programming Objectives: Last revised 1/15/10 1. To introduce the notion of a component and some basic Swing components (JLabel, JTextField, JTextArea,
More informationSolution register itself
Observer Pattern Context: One object (the Subject) is the source of events. Other objects (Observers) want to know when an event occurs. Or: several objects should be immediately updated when the state
More informationJava Swing. based on slides by: Walter Milner. Java Swing Walter Milner 2005: Slide 1
Java Swing based on slides by: Walter Milner Java Swing Walter Milner 2005: Slide 1 What is Swing? A group of 14 packages to do with the UI 451 classes as at 1.4 (!) Part of JFC Java Foundation Classes
More informationB.Sc (Computer Science) Object Oriented Programming with Java and Data Structures Lab Programs
B.Sc (Computer Science) Object Oriented Programming with Java and Data Structures Lab Programs 1 1. Write a java program to determine the sum of the following harmonic series for a given value of n. 1+1/2+1/3+...
More informationOriginal GUIs. IntroGUI 1
Original GUIs IntroGUI 1 current GUIs IntroGUI 2 Why GUIs? IntroGUI 3 Computer Graphics technology enabled GUIs and computer gaming. GUI's were 1985 breakout computer technology. Without a GUI there would
More informationCS335 Graphics and Multimedia
CS335 Graphics and Multimedia Fuhua (Frank) Cheng Department of Computer Science University of Kentucky Lexington, KY 40506-0046 -2-1. Programming Using JAVA JAVA history: WHY JAVA? Simple Objected-oriented
More informationAn applet is a program written in the Java programming language that can be included in an HTML page, much in the same way an image is included in a
CBOP3203 An applet is a program written in the Java programming language that can be included in an HTML page, much in the same way an image is included in a page. When you use a Java technology-enabled
More informationGUI DYNAMICS Lecture July 26 CS2110 Summer 2011
GUI DYNAMICS Lecture July 26 CS2110 Summer 2011 GUI Statics and GUI Dynamics 2 Statics: what s drawn on the screen Components buttons, labels, lists, sliders, menus,... Containers: components that contain
More informationInterfaces: Listeners and Adapters Java Programming 3 Lesson 6
Interfaces: Listeners and Adapters Java Programming 3 Lesson 6 Interfaces in Java In previous lessons, we discussed classes and subclasses, and the way inheritance works within them. Java allows only single
More informationThe Java Programming Language Basics. Identifiers, Keywords, and Types. Expressions and Flow Control. Object-Oriented Programming. Objects and Classes
Building GUIs 8 Course Map This module covers setup and layout of graphical user interfaces. It introduces the Abstract Windowing Toolkit, a package of classes from which GUIs are built. Getting Started
More informationJava Graphical User Interfaces AWT (Abstract Window Toolkit) & Swing
Java Graphical User Interfaces AWT (Abstract Window Toolkit) & Swing Rui Moreira Some useful links: http://java.sun.com/docs/books/tutorial/uiswing/toc.html http://www.unix.org.ua/orelly/java-ent/jfc/
More informationGraphical Interfaces
Weeks 11&12 Graphical Interfaces All the programs that you have created until now used a simple command line interface, which is not user friendly, so a Graphical User Interface (GUI) should be used. The
More informationUNIT-V. There are two sets of Java APIs for graphics programming: AWT (Abstract Windowing Toolkit) and Swing.
UNIT-V Programming Graphical User Interface (GUI) 1. Introduction We can create high-level abstract data types called classes to mimic real-life things and represent entities in the problem space. These
More informationMODULE 8p - Applets - Trials B
MODULE 8p - Applets - Trials B The applet to be developed in this series of trials is called AppletB. The first version is a simple modification of AppletA but should be saved in AppletB.java import java.applet.applet;
More informationimport javax.swing.*; public class Sample { JFrame f; Sample(){ f=new JFrame(); JButton b=new JButton("click"); b.setbounds(130,100,100, 40); f.add(b); f.setsize(400,500); f.setlayout(null); f.setvisible(true);
More informationกล ม API ท ใช. Programming Graphical User Interface (GUI) Containers and Components 22/05/60
กล ม API ท ใช Programming Graphical User Interface (GUI) AWT (Abstract Windowing Toolkit) และ Swing. AWT ม ต งต งแต JDK 1.0. ส วนมากจะเล กใช และแทนท โดยr Swing components. Swing API ปร บปร งความสามารถเพ
More informationJavaBeans. JavaBeans. Java. Java JavaBeans. JavaBeans. JavaBeans GUI. JavaBeans Builder (vitsual) Java. JavaBeans. Beans. Builder.
JavaBeans Java JavaBeans JavaBeansBuilder (vitsual) Java JavaBeans JavaBeans Builder Java JavaBeans BeansJava JavaBeans Beans Java GUI JavaJDK(Java Development Kit) Abstract Window Toolkit(AWT)AWT window
More informationThe Abstract Window Toolkit
Chapter 12 The Abstract Window Toolkit 1 12.1 Overview Java s Abstract Window Toolkit provides classes and other tools for building programs that have a graphical user interface. The term Abstract refers
More informationSwing from A to Z Some Simple Components. Preface
By Richard G. Baldwin baldwin.richard@iname.com Java Programming, Lecture Notes # 1005 July 31, 2000 Swing from A to Z Some Simple Components Preface Introduction Sample Program Interesting Code Fragments
More informationH212 Introduction to Software Systems Honors
Introduction to Software Systems Honors Lecture #19: November 4, 2015 1/14 Third Exam The third, Checkpoint Exam, will be on: Wednesday, November 11, 2:30 to 3:45 pm You will have 3 questions, out of 9,
More informationUnit 7: Event driven programming
Faculty of Computer Science Programming Language 2 Object oriented design using JAVA Dr. Ayman Ezzat Email: ayman@fcih.net Web: www.fcih.net/ayman Unit 7: Event driven programming 1 1. Introduction 2.
More informationAdding Buttons to StyleOptions.java
Adding Buttons to StyleOptions.java The files StyleOptions.java and StyleOptionsPanel.java are from Listings 5.14 and 5.15 of the text (with a couple of slight changes an instance variable fontsize is
More informationJava.net - the Source for Java(tm) Technology Collaboration
java.net > All Articles > http://today.java.net/pub/a/today/2006/02/21/building-guis-with-swixml.html Building GUIs with SwiXml by Joshua Marinacci 02/21/2006 Contents The Layout Problem What is SwiXml?
More informationAgenda. Programming Seminar. By: dr. Amal Khalifa. Coordinate systems Colors Fonts Drawing shapes Graphics2D API
Agenda Coordinate systems Colors Fonts Drawing shapes Graphics2D API By: dr. Amal Khalifa 1 Programming Seminar @12:30 13:30 pm on Wednesday 9/4/2014 Location : 2.505.01 Painting components 2 Every component
More informationJLayeredPane. Depth Constants in JLayeredPane
JLayeredPane Continuing on Swing Components A layered pane is a Swing container that provides a third dimension for positioning components depth or Z order. The class for the layered pane is JLayeredPane.
More informationContents Introduction 1
SELF-STUDY iii Introduction 1 Course Purpose... 1 Course Goals...1 Exercises... 2 Scenario-Based Learning... 3 Multimedia Overview... 3 Assessment... 3 Hardware and Software Requirements... 4 Chapter 1
More informationUsing the API: Introductory Graphics Java Programming 1 Lesson 8
Using the API: Introductory Graphics Java Programming 1 Lesson 8 Using Java Provided Classes In this lesson we'll focus on using the Graphics class and its capabilities. This will serve two purposes: first
More informationCalculator Class. /** * Create a new calculator and show it. */ public Calculator() { engine = new CalcEngine(); gui = new UserInterface(engine); }
A Calculator Project This will be our first exposure to building a Graphical User Interface (GUI) in Java The functions of the calculator are self-evident The Calculator class creates a UserInterface Class
More informationAim: Write a java program to demonstrate the use of following layouts. 1.FlowLayout 2.BorderLayout 3.GridLayout 4.GridBagLayout 5.
DEMONSTRATION OF LAYOUT MANAGERS DATE:09.07.11 Aim: Write a java program to demonstrate the use of following layouts. 1.FlowLayout 2.BorderLayout 3.GridLayout 4.GridBagLayout 5.CardLayout Hardware requirements:
More informationThe Final One. Case Study: Adding a GUI to the Student Data Base. Graphical Use Interfaces: the student database example. Assignments.
The Final One Graphical Use Interfaces: the student database example. Assignments. Module questionnaire. Looking back... 1 2-1 Case Study: Adding a GUI to the Student Data Base Problem. We want to add
More informationGraphics JFrame. import java.awt.*; import javax.swing.*; public class XXX extends JFrame { public XXX() { ... main() public static
Graphics 2006.11.22 1 1.1 javax.swing.* JFrame JFrame public class XXX extends JFrame { public XXX() { //... // ( )... main() public static public class XXX extends JFrame { public XXX() { setdefaultcloseoperation(jframe.exit_on_close);
More informationTecniche di Progettazione: Design Patterns
Tecniche di Progettazione: Design Patterns GoF: MVC e Observer 1 The Observer Pattern Intent Define a one-to-many dependency between objects so that when one object changes state, all its dependents are
More informationAP CS Unit 11: Graphics and Events
AP CS Unit 11: Graphics and Events This packet shows how to create programs with a graphical interface in a way that is consistent with the approach used in the Elevens program. Copy the following two
More informationGraphical User Interface (GUI)
Graphical User Interface (GUI) An example of Inheritance and Sub-Typing 1 Java GUI Portability Problem Java loves the idea that your code produces the same results on any machine The underlying hardware
More information