Swing - JTextField. Adding a text field to the main window (with tooltips and all)
|
|
- Rhoda Cain
- 6 years ago
- Views:
Transcription
1 Swing - JTextField Adding a text field to the main window (with tooltips and all)
2 Prerequisites - before this lecture You should have seen: The lecture on JFrame The lecture on JButton Including having seen and run the examples on the above, found at ts-examples
3 Color codes in RGB Colors in a computer can be described as a 24 bit number with three parts RED (first 8 bits) ???????????????? GREEN (next 8 bits)???????? ???????? BLUE (last 8 bits)???????????????? All colors can be produced by mixing R.G.B.: Black: White FFFFFF 16 Purple FF00FF 16 (red mixed with blue) Mix: Purple: Numbers are given in hexadecimal (00 - FF are 16 bits) 0x0 is 0000 (in four bits) 0xF is 1111, 0xFF is
4 Let s make a GUI where you enter a color code
5 Let s make a GUI where you enter a color code If you enter FF00FF (maximum red, no green, maximum blue) you should get purple: You select the entered color by hitting [Enter] or clicking the button. The label gets the specified color (or black if it couldn t be interpreted).
6 Swing class rough layout public class JTextFieldExample { private JFrame window; // more components... public WindowExample() { initcomponents(); layoutcomponents(); addlisteners(); private void initcomponents() { // initialize the components... // more methods (layoutcomponents(), addlisteners()...)
7 Let s make a GUI where you enter a color code New components (as instance variables as usual): JLabel (just text with the prompt text Color in hex: JTextField (the text input box) ActionListener - we ll use the same action on both the textfield and button private JFrame window; // main window as before private JButton colorbutton; // the button private JLabel prompt; // the text Color in hex private ActionListener colorchanger; // The action to take private JTextField colortextfield; // where to enter text
8 Let s make a GUI where you enter a color code Constructor as before (the class is called TextFieldExample): public TextFieldExample() { initcomponents(); layoutcomponents(); addlisteners();
9 Let s make a GUI where you enter a color code private void initcomponents() { initwindow(); // the JFrame... colorbutton = new JButton("Change color"); prompt = new JLabel("Color in hex:"); // text to show colortextfield = new JTextField("000000"); // intial text colortextfield.selectall(); // select the text colortextfield.requestfocus(); // put focus in the textfield colortextfield.settooltiptext("<html><ul>" + "<li>red: FF0000</li>" + "<li>green: 00FF00</li>" + "<li>blue: 0000FF</li>" + "</ul></html>");
10 Let s make a GUI where you enter a color code A tooltip is a small help text which pops up when you hover the mouse over a component. Swing components with text can be styled using HTML: colortextfield.settooltiptext("<html><ul>" + "<li>red: FF0000</li>" + "<li>green: 00FF00</li>" + "<li>blue: 0000FF</li>" + "</ul></html>");
11 Let s make a GUI where you enter a color code
12 Let s make a GUI where you enter a color code layoutcomponents becomes: private void layoutcomponents() { window.setlayout(new FlowLayout()); window.add(prompt); window.add(colortextfield); window.add(colorbutton);
13 Creating the ActionListener colorchanger = e -> { Color newcolor = null; try { newcolor = Color.decode("0x" + colortextfield.gettext()); catch (NumberFormatException ignore) { // only valid ints are good if (newcolor!= null) { prompt.setforeground(newcolor); else { prompt.setforeground(black); colortextfield.settext("??????"); colortextfield.requestfocus(); colortextfield.selectall(); ;
14 Creating the ActionListener colorchanger = e -> { Color newcolor = null; try { //prepend with 0x and get text from textfield newcolor = Color.decode( "0x" + colortextfield.gettext()); catch (NumberFormatException ignore) { // only valid ints are good if (newcolor!= null) { prompt.setforeground(newcolor); else { prompt.setforeground(black); colortextfield.settext("??????"); colortextfield.requestfocus(); colortextfield.selectall(); ;
15 Creating the ActionListener - complete private void addlisteners() { colorchanger = e -> { Color newcolor = null; try { newcolor = Color.decode("0x" + colortextfield.gettext()); catch (NumberFormatException ignore) { if (newcolor!= null) { prompt.setforeground(newcolor); else { // invalid number was entered prompt.setforeground(black); // reset color to black colortextfield.settext("??????"); // show the user you didn t understand the number colortextfield.requestfocus(); // make it easy to overwrite the question marks colortextfield.selectall(); ; colortextfield.addactionlistener(colorchanger); // add to both textfield colorbutton.addactionlistener(colorchanger); // and button
16 Source code - A novel in 25 volumes import javax.swing.*; import java.awt.flowlayout; import java.awt.event.*; import static java.awt.color.*; import java.awt.color; public class TextFieldExample { private JFrame window; private JButton colorbutton; private JLabel prompt; private ActionListener colorchanger; private JTextField colortextfield;
17 Source code - A novel in 25 volumes public TextFieldExample() { initcomponents(); layoutcomponents(); addlisteners(); private void initwindow() { window = new JFrame("JTextField example"); window.setdefaultcloseoperation(jframe.exit_on_close); window.setsize(800, 600);
18 Source code - A novel in 25 volumes private void initcomponents() { initwindow(); // JFrame initialization moved to separate method to save space here colorbutton = new JButton("Change color"); prompt = new JLabel("Color in hex:"); colortextfield = new JTextField("000000"); colortextfield.selectall(); colortextfield.requestfocus(); colortextfield.settooltiptext("<html><ul><li>red: FF0000</li><li>Green: 00FF00</li><li>Blue: 0000FF</li></ul></html>"); // line-wrap - one single line private void layoutcomponents() { window.setlayout(new FlowLayout()); window.add(prompt); window.add(colortextfield); window.add(colorbutton);
19 Source code - A novel in 25 volumes private void addlisteners() { colorchanger = e -> { Color newcolor = null; try { newcolor = Color.decode("0x" + colortextfield.gettext()); catch (NumberFormatException ignore) { if (newcolor!= null) { prompt.setforeground(newcolor); else { prompt.setforeground(black); colortextfield.settext("??????"); colortextfield.requestfocus(); colortextfield.selectall(); ; colortextfield.addactionlistener(colorchanger); colorbutton.addactionlistener(colorchanger);
20 Source code - A novel in 25 volumes public void show() { window.setvisible(true); // end-of-class-declaration
21 Source code - Main class public class TextFieldExampleRunner { public static void main(string[] args) { try { javax.swing.swingutilities.invokelater(new Runnable() { public void run() { TextFieldExample textex = new TextFieldExample(); textex.show(); ); catch(exception e) { System.err.println("Exception in main: " + e.getmessage());
22 Further reading
Swing - JLabel. Adding a text (and HTML) labels to a GUI
Swing - JLabel Adding a text (and HTML) labels to a GUI Prerequisites - before this lecture You should have seen: The lecture on JFrame The lecture on JButton The lectuer on JTextField Including having
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 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 informationClient-side GUI. A simple Swing-gui for searching for proudcts
Client-side GUI A simple Swing-gui for searching for proudcts Working from a sketch to a rough GUI We make a list of the features / requirements We ll then start with a sketch of how a GUI for searching
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 informationJRadioButton account_type_radio_button2 = new JRadioButton("Current"); ButtonGroup account_type_button_group = new ButtonGroup();
Q)Write a program to design an interface containing fields User ID, Password and Account type, and buttons login, cancel, edit by mixing border layout and flow layout. Add events handling to the button
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 information1005ICT Object Oriented Programming Lecture Notes
1005ICT Object Oriented Programming Lecture Notes School of Information and Communication Technology Griffith University Semester 2, 2015 1 20 GUI Components and Events This section develops a program
More informationMeasurement of Earthquakes. New Mexico. Supercomputing Challenge. Final Report. April 3, Team #91. Miyamura High School
Measurement of Earthquakes New Mexico Supercomputing Challenge Final Report April 3, 2012 Team #91 Miyamura High School Team Members: Tabitha Hallock Sridivya Komaravolu Kirtus Leyba Jeffrey Young Teacher:
More informationFrames, GUI and events. Introduction to Swing Structure of Frame based applications Graphical User Interface (GUI) Events and event handling
Frames, GUI and events Introduction to Swing Structure of Frame based applications Graphical User Interface (GUI) Events and event handling Introduction to Swing The Java AWT (Abstract Window Toolkit)
More informationG51PGP Programming Paradigms. Lecture 009 Concurrency, exceptions
G51PGP Programming Paradigms Lecture 009 Concurrency, exceptions 1 Reminder subtype polymorphism public class TestAnimals public static void main(string[] args) Animal[] animals = new Animal[6]; animals[0]
More informationGraphical User Interfaces (GUIs)
CMSC 132: Object-Oriented Programming II Graphical User Interfaces (GUIs) Department of Computer Science University of Maryland, College Park Model-View-Controller (MVC) Model for GUI programming (Xerox
More informationSystems Programming. Bachelor in Telecommunication Technology Engineering Bachelor in Communication System Engineering Carlos III University of Madrid
Systems Programming Bachelor in Telecommunication Technology Engineering Bachelor in Communication System Engineering Carlos III University of Madrid Leganés, 21st of March, 2014. Duration: 75 min. Full
More informationCONTENTS. Chapter 1 Getting Started with Java SE 6 1. Chapter 2 Exploring Variables, Data Types, Operators and Arrays 13
CONTENTS Chapter 1 Getting Started with Java SE 6 1 Introduction of Java SE 6... 3 Desktop Improvements... 3 Core Improvements... 4 Getting and Installing Java... 5 A Simple Java Program... 10 Compiling
More informationTo gain experience using GUI components and listeners.
Lab 5 Handout 7 CSCI 134: Fall, 2017 TextPlay Objective To gain experience using GUI components and listeners. Note 1: You may work with a partner on this lab. If you do, turn in only one lab with both
More informationSampleApp.java. Page 1
SampleApp.java 1 package msoe.se2030.sequence; 2 3 /** 4 * This app creates a UI and processes data 5 * @author hornick 6 */ 7 public class SampleApp { 8 private UserInterface ui; // the UI for this program
More informationThe JFrame Class Frame Windows GRAPHICAL USER INTERFACES. Five steps to displaying a frame: 1) Construct an object of the JFrame class
CHAPTER GRAPHICAL USER INTERFACES 10 Slides by Donald W. Smith TechNeTrain.com Final Draft 10/30/11 10.1 Frame Windows Java provides classes to create graphical applications that can run on any major graphical
More informationHanley s Survival Guide for Visual Applications with NetBeans 2.0 Last Updated: 5/20/2015 TABLE OF CONTENTS
Hanley s Survival Guide for Visual Applications with NetBeans 2.0 Last Updated: 5/20/2015 TABLE OF CONTENTS Glossary of Terms 2-4 Step by Step Instructions 4-7 HWApp 8 HWFrame 9 Never trust a computer
More informationLab 4. D0010E Object-Oriented Programming and Design. Today s lecture. GUI programming in
Lab 4 D0010E Object-Oriented Programming and Design Lecture 9 Lab 4: You will implement a game that can be played over the Internet. The networking part has already been written. Among other things, the
More informationJava Programming Lecture 6
Java Programming Lecture 6 Alice E. Fischer Feb 15, 2013 Java Programming - L6... 1/32 Dialog Boxes Class Derivation The First Swing Programs: Snow and Moving The Second Swing Program: Smile Swing Components
More informationMidterm assessment - MAKEUP Fall 2010
M257 MTA Faculty of Computer Studies Information Technology and Computing Date: /1/2011 Duration: 60 minutes 1-Version 1 M 257: Putting Java to Work Midterm assessment - MAKEUP Fall 2010 Student Name:
More informationCS Exam 1 Review Suggestions
CS 235 - Fall 2015 - Exam 1 Review Suggestions p. 1 last modified: 2015-09-30 CS 235 - Exam 1 Review Suggestions You are responsible for material covered in class sessions, lab exercises, and homeworks;
More informationSystems Programming Graphical User Interfaces
Systems Programming Graphical User Interfaces Julio Villena Román (LECTURER) CONTENTS ARE MOSTLY BASED ON THE WORK BY: José Jesús García Rueda Systems Programming GUIs based on Java
More informationAnswer on question #61311, Programming & Computer Science / Java
Answer on question #61311, Programming & Computer Science / Java JSP JSF for completion Once the user starts the thread by clicking a button, the program must choose a random image out of an image array,
More informationWindow Interfaces Using Swing Objects
Chapter 12 Window Interfaces Using Swing Objects Event-Driven Programming and GUIs Swing Basics and a Simple Demo Program Layout Managers Buttons and Action Listeners Container Classes Text I/O for GUIs
More informationFinal Examination Semester 3 / Year 2008
Southern College Kolej Selatan 南方学院 Final Examination Semester 3 / Year 2008 COURSE : JAVA PROGRAMMING COURSE CODE : PROG1114 TIME : 2 1/2 HOURS DEPARTMENT : COMPUTER SCIENCE CLASS : CS08-A + CS08-B LECTURER
More informationGraphics User Defined Forms, Part I
Graphics User Defined Forms, Part I Quick Start Compile step once always mkdir labs javac PropertyTax5.java cd labs mkdir 5 Execute step cd 5 java PropertyTax5 cp /samples/csc/156/labs/5/*. cp PropertyTax1.java
More informationCSE 143. Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT
CSE 143 Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia http://www.cs.washington.edu/331/
More informationUTM CSC207: Midterm Examination October 28, 2011
UTM CSC207: Midterm Examination October 28, 2011 Student Number: Last Name: First Name: This 110 minute exam consists of 6 double sided pages. You are allowed two 8 1 2 11 double sided aid sheets. 1. [10
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 informationCourse Status Networking GUI Wrap-up. CS Java. Introduction to Java. Andy Mroczkowski
CS 190 - Java Introduction to Java Andy Mroczkowski uamroczk@cs.drexel.edu Department of Computer Science Drexel University March 10, 2008 / Lecture 8 Outline Course Status Course Information & Schedule
More informationWindow Interfaces Using Swing Objects
Chapter 12 Window Interfaces Using Swing Objects Event-Driven Programming and GUIs Swing Basics and a Simple Demo Program Layout Managers Buttons and Action Listeners Container Classes Text I/O for GUIs
More informationMultiple Choice Questions: Identify the choice that best completes the statement or answers the question. (15 marks)
M257 MTA Spring2010 Multiple Choice Questions: Identify the choice that best completes the statement or answers the question. (15 marks) 1. If we need various objects that are similar in structure, but
More informationPart I: Learn Common Graphics Components
OOP GUI Components and Event Handling Page 1 Objectives 1. Practice creating and using graphical components. 2. Practice adding Event Listeners to handle the events and do something. 3. Learn how to connect
More informationBuilding a GUI in Java with Swing. CITS1001 extension notes Rachel Cardell-Oliver
Building a GUI in Java with Swing CITS1001 extension notes Rachel Cardell-Oliver Lecture Outline 1. Swing components 2. Building a GUI 3. Animating the GUI 2 Swing A collection of classes of GUI components
More informationRAIK 183H Examination 2 Solution. November 11, 2013
RAIK 183H Examination 2 Solution November 11, 2013 Name: NUID: This examination consists of 5 questions and you have 110 minutes to complete the test. Show all steps (including any computations/explanations)
More informationTrident Z Royal. Royal Lighting Control Software Guide
Trident Z Royal Royal Lighting Control Software Guide Introduction 1 2 3 About This Guide This guide will help you understand and navigate the Royal Lighting Control software, which is designed to control
More informationSINGLE EVENT HANDLING
SINGLE EVENT HANDLING Event handling is the process of responding to asynchronous events as they occur during the program run. An event is an action that occurs externally to your program and to which
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 informationGUI Forms and Events, Part II
GUI Forms and Events, Part II Quick Start Compile step once always mkdir labs javac PropertyTax6.java cd labs Execute step mkdir 6 java PropertyTax6 cd 6 cp../5/propertytax5.java PropertyTax6.java Submit
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 informationGraphical User Interfaces. Swing. Jose Jesus García Rueda
Graphical User Interfaces. Swing Jose Jesus García Rueda Introduction What are the GUIs? Well known examples Basic concepts Graphical application. Containers. Actions. Events. Graphical elements: Menu
More informationRAIK 183H Examination 2 Solution. November 10, 2014
RAIK 183H Examination 2 Solution November 10, 2014 Name: NUID: This examination consists of 5 questions and you have 110 minutes to complete the test. Show all steps (including any computations/explanations)
More informationGraphical User Interface
Lecture 10 Graphical User Interface An introduction Sahand Sadjadee sahand.sadjadee@liu.se Programming Fundamentals 725G61 http://www.ida.liu.se/~725g61/ Department of Computer and Information Science
More informationCS108, Stanford Handout #22. Thread 3 GUI
CS108, Stanford Handout #22 Winter, 2006-07 Nick Parlante Thread 3 GUI GUIs and Threading Problem: Swing vs. Threads How to integrate the Swing/GUI/drawing system with threads? Problem: The GUI system
More informationDM503 Programming B. Peter Schneider-Kamp.
DM503 Programming B Peter Schneider-Kamp petersk@imada.sdu.dk! http://imada.sdu.dk/~petersk/dm503/! ADVANCED OBJECT-ORIENTATION 2 Object-Oriented Design classes often do not exist in isolation from each
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 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 informationGUI and its COmponent Textfield, Button & Label. By Iqtidar Ali
GUI and its COmponent Textfield, Button & Label By Iqtidar Ali GUI (Graphical User Interface) GUI is a visual interface to a program. GUI are built from GUI components. A GUI component is an object with
More informationCS 180 Fall 2006 Exam II
CS 180 Fall 2006 Exam II There are 20 multiple choice questions. Each one is worth 2 points. There are 3 programming questions worth a total of 60 points. Answer the multiple choice questions on the bubble
More informationGoals. Lecture 7 More GUI programming. The application. The application D&D 12. CompSci 230: Semester JFrame subclass: ListOWords
Goals By the end of this lesson, you should: Lecture 7 More GUI programming 1. Be able to write Java s with JTextField, JList, JCheckBox and JRadioButton components 2. Be able to implement a ButtonGroup
More informationAgenda. Container and Component
Agenda Types of GUI classes/objects Step-by-step guide to create a graphic user interface Step-by-step guide to event-handling PS5 Problem 1 PS5 Problem 2 Container and Component There are two types of
More informationG51PGP Programming Paradigms. Lecture 008 Inner classes, anonymous classes, Swing worker thread
G51PGP Programming Paradigms Lecture 008 Inner classes, anonymous classes, Swing worker thread 1 Reminder subtype polymorphism public class TestAnimals public static void main(string[] args) Animal[] animals
More informationInterfaces & Polymorphism part 2: Collections, Comparators, and More fun with Java graphics
Interfaces & Polymorphism part 2: Collections, Comparators, and More fun with Java graphics 1 Collections (from the Java tutorial)* A collection (sometimes called a container) is simply an object that
More informationCSEN401 Computer Programming Lab. Topics: Graphical User Interface Window Interfaces using Swing
CSEN401 Computer Programming Lab Topics: Graphical User Interface Window Interfaces using Swing Prof. Dr. Slim Abdennadher 22.3.2015 c S. Abdennadher 1 Swing c S. Abdennadher 2 AWT versus Swing Two basic
More informationCS180 Spring 2010 Exam 2 Solutions, 29 March, 2010 Prof. Chris Clifton
CS180 Spring 2010 Exam 2 Solutions, 29 March, 2010 Prof. Chris Clifton Turn Off Your Cell Phone. Use of any electronic device during the test is prohibited. Time will be tight. If you spend more than the
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 informationProject 1. LibraryTest.java. Yuji Shimojo CMSC 335
Project 1 LibraryTest.java Yuji Shimojo CMSC 335 April 1, 2012 1 Contents 1. Programs... 3 2. Execution Result... 10 3. Class Diagram... 11 4. Operating Instructions & Test Cases... 11 5. Test Data...
More informationOverview. Lecture 7: Inheritance and GUIs. Inheritance. Example 9/30/2008
Overview Lecture 7: Inheritance and GUIs Written by: Daniel Dalevi Inheritance Subclasses and superclasses Java keywords Interfaces and inheritance The JComponent class Casting The cosmic superclass Object
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 informationPoints Missed on Page page 1 of 8
Midterm II - CSE11 Fall 2013 CLOSED BOOK, CLOSED NOTES 50 minutes, 100 points Total. Name: ID: Problem #1 (8 points) Rewrite the following code segment using a for loop instead of a while loop (that is
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 informationSE1021 Exam 2. When returning your exam, place your note-sheet on top. Page 1: This cover. Page 2 (Multiple choice): 10pts
SE1021 Exam 2 Name: You may use a note-sheet for this exam. But all answers should be your own, not from slides or text. Review all questions before you get started. The exam is printed single-sided. Write
More informationSwing Programming Example Number 2
1 Swing Programming Example Number 2 Problem Statement (Part 1 and 2 (H/w- assignment) 2 Demonstrate the use of swing Label, TextField, RadioButton, CheckBox, Listbox,Combo Box, Toggle button,image Icon
More informationIntroduction to Graphical User Interfaces (GUIs) Lecture 10 CS2110 Fall 2008
Introduction to Graphical User Interfaces (GUIs) Lecture 10 CS2110 Fall 2008 Announcements A3 is up, due Friday, Oct 10 Prelim 1 scheduled for Oct 16 if you have a conflict, let us know now 2 Interactive
More informationState Application Using MVC
State Application Using MVC 1. Getting ed: Stories and GUI Sketch This example illustrates how applications can be thought of as passing through different states. The code given shows a very useful way
More information1.00 Lecture 14. Lecture Preview
1.00 Lecture 14 Introduction to the Swing Toolkit Lecture Preview Over the next 5 lectures, we will introduce you to the techniques necessary to build graphic user interfaces for your applications. Lecture
More informationLecture 9. Lecture
Layout Components MVC Design PaCern GUI Programming Observer Design PaCern D0010E Lecture 8 - Håkan Jonsson 1 Lecture 8 - Håkan Jonsson 2 Lecture 8 - Håkan Jonsson 3 1 1. GUI programming In the beginning,
More informationFirst Name: AITI 2004: Exam 2 July 19, 2004
First Name: AITI 2004: Exam 2 July 19, 2004 Last Name: Standard Track Read Instructions Carefully! This is a 3 hour closed book exam. No calculators are allowed. Please write clearly if we cannot understand
More informationDM550 / DM857 Introduction to Programming. Peter Schneider-Kamp
DM550 / DM857 Introduction to Programming Peter Schneider-Kamp petersk@imada.sdu.dk http://imada.sdu.dk/~petersk/dm550/ http://imada.sdu.dk/~petersk/dm857/ GRAPHICAL USER INTERFACES 2 HelloWorld Reloaded
More informationMidterm Test II Object Oriented Programming in Java Computer Science, University of Windsor Fall 2014 Time 2 hours. Answer all questions
Midterm Test II 60-212 Object Oriented Programming in Java Computer Science, University of Windsor Fall 2014 Time 2 hours Answer all questions Name : Student Id # : Only an unmarked copy of a textbook
More informationDr. Hikmat A. M. AbdelJaber
Dr. Hikmat A. M. AbdelJaber JWindow: is a window without a title bar or move controls. The program can move and resize it, but the user cannot. It has no border at all. It optionally has a parent JFrame.
More informationCMP 326 Midterm Fall 2015
CMP 326 Midterm Fall 2015 Name: 1) (30 points; 5 points each) Write the output of each piece of code. If the code gives an error, write any output that would happen before the error, and then write ERROR.
More informationPROGRAMMING DESIGN USING JAVA (ITT 303) Unit 7
PROGRAMMING DESIGN USING JAVA (ITT 303) Graphical User Interface Unit 7 Learning Objectives At the end of this unit students should be able to: Build graphical user interfaces Create and manipulate buttons,
More informationIntroduction to the JAVA UI classes Advanced HCI IAT351
Introduction to the JAVA UI classes Advanced HCI IAT351 Week 3 Lecture 1 17.09.2012 Lyn Bartram lyn@sfu.ca About JFC and Swing JFC Java TM Foundation Classes Encompass a group of features for constructing
More informationExample: Building a Java GUI
Steven Zeil October 25, 2013 Contents 1 Develop the Model 2 2 Develop the layout of those elements 3 3 Add listeners to the elements 9 4 Implement custom drawing 12 1 The StringArt Program To illustrate
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 informationExample: Building a Java GUI
Steven Zeil October 25, 2013 Contents 1 Develop the Model 3 2 Develop the layout of those elements 4 3 Add listeners to the elements 12 4 Implement custom drawing 15 1 The StringArt Program To illustrate
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 informationIntroduction This assignment will ask that you write a simple graphical user interface (GUI).
Computing and Information Systems/Creative Computing University of London International Programmes 2910220: Graphical Object-Oriented and Internet programming in Java Coursework one 2011-12 Introduction
More informationUniversity of Cape Town Department of Computer Science. Computer Science CSC117F Solutions
University of Cape Town Department of Computer Science Computer Science CSC117F Solutions Class Test 4 Wednesday 14 May 2003 Marks: 40 Approximate marks per question are shown in brackets Time: 40 minutes
More informationWindow Interfaces Using Swing. Chapter 12
Window Interfaces Using Swing 1 Reminders Project 7 due Nov 17 @ 10:30 pm Project 6 grades released: regrades due by next Friday (11-18-2005) at midnight 2 GUIs - Graphical User Interfaces Windowing systems
More informationProctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.
Solution HAND IN Answers Are Recorded on Question Paper QUEEN'S UNIVERSITY SCHOOL OF COMPUTING CISC212, FALL TERM, 2007 FINAL EXAMINATION 7pm to 10pm, 10 DECEMBER 2007, Jeffery Hall Instructor: Alan McLeod
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 informationControl Flow: Overview CSE3461. An Example of Sequential Control. Control Flow: Revisited. Control Flow Paradigms: Reacting to the User
CSE3461 Control Flow Paradigms: Reacting to the User Control Flow: Overview Definition of control flow: The sequence of execution of instructions in a program. Control flow is determined at run time by
More informationChapter 12 GUI Basics
Chapter 12 GUI Basics 1 Creating GUI Objects // Create a button with text OK JButton jbtok = new JButton("OK"); // Create a label with text "Enter your name: " JLabel jlblname = new JLabel("Enter your
More informationI.1 Introduction Matisse GUI designer I.2 GroupLayout Basics Sequential and Parallel Arrangements sequential horizontal orientation
I GroupLayout I.1 Introduction Java SE 6 includes a powerful layout manager called GroupLayout, which is the default layout manager in the NetBeans IDE (www.netbeans.org). In this appendix, we overview
More informationProctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.
HAND IN Answers Are Recorded on Question Paper QUEEN'S UNIVERSITY SCHOOL OF COMPUTING CISC212, FALL TERM, 2007 FINAL EXAMINATION 7pm to 10pm, 10 DECEMBER 2007, Jeffery Hall Instructor: Alan McLeod If the
More informationCS415 Human Computer Interaction
CS415 Human Computer Interaction Lecture 5 HCI Design Methods (GUI Builders) September 18, 2015 Sam Siewert A Little Humor on HCI Sam Siewert 2 WIMP GUI Builders The 2D GUI is the Killer App for WIMP Floating
More informationProctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.
HAND IN Answers Are Recorded on Question Paper QUEEN'S UNIVERSITY SCHOOL OF COMPUTING CISC212, FALL TERM, 2006 FINAL EXAMINATION 7pm to 10pm, 19 DECEMBER 2006, Jeffrey Hall 1 st Floor Instructor: Alan
More informationFinal Examination Semester 2 / Year 2011
Southern College Kolej Selatan 南方学院 Final Examination Semester 2 / Year 2011 COURSE COURSE CODE TIME DEPARTMENT LECTURER : JAVA PROGRAMMING : PROG1114 : 2 1/2 HOURS : COMPUTER SCIENCE : LIM PEI GEOK Student
More informationFirst Name: AITI 2004: Exam 2 July 19, 2004
First Name: AITI 2004: Exam 2 July 19, 2004 Last Name: JSP Track Read Instructions Carefully! This is a 3 hour closed book exam. No calculators are allowed. Please write clearly if we cannot understand
More informationParts of a Contract. Contract Example. Interface as a Contract. Wednesday, January 30, 13. Postcondition. Preconditions.
Parts of a Contract Syntax - Method signature Method name Parameter list Return type Semantics - Comments Preconditions: requirements placed on the caller Postconditions: what the method modifies and/or
More informationTable of Contents. Chapter 1 Getting Started with Java SE 7 1. Chapter 2 Exploring Class Members in Java 15. iii. Introduction of Java SE 7...
Table of Contents Chapter 1 Getting Started with Java SE 7 1 Introduction of Java SE 7... 2 Exploring the Features of Java... 3 Exploring Features of Java SE 7... 4 Introducing Java Environment... 5 Explaining
More informationCSE 331. Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT
CSE 331 Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia http://www.cs.washington.edu/331/
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 informationThis exam is closed textbook(s) and closed notes. Use of any electronic device (e.g., for computing and/or communicating) is NOT permitted.
York University AS/AK/ITEC 2610 3.0 All Sections OBJECT-ORIENTED PROGRAMMING Midterm Test Duration: 90 Minutes This exam is closed textbook(s) and closed notes. Use of any electronic device (e.g., for
More informationClass 14: Introduction to the Swing Toolkit
Introduction to Computation and Problem Solving Class 14: Introduction to the Swing Toolkit Prof. Steven R. Lerman and Dr. V. Judson Harward 1 Class Preview Over the next 5 lectures, we will introduce
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 information