Arbeit.java public class Arbeit extends Worker { int hourlypay; // public Arbeit(String n, int h) { super(n); hourlypay = h; public void addsalary(int

Size: px
Start display at page:

Download "Arbeit.java public class Arbeit extends Worker { int hourlypay; // public Arbeit(String n, int h) { super(n); hourlypay = h; public void addsalary(int"

Transcription

1 Worker.java public abstract class Worker { String name; int salary; // // public Worker(String n) { name = n; salary = 0; public String getname() { return name; public int getsalary() { return salary; public abstract void addsalary(int start, int end); Staff.java public class Staff extends Worker { int dailypay; // public Staff(String n, int d) { super(n); dailypay = d; public void addsalary(int start, int end) { salary += dailypay; int time = end - start; if(time > 8) { salary += (time - 8) dailypay 1.5 / 8; 1

2 Arbeit.java public class Arbeit extends Worker { int hourlypay; // public Arbeit(String n, int h) { super(n); hourlypay = h; public void addsalary(int start, int end) { salary += (end - start) hourlypay; GUI 1: GUI CompanyFrame.java import java.awt.; import java.awt.event.; import javax.swing.; import javax.swing.border.; import java.util.; public class CompanyFrame extends JFrame { 2

3 Company acompany; JList workerslst; JButton addbtn, removebtn; JLabel sumlbl; JMenuItem exititm; // public CompanyFrame() { JMenuBar bar = new JMenuBar(); JMenu filemn = new JMenu(" "); exititm = new JMenuItem(" "); ActionListener listener = new CompanyActionListener(this); exititm.addactionlistener(listener); filemn.add(exititm); bar.add(filemn); setjmenubar(bar); JPanel panel1 = new JPanel(new BorderLayout()); workerslst = new JList(new DefaultListModel()); workerslst.addmouselistener(new CompanyMouseListener(this)); JScrollPane pane = new JScrollPane(workersLst); pane.setborder(new TitledBorder(" ")); panel1.add(pane, "Center"); sumlbl = new JLabel("0 ", JLabel.CENTER); sumlbl.setborder(new TitledBorder(" ")); panel1.add(sumlbl, "South"); getcontentpane().add(panel1, "Center"); JPanel panel2 = new JPanel(); addbtn = new JButton(" "); addbtn.addactionlistener(listener); panel2.add(addbtn); removebtn = new JButton(" "); removebtn.addactionlistener(listener); panel2.add(removebtn); getcontentpane().add(panel2, "South"); setsize(200, 250); // public void setcompany(company c) { acompany = c; update(); // public Company getcompany() { return acompany; Worker public Worker getselectedworker() { DefaultListModel model = (DefaultListModel) workerslst.getmodel(); Iterator it = acompany.workers.iterator(); while(it.hasnext()) { Worker w = (Worker) it.next(); if(w.getname().equals(workerslst.getselectedvalue())) return w; 3

4 return null; public void update() { settitle(acompany.getname()); DefaultListModel model = (DefaultListModel) workerslst.getmodel(); model.removeallelements(); Iterator it = acompany.workers.iterator(); while(it.hasnext()) { model.addelement(((worker)it.next()).getname()); sumlbl.settext(string.valueof(acompany.sumsalary()) + " "); public static void main(string args[]) { Company soft = new Company(" "); Worker hisashi = new Staff(" ", 15000); Worker keiji = new Arbeit(" ", 1000); soft.addworker(hisashi); soft.addworker(keiji); hisashi.addsalary(9, 20); keiji.addsalary(8, 17); CompanyFrame frame = new CompanyFrame(); frame.setcompany(soft); frame.setvisible(true); CompanyActionListener.java import java.awt.event.; public class CompanyActionListener implements ActionListener { CompanyFrame frame; public CompanyActionListener(CompanyFrame f) { frame = f; public void actionperformed(actionevent e) { if(e.getsource().equals(frame.addbtn)) { AddWorkerDialog dialog = new AddWorkerDialog(frame); dialog.setvisible(true); 4

5 else if(e.getsource().equals(frame.removebtn)) { frame.getcompany().removeworker(frame.getselectedworker()); frame.update(); else if(e.getsource().equals(frame.exititm)) { System.exit(0); AddWorkerDialog.java import java.awt.; import java.awt.event.; import javax.swing.; public class AddWorkerDialog extends JDialog { ButtonGroup group; JTextField namefld, payfld; JButton okbtn, cancelbtn; public AddWorkerDialog(CompanyFrame f) { super(f, " ", true); JPanel panel1 = new JPanel(); group = new ButtonGroup(); JRadioButton staff = new JRadioButton(" ", true); JRadioButton arbeit = new JRadioButton(" ", false); staff.setactioncommand("staff"); arbeit.setactioncommand("arbeit"); group.add(staff); group.add(arbeit); panel1.add(staff); panel1.add(arbeit); getcontentpane().add(panel1, "North"); JPanel panel2 = new JPanel(); panel2.add(new JLabel(" :")); namefld = new JTextField(10); panel2.add(namefld); panel2.add(new JLabel(" :")); payfld = new JTextField(6); panel2.add(payfld); getcontentpane().add(panel2, "Center"); JPanel panel3 = new JPanel(); ActionListener listener = new AddWorkerButtonListener(f, this); okbtn = new JButton(" "); okbtn.addactionlistener(listener); panel3.add(okbtn); cancelbtn = new JButton(" "); 5

6 cancelbtn.addactionlistener(listener); panel3.add(cancelbtn); getcontentpane().add(panel3, "South"); pack(); AddWorkerButtonListener.java import java.awt.event.; public class AddWorkerButtonListener implements ActionListener { CompanyFrame frame; AddWorkerDialog dialog; public AddWorkerButtonListener(CompanyFrame f, AddWorkerDialog d) { frame = f; dialog = d; public void actionperformed(actionevent e) { if(e.getsource().equals(dialog.okbtn)) { Worker worker; String name = dialog.namefld.gettext(); int pay = Integer.parseInt(dialog.payFld.getText()); if(dialog.group.getselection().getactioncommand().equals("staff")) { worker = new Staff(name, pay); else { worker = new Arbeit(name, pay); frame.getcompany().addworker(worker); frame.update(); dialog.setvisible(false); CompanyMouseListener.java import java.awt.event.; public class CompanyMouseListener extends MouseAdapter { CompanyFrame frame; 6

7 public CompanyMouseListener(CompanyFrame f) { frame = f; public void mouseclicked(mouseevent e) { if(e.getclickcount() == 2) { Worker worker = frame.getselectedworker(); AddSalaryDialog dialog = new AddSalaryDialog(frame, worker); dialog.setvisible(true); AddSalaryDialog.java import java.awt.; import java.awt.event.; import javax.swing.; public class AddSalaryDialog extends JDialog { Worker aworker; JComboBox startcmb, endcmb; JButton okbtn, cancelbtn; public AddSalaryDialog(CompanyFrame f, Worker w) { super(f, w.getname() + " ", true); aworker = w; JPanel panel1 = new JPanel(); panel1.add(new JLabel(" ")); startcmb = new JComboBox(); for(int i = 8; i <= 24; i++) { startcmb.additem(string.valueof(i)); panel1.add(startcmb); panel1.add(new JLabel(" ")); endcmb = new JComboBox(); for(int i = 8; i <= 24; i++) { endcmb.additem(string.valueof(i)); panel1.add(endcmb); getcontentpane().add(panel1, "North"); JPanel panel2 = new JPanel(); ActionListener listener = new AddSalaryButtonListener(f, this); okbtn = new JButton(" "); okbtn.addactionlistener(listener); panel2.add(okbtn); 7

8 cancelbtn = new JButton(" "); cancelbtn.addactionlistener(listener); panel2.add(cancelbtn); getcontentpane().add(panel2, "South"); pack(); //Worker public Worker getworker() { return aworker; AddSalaryButtonListener.java import java.awt.event.; public class AddSalaryButtonListener implements ActionListener { CompanyFrame frame; AddSalaryDialog dialog; public AddSalaryButtonListener(CompanyFrame f, AddSalaryDialog d) { frame = f; dialog = d; public void actionperformed(actionevent e) { if(e.getsource().equals(dialog.okbtn)) { Worker worker = dialog.getworker(); int start = Integer.parseInt((String)dialog.startCmb.getSelectedItem()); int end = Integer.parseInt((String)dialog.endCmb.getSelectedItem()); worker.addsalary(start, end); frame.update(); dialog.setvisible(false); 8

9 9 2: GUI Worker Company name:string name:string salary:int getname():string 1 getname():string addworker(w:worker):void getsalary():int sumsalary():int addsalary(start:int, end:int):void CompanyFrame workerslst:jlist addbtn,removebtn:jbutton sumlbl:jlabel exititm:jmenuitem getselectedworker():worker update():void CompanyActionListener actionperformed(e:actionevent):void Staff dailypay:int addsalary(start:int, end:int):void CompanyMouseListener mouseclicked(e:mouseevent):void Arbeit hourlypay:int addsalary(start:int, end:int):void AddSalaryDialog startcmb,endcmb:jcombobox okbtn,cancelbtn:jbutton AddWorkerButtonListener actionperformed(e:actionevent):void AddWorkerDialog group:buttongroup namefld,payfld:jtextfield okbtn,cancelbtn:jbutton AddSalaryButtonListener actionperformed(e:actionevent):void

CS 335 Lecture 06 Java Programming GUI and Swing

CS 335 Lecture 06 Java Programming GUI and Swing CS 335 Lecture 06 Java Programming GUI and Swing Java: Basic GUI Components Swing component overview Event handling Inner classes and anonymous inner classes Examples and various components Layouts Panels

More information

// Correntista. //Conta Corrente. package Banco; public class Correntista { String nome, sobrenome; int cpf;

// Correntista. //Conta Corrente. package Banco; public class Correntista { String nome, sobrenome; int cpf; // Correntista public class Correntista { String nome, sobrenome; int cpf; public Correntista(){ nome = "zé"; sobrenome = "Pereira"; cpf = 123456; public void setnome(string n){ nome = n; public void setsobrenome(string

More information

Using A Frame for Output

Using A Frame for Output Eventos Roteiro Frames Formatting Output Event Handling Entering Data Using Fields in a Frame Creating a Data Entry Field Using a Field Reading Data in an Event Handler Handling Multiple Button Events

More information

Advanced Network Programming Lab using Java. Angelos Stavrou

Advanced Network Programming Lab using Java. Angelos Stavrou Advanced Network Programming Lab using Java Angelos Stavrou Table of Contents A simple Java Client...3 A simple Java Server...4 An advanced Java Client...5 An advanced Java Server...8 A Multi-threaded

More information

Swing. A Quick Tutorial on Programming Swing Applications

Swing. A Quick Tutorial on Programming Swing Applications Swing A Quick Tutorial on Programming Swing Applications 1 MVC Model View Controller Swing is based on this design pattern It means separating the implementation of an application into layers or components:

More information

INTRODUCTION TO COMPUTER PROGRAMMING. Richard Pierse. Class 7: Object-Oriented Programming. Introduction

INTRODUCTION TO COMPUTER PROGRAMMING. Richard Pierse. Class 7: Object-Oriented Programming. Introduction INTRODUCTION TO COMPUTER PROGRAMMING Richard Pierse Class 7: Object-Oriented Programming Introduction One of the key issues in programming is the reusability of code. Suppose that you have written a program

More information

5.17 GUI. Xiaoyi Jiang Informatik I Grundlagen der Programmierung

5.17 GUI. Xiaoyi Jiang Informatik I Grundlagen der Programmierung AWT vs. Swing AWT (Abstract Window Toolkit; Package java.awt) Benutzt Steuerelemente des darunterliegenden Betriebssystems Native Code (direkt für die Maschine geschrieben, keine VM); schnell Aussehen

More information

Informatik II. // ActionListener hinzufügen btnconvert.addactionlistener(this); super.setdefaultcloseoperation(jframe.

Informatik II. // ActionListener hinzufügen btnconvert.addactionlistener(this); super.setdefaultcloseoperation(jframe. Universität Augsburg, Institut für Informatik Sommersemester 2006 Prof. Dr. Werner Kießling 20. Juli. 2006 M. Endres, A. Huhn, T. Preisinger Lösungsblatt 11 Aufgabe 1: Währungsrechner CurrencyConverter.java

More information

Homework/Program #5 Solutions

Homework/Program #5 Solutions Homework/Program #5 Solutions Problem #1 (20 points) Using the standard Java Scanner class. Look at http://natch3z.blogspot.com/2008/11/read-text-file-using-javautilscanner.html as an exampleof using the

More information

The Abstract Windowing Toolkit. Java Foundation Classes. Swing. In April 1997, JavaSoft announced the Java Foundation Classes (JFC).

The Abstract Windowing Toolkit. Java Foundation Classes. Swing. In April 1997, JavaSoft announced the Java Foundation Classes (JFC). The Abstract Windowing Toolkit Since Java was first released, its user interface facilities have been a significant weakness The Abstract Windowing Toolkit (AWT) was part of the JDK form the beginning,

More information

Graphical User Interfaces

Graphical User Interfaces M14_REGE1813_02_SE_C14.qxd 2/10/10 3:43 PM Page 822 Chapter14 Graphical User Interfaces 14.1 GUI Basics Graphical Input and Output with Option Panes Working with Frames Buttons, Text Fields, and Labels

More information

Programming with Java GUI components

Programming with Java GUI components Programming with Java GUI components Java includes libraries to provide multi-platform support for Graphic User Interface objects. The multi-platform aspect of this is that you can write a program on a

More information

public class Craps extends JFrame implements ActionListener { final int WON = 0,LOST =1, CONTINUE = 2;

public class Craps extends JFrame implements ActionListener { final int WON = 0,LOST =1, CONTINUE = 2; Lecture 15 The Game of "Craps" In the game of "craps" a player throws a pair of dice. If the sum on the faces of the pair of dice after the first toss is 7 or 11 the player wins; if the sum on the first

More information

file://c:\dokumente und Einstellungen\Marco Favorito\Desktop\ScanCmds.html

file://c:\dokumente und Einstellungen\Marco Favorito\Desktop\ScanCmds.html file:c:\dokumente und Einstellungen\Marco Favorito\Desktop\ScanCmds.html Seite 1 von 5 ScanCmds.java ------------------------------------------------------------------------------- ScanCmds Demontration

More information

Dev Articles 05/25/07 11:07:33

Dev Articles 05/25/07 11:07:33 Java Crawling the Web with Java Contributed by McGraw Hill/Osborne 2005 06 09 Access Your PC from Anywhere Download Your Free Trial Take your office with you, wherever you go with GoToMyPC. It s the remote

More information

Tema: Encriptación por Transposición

Tema: Encriptación por Transposición import java.awt.*; import java.awt.event.*; import javax.swing.*; public class PrincipalSO extends JApplet implements ActionListener { // Declaración global JLabel lblclave, lblencriptar, lblencriptado,

More information

Fachbereich Informatik und Elektrotechnik Java Swing. Advanced Java. Java Swing Programming. Programming in Java, Helmut Dispert

Fachbereich Informatik und Elektrotechnik Java Swing. Advanced Java. Java Swing Programming. Programming in Java, Helmut Dispert Java Swing Advanced Java Java Swing Programming Java Swing Design Goals The overall goal for the Swing project was: To build a set of extensible GUI components to enable developersto more rapidly develop

More information

Skills and Topics for TeenCoder: Java Programming

Skills and Topics for TeenCoder: Java Programming Skills and Topics for TeenCoder: Java Programming Our Self-Study Approach Our courses are self-study and can be completed on the student's own computer, at their own pace. You can steer your student in

More information

TP #4 b. ClientBourse.java Classe principale du client graphique et fonction main. http://www.centraliup.fr.st

TP #4 b. ClientBourse.java Classe principale du client graphique et fonction main. http://www.centraliup.fr.st http://www.centraliup.fr.st Conception et Internet TP #4 b ClientBourse.java Classe principale du client graphique et fonction main import javax.swing.table.*; import javax.swing.event.*; import javax.swing.border.*;

More information

Remote Method Invocation

Remote Method Invocation Goal of RMI Remote Method Invocation Implement distributed objects. Have a program running on one machine invoke a method belonging to an object whose execution is performed on another machine. Remote

More information

Lösningsförslag till tentamen 121217

Lösningsförslag till tentamen 121217 Uppgift 1 Lösningsförslag till tentamen 121217 a) Utskriften blir: a = 5 och b = 10 a = 5 och b = 10 b) Utskriften blir 1 2 3 4 5 5 2 3 4 1 c) Utskriften blir 321 Uppgift 2 Med användning av dialogrutor:

More information

http://netbeans.org/kb/docs/java/gui-functionality.html?print=yes

http://netbeans.org/kb/docs/java/gui-functionality.html?print=yes Page 1 of 6 Introduction to GUI Building Contributed by Saleem Gul and Tomas Pavek, maintained by Ruth Kusterer and Irina Filippova This beginner tutorial teaches you how to create a simple graphical user

More information

JiST Graphical User Interface Event Viewer. Mark Fong mjf21@cornell.edu

JiST Graphical User Interface Event Viewer. Mark Fong mjf21@cornell.edu JiST Graphical User Interface Event Viewer Mark Fong mjf21@cornell.edu Table of Contents JiST Graphical User Interface Event Viewer...1 Table of Contents...2 Introduction...3 What it does...3 Design...3

More information

GUIs with Swing. Principles of Software Construction: Objects, Design, and Concurrency. Jonathan Aldrich and Charlie Garrod Fall 2012

GUIs with Swing. Principles of Software Construction: Objects, Design, and Concurrency. Jonathan Aldrich and Charlie Garrod Fall 2012 GUIs with Swing Principles of Software Construction: Objects, Design, and Concurrency Jonathan Aldrich and Charlie Garrod Fall 2012 Slides copyright 2012 by Jeffrey Eppinger, Jonathan Aldrich, William

More information

DHBW Karlsruhe, Vorlesung Programmieren, Remote Musterlösungen

DHBW Karlsruhe, Vorlesung Programmieren, Remote Musterlösungen DHBW Karlsruhe, Vorlesung Programmieren, Remote Musterlösungen Aufgabe 1 RMI - TimeService public interface TimeServerInterface extends Remote { public String gettime() throws RemoteException; import java.util.date;

More information

How To Build A Swing Program In Java.Java.Netbeans.Netcode.Com (For Windows) (For Linux) (Java) (Javax) (Windows) (Powerpoint) (Netbeans) (Sun) (

How To Build A Swing Program In Java.Java.Netbeans.Netcode.Com (For Windows) (For Linux) (Java) (Javax) (Windows) (Powerpoint) (Netbeans) (Sun) ( Chapter 11. Graphical User Interfaces To this point in the text, our programs have interacted with their users to two ways: The programs in Chapters 1-5, implemented in Processing, displayed graphical

More information

Essentials of the Java(TM) Programming Language, Part 1

Essentials of the Java(TM) Programming Language, Part 1 Essentials of the Java(TM) Programming Language, Part 1 http://developer.java.sun.com/developer...ining/programming/basicjava1/index.html Training Index Essentials of the Java TM Programming Language:

More information

Karsten Lentzsch JGoodies SWING WITH STYLE

Karsten Lentzsch JGoodies SWING WITH STYLE Karsten Lentzsch JGoodies SWING WITH STYLE JGoodies: Karsten Lentzsch Open source Swing libraries Example applications Consultant for Java desktop Design assistance Training for visual design and implementation

More information

public class demo1swing extends JFrame implements ActionListener{

public class demo1swing extends JFrame implements ActionListener{ import java.io.*; import java.net.*; import java.io.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class demo1swing extends JFrame implements ActionListener JButton demodulacion;

More information

Callbacks. Callbacks Copyright 2007 by Ken Slonneger 1

Callbacks. Callbacks Copyright 2007 by Ken Slonneger 1 Callbacks Callbacks refer to a mechanism in which a library or utility class provides a service to clients that are unknown to it when it is defined. Suppose, for example, that a server class creates a

More information

GOPAL RAMALINGAM MEMORIAL ENGINEERING COLLEGE. Rajeshwari nagar, Panapakkam, Near Padappai, Chennai-601301.

GOPAL RAMALINGAM MEMORIAL ENGINEERING COLLEGE. Rajeshwari nagar, Panapakkam, Near Padappai, Chennai-601301. GOPAL RAMALINGAM MEMORIAL ENGINEERING COLLEGE Rajeshwari nagar, Panapakkam, Near Padappai, Chennai-601301. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING OOAD LAB MANUAL Sub. Code/Sub. Name: CS2357-Object

More information

How Scala Improved Our Java

How Scala Improved Our Java How Scala Improved Our Java Sam Reid PhET Interactive Simulations University of Colorado http://spot.colorado.edu/~reids/ PhET Interactive Simulations Provides free, open source educational science simulations

More information

Extending Desktop Applications to the Web

Extending Desktop Applications to the Web Extending Desktop Applications to the Web Arno Puder San Francisco State University Computer Science Department 1600 Holloway Avenue San Francisco, CA 94132 arno@sfsu.edu Abstract. Web applications have

More information

Essentials of the Java Programming Language

Essentials of the Java Programming Language Essentials of the Java Programming Language A Hands-On Guide by Monica Pawlan 350 East Plumeria Drive San Jose, CA 95134 USA May 2013 Part Number TBD v1.0 Sun Microsystems. Inc. All rights reserved If

More information

How to Convert an Application into an Applet.

How to Convert an Application into an Applet. How to Convert an Application into an Applet. A java application contains a main method. An applet is a java program part of a web page and runs within a browser. I am going to show you three different

More information

Java GUI Programming. Building the GUI for the Microsoft Windows Calculator Lecture 2. Des Traynor 2005

Java GUI Programming. Building the GUI for the Microsoft Windows Calculator Lecture 2. Des Traynor 2005 Java GUI Programming Building the GUI for the Microsoft Windows Calculator Lecture 2 Des Traynor 2005 So, what are we up to Today, we are going to create the GUI for the calculator you all know and love.

More information

GUI Components: Part 2

GUI Components: Part 2 GUI Components: Part 2 JComboBox and Using an Anonymous Inner Class for Event Handling A combo box (or drop-down list) enables the user to select one item from a list. Combo boxes are implemented with

More information

JIDE Action Framework Developer Guide

JIDE Action Framework Developer Guide JIDE Action Framework Developer Guide Contents PURPOSE OF THIS DOCUMENT... 1 WHAT IS JIDE ACTION FRAMEWORK... 1 PACKAGES... 3 MIGRATING FROM EXISTING APPLICATIONS... 3 DOCKABLEBARMANAGER... 9 DOCKABLE

More information

Java GUI Programming

Java GUI Programming Java GUI Programming Sean P. Strout (sps@cs.rit.edu) Robert Duncan (rwd@cs.rit.edu) 10/24/2005 Java GUI Programming 1 Java has standard packages for creating custom Graphical User Interfaces What is a

More information

Artificial Intelligence. Class: 3 rd

Artificial Intelligence. Class: 3 rd Artificial Intelligence Class: 3 rd Teaching scheme: 4 hours lecture credits: Course description: This subject covers the fundamentals of Artificial Intelligence including programming in logic, knowledge

More information

Developing GUI Applications: Architectural Patterns Revisited

Developing GUI Applications: Architectural Patterns Revisited Developing GUI Applications: Architectural Patterns Revisited A Survey on MVC, HMVC, and PAC Patterns Alexandros Karagkasidis karagkasidis@gmail.com Abstract. Developing large and complex GUI applications

More information

Appendix B Task 2: questionnaire and artefacts

Appendix B Task 2: questionnaire and artefacts Appendix B Task 2: questionnaire and artefacts This section shows the questionnaire, the UML class and sequence diagrams, and the source code provided for the task 1 (T2) Buy a Ticket Unsuccessfully. It

More information

Cours de Java. Sciences-U Lyon. Java - Introduction Java - Fondamentaux Java Avancé. http://www.rzo.free.fr

Cours de Java. Sciences-U Lyon. Java - Introduction Java - Fondamentaux Java Avancé. http://www.rzo.free.fr Cours de Java Sciences-U Lyon Java - Introduction Java - Fondamentaux Java Avancé http://www.rzo.free.fr Pierre PARREND 1 Octobre 2004 Sommaire Java Introduction Java Fondamentaux Java Avancé GUI Graphical

More information

Assignment # 2: Design Patterns and GUIs

Assignment # 2: Design Patterns and GUIs CSUS COLLEGE OF ENGINEERING AND COMPUTER SCIENCE Department of Computer Science CSc 133 Object-Oriented Computer Graphics Programming Spring 2014 John Clevenger Assignment # 2: Design Patterns and GUIs

More information

Fondamenti di Java. Introduzione alla costruzione di GUI (graphic user interface)

Fondamenti di Java. Introduzione alla costruzione di GUI (graphic user interface) Fondamenti di Java Introduzione alla costruzione di GUI (graphic user interface) component - container - layout Un Container contiene [0 o +] Components Il Layout specifica come i Components sono disposti

More information

Part IV: Java Database Programming

Part IV: Java Database Programming Part IV: Java Database Programming This part of the book discusses how to use Java to develop database projects. You will learn JDBC interfaces and classes, create and process SQL statements, obtaining

More information

JIDE Common Layer Developer Guide (Open Source Project)

JIDE Common Layer Developer Guide (Open Source Project) JIDE Common Layer Developer Guide (Open Source Project) Contents PURPOSE OF THIS DOCUMENT... 4 WHY USING COMPONENTS... 4 WHY DO WE OPEN SOURCE... 5 HOW TO LEARN JIDE COMMON LAYER... 5 PACKAGE STRUCTURE...

More information

CS108, Stanford Handout #33. Sockets

CS108, Stanford Handout #33. Sockets CS108, Stanford Handout #33 Fall, 2007-08 Nick Parlante Sockets Sockets Sockets make network connections between machines, but you just read/write/block on them like there were plain file streams. The

More information

Introduction to the Java Programming Language

Introduction to the Java Programming Language Software Design Introduction to the Java Programming Language Material drawn from [JDK99,Sun96,Mitchell99,Mancoridis00] Java Features Write Once, Run Anywhere. Portability is possible because of Java virtual

More information

JMenu TentMenu. +TentMenu(s:String) -rcs():void +createmenuitem(itemname:stri +createmenuitem(itemname:stri +createcheckmenuitem(itemnam

JMenu TentMenu. +TentMenu(s:String) -rcs():void +createmenuitem(itemname:stri +createmenuitem(itemname:stri +createcheckmenuitem(itemnam 3IMULTIOSÆUDÆ3OFTWRTCHIK I S7 R $ 3 &LXIBLÆ!RCHITKTURÆUDÆ$SIÆVOÆ3OFTWRÆM "ISPILÆDRÆ "UTZRSCHITTSTLL Æ OVMBRÆ VOÆTISÆ7R $Æ3IMULTIOSÆUDÆ3OFTWRTCHIK 3IMULTIOSÆUDÆ3OFTWRTCHIK I S7 R $ 3 BRSICHT $FIITIOÆOTIVTIO

More information

Java Appletek II. Applet GUI

Java Appletek II. Applet GUI THE INTERNET,mapped on the opposite page, is a scalefree network in that Java Appletek II. dis.'~tj port,from BYALBERTU\SZLOBARABASI ANDERICBONABEAU THE INTERNET,mapped on the opposite page, is a scalefree

More information

Nexawebホワイトペーパー. Developing with Nexaweb ~ Nexaweb to Improve Development Productivity and Maintainability

Nexawebホワイトペーパー. Developing with Nexaweb ~ Nexaweb to Improve Development Productivity and Maintainability Nexawebホワイトペーパー Developing with Nexaweb ~ Nexaweb to Improve Development Productivity and Maintainability Nexaweb Technologies, Inc. February 2012 Overview Many companies today are creating rich internet

More information

During the process of creating ColorSwitch, you will learn how to do these tasks:

During the process of creating ColorSwitch, you will learn how to do these tasks: GUI Building in NetBeans IDE 3.6 This short tutorial guides you through the process of creating an application called ColorSwitch. You will build a simple program that enables you to switch the color of

More information

Using NetBeans IDE for Desktop Development. Geertjan Wielenga http://blogs.sun.com/geertjan

Using NetBeans IDE for Desktop Development. Geertjan Wielenga http://blogs.sun.com/geertjan Using NetBeans IDE for Desktop Development Geertjan Wielenga http://blogs.sun.com/geertjan Agenda Goals Design: Matisse GUI Builder Medium Applications: JSR-296 Tooling Large Applications: NetBeans Platform

More information

Yosemite National Park, California. CSE 114 Computer Science I Inheritance

Yosemite National Park, California. CSE 114 Computer Science I Inheritance Yosemite National Park, California CSE 114 Computer Science I Inheritance Containment A class contains another class if it instantiates an object of that class HAS-A also called aggregation PairOfDice

More information

Programação Orientada a Objetos. Programando Interfaces Gráficas Orientadas a Objeto Parte 2

Programação Orientada a Objetos. Programando Interfaces Gráficas Orientadas a Objeto Parte 2 Programação Orientada a Objetos Programando Interfaces Gráficas Orientadas a Objeto Parte 2 Paulo André Castro CES-22 IEC - ITA Sumário Programando Interfaces Gráficas Orientadas a Objeto - Parte 2 2.2.1

More information

OBJECT ORIENTED PROGRAMMING IN JAVA EXERCISES

OBJECT ORIENTED PROGRAMMING IN JAVA EXERCISES OBJECT ORIENTED PROGRAMMING IN JAVA EXERCISES CHAPTER 1 1. Write Text Based Application using Object Oriented Approach to display your name. // filename: Name.java // Class containing display() method,

More information

Chapter 2 Introduction to Java programming

Chapter 2 Introduction to Java programming Chapter 2 Introduction to Java programming 1 Keywords boolean if interface class true char else package volatile false byte final switch while throws float private case return native void protected break

More information

The Basic Java Applet and JApplet

The Basic Java Applet and JApplet I2PUJ4 - Chapter 6 - Applets, HTML, and GUI s The Basic Java Applet and JApplet Rob Dempster robd@cs.ukzn.ac.za School of Computer Science University of KwaZulu-Natal Pietermaritzburg Campus I2PUJ4 - Chapter

More information

Analysis Of Source Lines Of Code(SLOC) Metric

Analysis Of Source Lines Of Code(SLOC) Metric Analysis Of Source Lines Of Code(SLOC) Metric Kaushal Bhatt 1, Vinit Tarey 2, Pushpraj Patel 3 1,2,3 Kaushal Bhatt MITS,Datana Ujjain 1 kaushalbhatt15@gmail.com 2 vinit.tarey@gmail.com 3 pushpraj.patel@yahoo.co.in

More information

Medientechnik. Übung MVC

Medientechnik. Übung MVC Medientechnik Übung MVC Heute Model-View-Controller (MVC) Model programmieren Programmlogik Programmdaten Controller programmieren GUI Model Observer-Pattern Observable (Model) verwaltet Daten Observer

More information

Assignment No.3. /*-- Program for addition of two numbers using C++ --*/

Assignment No.3. /*-- Program for addition of two numbers using C++ --*/ Assignment No.3 /*-- Program for addition of two numbers using C++ --*/ #include class add private: int a,b,c; public: void getdata() couta; cout

More information

Java is commonly used for deploying applications across a network. Compiled Java code

Java is commonly used for deploying applications across a network. Compiled Java code Module 5 Introduction to Java/Swing Java is commonly used for deploying applications across a network. Compiled Java code may be distributed to different machine architectures, and a native-code interpreter

More information

CSS 543 Program 3: Online Tic-Tac-Toe Game Professor: Munehiro Fukuda Due date: see the syllabus

CSS 543 Program 3: Online Tic-Tac-Toe Game Professor: Munehiro Fukuda Due date: see the syllabus CSS 543 Program 3: Online Tic-Tac-Toe Game Professor: Munehiro Fukuda Due date: see the syllabus 1. Purpose This assignment exercises how to write a peer-to-peer communicating program using non-blocking

More information

The Design and Implementation of Multimedia Software

The Design and Implementation of Multimedia Software Chapter 3 Programs The Design and Implementation of Multimedia Software David Bernstein Jones and Bartlett Publishers www.jbpub.com David Bernstein (jbpub.com) Multimedia Software Jones and Bartlett 1

More information

Lab 1A. Create a simple Java application using JBuilder. Part 1: make the simplest Java application Hello World 1. Start Jbuilder. 2.

Lab 1A. Create a simple Java application using JBuilder. Part 1: make the simplest Java application Hello World 1. Start Jbuilder. 2. Lab 1A. Create a simple Java application using JBuilder In this lab exercise, we ll learn how to use a Java integrated development environment (IDE), Borland JBuilder 2005, to develop a simple Java application

More information

Tutorial Reference Manual. Java WireFusion 4.1

Tutorial Reference Manual. Java WireFusion 4.1 Tutorial Reference Manual Java WireFusion 4.1 Contents INTRODUCTION...1 About this Manual...2 REQUIREMENTS...3 User Requirements...3 System Requirements...3 SHORTCUTS...4 DEVELOPMENT ENVIRONMENT...5 Menu

More information

MVC Table Model / View / Controller

MVC Table Model / View / Controller CS193j, Stanford Handout #23 Winter, 2001-02 Nick Parlante MVC Table Model / View / Controller Design A decomposition strategy where "presentation" is separated from data maintenance Smalltalk idea Controller

More information

Altas, Bajas y Modificaciones de Registros en tabla MYSQL

Altas, Bajas y Modificaciones de Registros en tabla MYSQL Altas, Bajas y Modificaciones de Registros en tabla MYSQL 1. En MySql crear una base de datos de nombre EmpresaABC y dentro de ella la tabla Empleados con la siguiente estructura: DNI integer(8) Definir

More information

The class JOptionPane (javax.swing) allows you to display a dialog box containing info. showmessagedialog(), showinputdialog()

The class JOptionPane (javax.swing) allows you to display a dialog box containing info. showmessagedialog(), showinputdialog() // Fig. 2.8: Addition.java An addition program import javax.swing.joptionpane; public class Addition public static void main( String args[] ) String firstnumber, secondnumber; int number1, number2, sum;

More information

Object Oriented Programming with Java. School of Computer Science University of KwaZulu-Natal

Object Oriented Programming with Java. School of Computer Science University of KwaZulu-Natal Object Oriented Programming with Java School of Computer Science University of KwaZulu-Natal January 30, 2006 2 Object Oriented Programming with Java Notes for the Computer Science Module Object Oriented

More information

Mouse Event Handling (cont.)

Mouse Event Handling (cont.) GUI Components: Part II Mouse Event Handling (cont.) Each mouse event-handling method receives a MouseEvent object that contains information about the mouse event that occurred, including the x- and y-coordinates

More information

ICOM 4015: Advanced Programming

ICOM 4015: Advanced Programming ICOM 4015: Advanced Programming Lecture 10 Reading: Chapter Ten: Inheritance Copyright 2009 by John Wiley & Sons. All rights reserved. Chapter 10 Inheritance Chapter Goals To learn about inheritance To

More information

www.virtualians.pk CS506 Web Design and Development Solved Online Quiz No. 01 www.virtualians.pk

www.virtualians.pk CS506 Web Design and Development Solved Online Quiz No. 01 www.virtualians.pk CS506 Web Design and Development Solved Online Quiz No. 01 Which of the following is a general purpose container? JFrame Dialog JPanel JApplet Which of the following package needs to be import while handling

More information

public class Application extends JFrame implements ChangeListener, WindowListener, MouseListener, MouseMotionListener {

public class Application extends JFrame implements ChangeListener, WindowListener, MouseListener, MouseMotionListener { Application.java import javax.swing.*; import java.awt.geom.*; import java.awt.event.*; import javax.swing.event.*; import java.util.*; public class Application extends JFrame implements ChangeListener,

More information

Principles of Software Construction: Objects, Design and Concurrency. GUIs with Swing. toad 15-214. Spring 2013

Principles of Software Construction: Objects, Design and Concurrency. GUIs with Swing. toad 15-214. Spring 2013 Principles of Software Construction: Objects, Design and Concurrency GUIs with Swing 15-214 toad Spring 2013 Christian Kästner Charlie Garrod School of Computer Science 2012-13 C Garrod, C Kästner, J Aldrich,

More information

Example 1: Creating Jframe. Example 2: CenterFrame. Jaeki Song, Ph.D. Box 42101 Lubbock, TX, 79409-2101 PH: 806 784 0435 jsong@ba.ttu.

Example 1: Creating Jframe. Example 2: CenterFrame. Jaeki Song, Ph.D. Box 42101 Lubbock, TX, 79409-2101 PH: 806 784 0435 jsong@ba.ttu. Example 1: Creating Jframe import javax.swing.*; public class MyFrame public static void main(string[] args) JFrame frame = new JFrame("Test Frame"); frame.setsize(400, 300); frame.setvisible(true); frame.setdefaultcloseoperation(

More information

How To Write A Program For The Web In Java (Java)

How To Write A Program For The Web In Java (Java) 21 Applets and Web Programming As noted in Chapter 2, although Java is a general purpose programming language that can be used to create almost any type of computer program, much of the excitement surrounding

More information

Generation and Handcoding

Generation and Handcoding Farbe! Generative Software Engineering 3. Integrating Handwritten Code Prof. Dr. Bernhard Rumpe University http://www.se-rwth.de/ Page 2 Generation and Handcoding Not everything shall and can be generated

More information

11. Applets, normal window applications, packaging and sharing your work

11. Applets, normal window applications, packaging and sharing your work 11. Applets, normal window applications, packaging and sharing your work In this chapter Converting Full Screen experiments into normal window applications, Packaging and sharing applications packaging

More information

Java Applets. CSE219, Computer Science III Stony Brook University http://www.cs.stonybrook.edu/~cse219

Java Applets. CSE219, Computer Science III Stony Brook University http://www.cs.stonybrook.edu/~cse219 Java Applets CSE219, Computer Science III Stony Brook University http://www.cs.stonybrook.edu/~cse219 1 Java Applets When you browse the Web, you frequently see the graphical user interface and animation

More information

First Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science

First Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science First Java Programs V. Paúl Pauca Department of Computer Science Wake Forest University CSC 111D Fall, 2015 Hello World revisited / 8/23/15 The f i r s t o b l i g a t o r y Java program @author Paul Pauca

More information

The following program is aiming to extract from a simple text file an analysis of the content such as:

The following program is aiming to extract from a simple text file an analysis of the content such as: Text Analyser Aim The following program is aiming to extract from a simple text file an analysis of the content such as: Number of printable characters Number of white spaces Number of vowels Number of

More information

CS211 Spring 2005 Final Exam May 17, 2005. Solutions. Instructions

CS211 Spring 2005 Final Exam May 17, 2005. Solutions. Instructions CS11 Spring 005 Final Exam May 17, 005 Solutions Instructions Write your name and Cornell netid above. There are 15 questions on 1 numbered pages. Check now that you have all the pages. Write your answers

More information

Schueler-Organisiertes Lernen am Beispiel von Grafischen Benutzer-Schnittstellen in Java Tag der Offenen Tür - GTS 2008

Schueler-Organisiertes Lernen am Beispiel von Grafischen Benutzer-Schnittstellen in Java Tag der Offenen Tür - GTS 2008 Schueler-Organisiertes Lernen am Beispiel von Grafischen Benutzer-Schnittstellen in Java Tag der Offenen Tür - GTS 2008 http://worgtsone.scienceontheweb.net/worgtsone/ - mailto: worgtsone @ hush.com Sa

More information

Mapping to the Windows Presentation Framework

Mapping to the Windows Presentation Framework Mapping to the Windows Presentation Framework This section maps the main IFML concepts to the.net Windows Presentation Framework (WFP). Windows Presentation Framework (WPF) is a part of.net Framework by

More information

Inheritance, overloading and overriding

Inheritance, overloading and overriding Inheritance, overloading and overriding Recall with inheritance the behavior and data associated with the child classes are always an extension of the behavior and data associated with the parent class

More information

AT68 JAVA & WEB PROGRAMMING JUN 2015

AT68 JAVA & WEB PROGRAMMING JUN 2015 Q.2 a. List out the properties of static variables and methods in Java. (4) Unlike instance variables, static variables belong to a class, rather than to specific instances of it. This means that there

More information

Construction of classes with classes

Construction of classes with classes (November 13, 2014 Class hierarchies 1 ) Construction of classes with classes Classes can be built on existing classes through attributes of object types. Example: I A class PairOfDice can be constructed

More information

Lab 9. Spam, Spam, Spam. Handout 11 CSCI 134: Spring, 2015. To gain experience with Strings. Objective

Lab 9. Spam, Spam, Spam. Handout 11 CSCI 134: Spring, 2015. To gain experience with Strings. Objective Lab 9 Handout 11 CSCI 134: Spring, 2015 Spam, Spam, Spam Objective To gain experience with Strings. Before the mid-90s, Spam was a canned meat product. These days, the term spam means just one thing unwanted

More information

Course/Year W080/807 Expected Solution Subject: Software Development to Question No: 1

Course/Year W080/807 Expected Solution Subject: Software Development to Question No: 1 Subject: Software Development to Question No: 1 Page 1 of 2 Allocation: 33 marks (a) (i) A layout manager is an object that implements the LayoutManager interface and determines the size and position of

More information

Summer Internship 2013

Summer Internship 2013 Summer Internship 2013 Group IV - Enhancement of Jmeter Week 4 Report 1 9 th June 2013 Shekhar Saurav Report on Configuration Element Plugin 'SMTP Defaults' Configuration Elements or config elements are

More information

Illustration 1: An applet showing constructed responses in an intuitive mode. Note the misprint!

Illustration 1: An applet showing constructed responses in an intuitive mode. Note the misprint! Applets in Java using NetBeans as an IDE (Part 1) C.W. David Department of Chemistry University of Connecticut Storrs, CT 06269-3060 Carl.David@uconn.edu We are interested in creating a teaching/testing

More information

D06 PROGRAMMING with JAVA

D06 PROGRAMMING with JAVA Cicles Formatius de Grau Superior Desenvolupament d Aplicacions Informàtiques D06 PROGRAMMING with JAVA Ch11 Interfaces & Polymorphism PowerPoint presentation, created by Angel A. Juan - ajuanp(@)gmail.com,

More information

Projektet Computer: Specifikation. Objektorienterad modellering och diskreta strukturer / design. Projektet Computer: Data. Projektet Computer: Test

Projektet Computer: Specifikation. Objektorienterad modellering och diskreta strukturer / design. Projektet Computer: Data. Projektet Computer: Test Projektet Computer: Specifikation Objektorienterad modellering och diskreta strukturer / design Designmönster Lennart Andersson Reviderad 2010 09 04 public class Computer { public Computer(Memory memory)

More information

An Overview of Java. overview-1

An Overview of Java. overview-1 An Overview of Java overview-1 Contents What is Java Major Java features Java virtual machine Java programming language Java class libraries (API) GUI Support in Java Networking and Threads in Java overview-2

More information

Creating a Simple, Multithreaded Chat System with Java

Creating a Simple, Multithreaded Chat System with Java Creating a Simple, Multithreaded Chat System with Java Introduction by George Crawford III In this edition of Objective Viewpoint, you will learn how to develop a simple chat system. The program will demonstrate

More information

Lecture VII JAVA SWING GUI TUTORIAL

Lecture VII JAVA SWING GUI TUTORIAL 2. First Step: JFrame Lecture VII Page 1 Lecture VII JAVA SWING GUI TUTORIAL These notes are based on the excellent book, Core Java, Vol 1 by Horstmann and Cornell, chapter 7, graphics programming. Introduction

More information

Software Design: Figures

Software Design: Figures Software Design: Figures Today ColorPicker Layout Manager Observer Pattern Radio Buttons Prelimiary Discussion Exercise 5 ColorPicker They don't teach you the facts of death, Your mum and dad. They give

More information

Konzepte objektorientierter Programmierung

Konzepte objektorientierter Programmierung Konzepte objektorientierter Programmierung Prof. Dr. Peter Müller Werner Dietl Software Component Technology Exercises 5: Frameworks Wintersemester 05/06 2 Homework 1 Observer Pattern From: Gamma, Helm,

More information