// Class fully inheritance and Person immutable GUI nun and Gridbag Layout import java.awt.*; import java.awt.event.*; import javax.swing.
|
|
- Winfred Booth
- 5 years ago
- Views:
Transcription
1 // Class fully inheritance and Person immutable GUI nun and Gridbag Layout import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.border.*; import java.util.date; import java.text.*; class Person private String Name; private int nid; private Date bday; Person(String Name,int nid) bday=new Date(); this.name=name; this.nid=nid; public String getname() return Name; public String tostring() String st=""; SimpleDateFormat ft = new SimpleDateFormat ("E dd / MM / yyyy"); st+=("student Name "+Name+"\nNational ID "+nid+"\ndate "+ ft.format(bday)); return st; class Subjects private int subid; private double marks[]; private String sname; private double GPA; boolean paid; Subjects() public void setsubject(string sname,int subid,int mnum) this.sname=sname; this.subid=subid; marks=new double[mnum]; public void setmarks(double [] marks)
2 for(int i=0;i<this.marks.length;i++) this.marks[i]=marks[i]; public void setpaid(boolean paid) this.paid=paid; public boolean getpaid() return this.paid; private void setgpa() GPA=0; for(int i=0;i<marks.length;i++) GPA+=marks[i]; public double getgpa() this.setgpa(); return GPA; public String tostring() String st=""; if(paid) st+="\nsubject Name "+sname+"\nsubject Number "+subid; st+="\nnumber of Marks: "+marks.length+'\n'; for(int i=0;i<marks.length;i++) st+=marks[i]+" "; st+="\ngpa= "+getgpa(); else st="tuitions Not Paid No Records"; return st; class Student extends Person private int stid; private Subjects []m; private double ggpa; Student(String Name,int nid,int stid,int nsubj) super(name,nid);
3 this.stid=stid; m=new Subjects[nSubj]; for(int i=0;i<m.length;i++) m[i]=new Subjects(); public void addsubject(string sname,int subid,int mnum,int index, boolean ispaid) m[index].setsubject(sname,subid,mnum); m[index].setpaid(ispaid); public void setmarks(int index,double[]marks) m[index].setmarks(marks); public int numofmarks() return m.length; public String tostring() String ta=""; boolean tu=false; ta+=super.tostring(); ta+="\nstudent ID "+stid; for(int j=0;j<m.length;j++) ta+='\n'+m[j].tostring(); for(int j=0;j<m.length;j++) if(m[j].getpaid()) tu=true; if(tu) ta+=("\ngeneral GPA = "+getggpa()+"\n"); else ta+=("\ngeneral GPA = Tuitions Not Paid\n"); ta+=(" \n"); return ta; private double getggpa() ggpa=0; for(int j=0;j<m.length;j++) ggpa+=m[j].getgpa(); return ggpa/m.length; class TestStudentGread extends JFrame implements ActionListener private JLabel L=new JLabel("Number of Students ");
4 private JLabel L1=new JLabel(); private JLabel L2=new JLabel("1 Student Name"); private JLabel L3=new JLabel("Student National ID"); private JLabel L4=new JLabel("Student ID"); private JLabel L5=new JLabel("Number of enrolled subjects"); private JLabel L6=new JLabel("Student Name"); private JLabel L7=new JLabel("Subject Name"); private JLabel L8=new JLabel("Subject ID"); private JLabel L9=new JLabel("Marks Number"); private JTextField name=new JTextField(15); private JTextField sname=new JTextField(15); private JTextField nid=new JTextField(10); private JTextField sid=new JTextField(10); private JTextField subid=new JTextField(10); private JTextField subjn=new JTextField(10); private JTextField stnum=new JTextField(10); private JTextField mnum=new JTextField(4); private JTextField Mark[]; private JRadioButton rb=new JRadioButton("Tuitions Paid"); private JButton addst=new JButton("ADD"); private JButton addsu=new JButton("ADD Student"); private JButton addsubj=new JButton("ADD Marks"); private JTextArea ta=new JTextArea(); private JTabbedPane tapane = new JTabbedPane(); private JPanel p0,p1,p2,p3,p4,p5,p6; private JScrollPane scrollpane; private Student[]st; private double marks[]; private static int click; private static int click1; private static int subclick; TestStudentGread() setlayout(null); p0=new JPanel(); p0.setlayout(null); Border b=borderfactory.createlineborder(color.black,2); p0.setborder(borderfactory.createtitledborder(b,"number of Students P0")); p0.setsize(330,50); p0.setlocation(60,10); L.setSize(120,20); L.setLocation(10,18); stnum.setsize(80,20); stnum.setlocation(140,18); addst.setsize(80,20); addst.setlocation(230,18);
5 p0.add(l);p0.add(stnum); p0.add(addst); addst.addactionlistener(this); add(p0); p1=new JPanel(); p1.setlayout(null); Border b1=borderfactory.createlineborder(color.blue,2); p1.setborder(borderfactory.createtitledborder(b1,"students Data P1")); p1.setsize(250,130); p1.setlocation(180,60); L2.setSize(120,20); L3.setSize(120,20); L4.setSize(120,20); L5.setSize(190,20); L2.setLocation(15,20); L3.setLocation(15,40); L4.setLocation(15,60); L5.setLocation(15,80); name.setsize(60,20); name.setlocation(180,20); nid.setsize(60,20); nid.setlocation(180,40); sid.setsize(60,20); sid.setlocation(180,60); subjn.setsize(60,20); subjn.setlocation(180,80); p1.add(l2);p1.add(name); p1.add(l3);p1.add(nid); p1.add(l4);p1.add(sid); p1.add(l5);p1.add(subjn); addsu.setsize(120,20); addsu.setlocation(60,100); p1.setvisible(false); p1.add(addsu); addsu.addactionlistener(this); add(p1); p2=new JPanel(); Border b2=borderfactory.createlineborder(color.gray,2); p2.setborder(borderfactory.createtitledborder(b2,"subject Data P2")); p2.setlayout(null); p2.setsize(170,120); p2.setlocation(10,60); L1.setSize(120,20); L6.setSize(100,20); L7.setSize(120,20); L8.setSize(120,20);
6 L9.setSize(190,20); L1.setLocation(90,20); L6.setLocation(5,20); L7.setLocation(10,40); L8.setLocation(10,60); L9.setLocation(10,80); sname.setsize(60,20); sname.setlocation(100,40); subid.setsize(60,20); subid.setlocation(100,60); mnum.setsize(60,20); mnum.setlocation(100,80); p2.add(l6);p2.add(l1); p2.add(l7);p2.add(sname); p2.add(l8);p2.add(subid); p2.add(l9);p2.add(mnum); mnum.addactionlistener(this); addsubj.addactionlistener(this); p2.setvisible(false); add(p2); p3=new JPanel(); Border b3=borderfactory.createlineborder(color.green,2); p3.setborder(borderfactory.createtitledborder(b3,"the Results P3")); p3.setlayout(null); p3.setsize(400,100); p3.setlocation(10,300); ta.seteditable(false); ta.setlinewrap(true); ta.setwrapstyleword(true); JScrollPane areascrollpane = new JScrollPane(ta); areascrollpane.setverticalscrollbarpolicy(jscrollpane.vertical_scrollbar_alw AYS); areascrollpane.sethorizontalscrollbarpolicy(jscrollpane.horizontal_scrollbar _AS_ NEEDED); areascrollpane.setsize(380,70); areascrollpane.setlocation(10,20); p3.add(areascrollpane); p3.setvisible(false); add(p3); public void actionperformed(actionevent e) if(e.getsource()==addst) int ist=0;
7 try ist=integer.parseint(stnum.gettext()); catch(numberformatexception q) JOptionPane.showMessageDialog(this,q.getMessage()+"\nYou must enter integers. Please try again.\n", "Input Error",JOptionPane.ERROR_MESSAGE); stnum.settext(""); if(ist!=0) st=new Student[ist]; p1.setvisible(true); stnum.seteditable(false); if(e.getsource()==addsu) int inid=0; int isid=0; int isubjn=0; try inid=integer.parseint(nid.gettext()); isid=integer.parseint(sid.gettext()); isubjn=integer.parseint(subjn.gettext()); catch(numberformatexception q) JOptionPane.showMessageDialog(this,q.getMessage()+"\nYou must enter integers. Please try again.\n", "Input Error",JOptionPane.ERROR_MESSAGE); nid.settext("");sid.settext("");subjn.settext(""); if(isubjn!=0) if(click<st.length) st[click]=new Student(name.getText(),inId,isId,isubjN); name.settext("");nid.settext("");sid.settext("");subjn.settext(""); if(click== st.length-1) L1.setText(st[0].getName()); click=0; name.seteditable(false); nid.seteditable(false);
8 sid.seteditable(false); subjn.seteditable(false); p2.setvisible(true); click++; L2.setText((click+1)+" Student Name"); if(e.getsource()==mnum) int intmnum=0; int isubid=0; try intmnum=integer.parseint(mnum.gettext()); isubid=integer.parseint(subid.gettext()); catch(numberformatexception q) JOptionPane.showMessageDialog(this,q.getMessage()+"\nYou must enter integers. Please try again.\n", "Input Error",JOptionPane.ERROR_MESSAGE); mnum.settext("");subid.settext(""); if(intmnum!=0) Mark=new JTextField[Integer.parseInt(mNum.getText())]; JLabel[]la=new JLabel[Integer.parseInt(mNum.getText())]; p4=new JPanel(new GridLayout((Integer.parseInt(mNum.getText())+1),2,10,0)); Border b4=borderfactory.createlineborder(color.yellow,2); p4.setborder(borderfactory.createtitledborder(b4,"enter the Marks p4")); for(int y=0,i=0;i<integer.parseint(mnum.gettext());i++,y+=20) la[i]=new JLabel((i+1)+" Mark"); Mark[i]=new JTextField(6); la[i].setsize(70,20); la[i].setlocation(15,20+y); Mark[i].setSize(70,20); Mark[i].setLocation(90,20+y); p4.add(la[i]); p4.add(mark[i]); addsubj.setlocation(200,20); addsubj.setsize(100,20); rb.setlocation(200,50); rb.setsize(100,20); p4.add(rb); p4.add(addsubj);
9 scrollpane = new JScrollPane(p4); scrollpane.setsize(350,100); scrollpane.setlocation(10,200); add(scrollpane); revalidate(); repaint(); if(e.getsource()==addsubj) if(subclick<st[click1].numofmarks()&&click1<st.length) st[click1].addsubject(sname.gettext(),integer.parseint(subid.gettext()),integer.parseint (mnum. gettext()), subclick,rb.isselected()); marks=new double[integer.parseint(mnum.gettext())]; for(int i=0;i<integer.parseint(mnum.gettext());i++) marks[i]=double.parsedouble(mark[i].gettext()); Mark[i].setText(""); st[click1].setmarks(subclick,marks); subclick++; sname.settext("");subid.settext("");mnum.settext("");rb.setselected(false); for(jtextfield f:mark) f.seteditable(false); remove(scrollpane); revalidate(); repaint(); if(subclick==st[click1].numofmarks()&&click1<st.length) click1++; subclick=0; if(click1<=st.length-1) L1.setText(st[click1].getName()); if(click1==st.length) add(scrollpane); revalidate(); repaint(); p3.setvisible(true); ta.settext(""); sname.seteditable(false);subid.seteditable(false);mnum.seteditable(false); click1=0;
10 subclick=0; for(int i=0;i<st.length;i++) ta.append(st[i].tostring()); public static void main(string[] args) JFrame frame = new TestStudentGread(); frame.settitle("records"); frame.setsize(450, 450); frame.setlocationrelativeto(null); frame.setdefaultcloseoperation(jframe.exit_on_close); frame.setvisible(true);
JAVA NOTES GRAPHICAL USER INTERFACES
1 JAVA NOTES GRAPHICAL USER INTERFACES Terry Marris 24 June 2001 5 TEXT AREAS 5.1 LEARNING OUTCOMES By the end of this lesson the student should be able to understand how to get multi-line input from the
More informationWe are on the GUI fast track path
We are on the GUI fast track path Chapter 13: Exception Handling Skip for now Chapter 14: Abstract Classes and Interfaces Sections 1 9: ActionListener interface Chapter 15: Graphics Skip for now Chapter
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 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 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 informationGraphical User Interface (GUI)
Graphical User Interface (GUI) Layout Managment 1 Hello World Often have a static method: createandshowgui() Invoked by main calling invokelater private static void createandshowgui() { } JFrame frame
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 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 informationLab Assignment 13 (week 13)
Lab Assignment 13 (week 13) In this lab you are going to learn how to use the StringTokenizer class. Please look at the API for StringTokenizer at the below link. http://java.sun.com/j2se/1.4.2/docs/api/java/util/stringtokenizer.html
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 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 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 informationimport javax.swing.*; import java.awt.*; import java.awt.event.*;
I need to be walked through with why the stocks are being recognized "half way." They will print out in the console but won't be recognized by certain code. Every line of code seems to look right and that's
More information// autor igre Ivan Programerska sekcija package mine;
// autor igre Ivan Bauk @ Programerska sekcija package mine; import java.awt.color; import java.awt.flowlayout; import java.awt.gridlayout; import java.awt.event.actionevent; import java.awt.event.actionlistener;
More informationCSC 1051 Data Structures and Algorithms I. Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University
Events and Listeners CSC 1051 Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website: www.csc.villanova.edu/~map/1051/ Some slides
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 informationGraphic User Interfaces. - GUI concepts - Swing - AWT
Graphic User Interfaces - GUI concepts - Swing - AWT 1 What is GUI Graphic User Interfaces are used in programs to communicate more efficiently with computer users MacOS MS Windows X Windows etc 2 Considerations
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 informationAttempt FOUR questions Marking Scheme Time: 120 mins
Ahmadu Bello University Department of Computer Science Second Semester Examinations August 2017 COSC212: Object Oriented Programming II Marking Scheme Attempt FOUR questions Marking Scheme Time: 120 mins
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 informationJAVA NOTES GRAPHICAL USER INTERFACES
1 JAVA NOTES GRAPHICAL USER INTERFACES Terry Marris July 2001 8 DROP-DOWN LISTS 8.1 LEARNING OUTCOMES By the end of this lesson the student should be able to understand and use JLists understand and use
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 informationCSIS 10A Assignment 7 SOLUTIONS
CSIS 10A Assignment 7 SOLUTIONS Read: Chapter 7 Choose and complete any 10 points from the problems below, which are all included in the download file on the website. Use BlueJ to complete the assignment,
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 informationTTTK Program Design and Problem Solving Tutorial 3 (GUI & Event Handlings)
TTTK1143 - Program Design and Problem Solving Tutorial 3 (GUI & Event Handlings) Topic: JApplet and ContentPane. 1. Complete the following class to create a Java Applet whose pane s background color is
More informationChapter 13 Lab Advanced GUI Applications Lab Objectives. Introduction. Task #1 Creating a Menu with Submenus
Chapter 13 Lab Advanced GUI Applications Lab Objectives Be able to add a menu to the menu bar Be able to use nested menus Be able to add scroll bars, giving the user the option of when they will be seen.
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 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 informationProgramming Languages and Techniques (CIS120)
Programming Languages and Techniques (CIS120) Lecture 32 April 9, 2018 Swing I: Drawing and Event Handling Chapter 29 HW8: Spellchecker Available on the web site Due: Tuesday! Announcements Parsing, working
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 informationGraphical User Interfaces
Graphical User Interfaces CSCI 136: Fundamentals CSCI 136: Fundamentals of Computer of Science Computer II Science Keith II Vertanen Keith Vertanen Copyright 2011 Overview Command line versus GUI apps
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 informationFinal Examination Semester 2 / Year 2012
Final Examination Semester 2 / Year 2012 COURSE : JAVA PROGRAMMING COURSE CODE : PROG1114 TIME : 2 1/2 HOURS DEPARTMENT : COMPUTER SCIENCE LECTURER : LIM PEI GEOK Student s ID : Batch No. : Notes to candidates:
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 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 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 informationUniversity of Cape Town Department of Computer Science Computer Science CSC1017F
First Name: Last Name: Student Number: University of Cape Town Department of Computer Science Computer Science CSC1017F Class Test 4 - Solutions Wednesday, 17 May 2006 Marks: 40 Time: 40 Minutes Approximate
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 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 informationCOMP16121 Sample Code Lecture 1
COMP16121 Sample Code Lecture 1 Sean Bechhofer, University of Manchester, Manchester, UK sean.bechhofer@manchester.ac.uk 1 SimpleFrame 1 import javax.swing.jframe; 2 3 public class SimpleFrame { 4 5 /*
More informationChapter 13 Lab Advanced GUI Applications
Gaddis_516907_Java 4/10/07 2:10 PM Page 113 Chapter 13 Lab Advanced GUI Applications Objectives Be able to add a menu to the menu bar Be able to use nested menus Be able to add scroll bars, giving the
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 informationGraphical User Interfaces 2
Graphical User Interfaces 2 CSCI 136: Fundamentals CSCI 136: Fundamentals of Computer of Science Computer II Science Keith II Vertanen Keith Vertanen Copyright 2011 Extending JFrame Dialog boxes Overview
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 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 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 informationGUI Applications. Let s start with a simple Swing application in Java, and then we will look at the same application in Jython. See Listing 16-1.
GUI Applications The C implementation of Python comes with Tkinter for writing Graphical User Interfaces (GUIs). The GUI toolkit that you get automatically with Jython is Swing, which is included with
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 informationnavlakhi.com / navlakhi.education / navlakhi.mobi / navlakhi.org 1
Example 1 public class ex1 extends JApplet public void init() Container c=getcontentpane(); c.setlayout(new GridLayout(5,2)); JButton b1=new JButton("Add"); JButton b2=new JButton("Search"); JLabel l1=new
More information17 GUI API: Container 18 Hello world with a GUI 19 GUI API: JLabel 20 GUI API: Container: add() 21 Hello world with a GUI 22 GUI API: JFrame: setdefau
List of Slides 1 Title 2 Chapter 13: Graphical user interfaces 3 Chapter aims 4 Section 2: Example:Hello world with a GUI 5 Aim 6 Hello world with a GUI 7 Hello world with a GUI 8 Package: java.awt and
More informationAbstract, Interface, GUIs. Ch. 11 & 16
Abstract, Interface, GUIs Ch. 11 & 16 Abstract A class declared abstract cannot be instan:ated (we can t create an object of its type). A method declared abstract MUST be implemented if a class subclasses
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 informationCOMP Assignment #10 (Due: Monday, March 11:30pm)
COMP1406 - Assignment #10 (Due: Monday, March 31st @ 11:30pm) In this assignment you will practice using recursion with data structures. (1) Consider the following BinaryTree class: public class BinaryTree
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 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 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 informationGUI (Graphic User Interface) Programming. Part 2 (Chapter 8) Chapter Goals. Events, Event Sources, and Event Listeners. Listeners
GUI (Graphic User Interface) Programming Part 2 (Chapter 8) Chapter Goals To understand the Java event model To install action and mouse event listeners To accept input from buttons, text fields, and the
More information1 Looping Constructs (4 minutes, 2 points)
Name: Career Account ID: Recitation#: 1 CS180 Spring 2011 Final Exam, 3 May, 2011 Prof. Chris Clifton Turn Off Your Cell Phone. Use of any electronic device during the test is prohibited. Time will be
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 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 informationChapter 11: Exceptions Lab Exercises
Chapter 11: Exceptions Lab Exercises Topics Exceptions File Input and Output Mnemonics Tooltips Disabling Buttons Combo Boxes Scroll Panes Lab Exercises Exceptions Aren t Always Errors Placing Exception
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 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 informationFinal Examination Semester 2 / Year 2010
Southern College Kolej Selatan 南方学院 Final Examination Semester 2 / Year 2010 COURSE : JAVA PROGRAMMING COURSE CODE : PROG1114 TIME : 2 1/2 HOURS DEPARTMENT : COMPUTER SCIENCE LECTURER : LIM PEI GEOK Student
More informationObject-Oriented Software Engineering. PersonGui (Mark 1) Case Study
Object-Oriented Software Engineering PersonGui (Mark 1) Case Study Contents The PersonGui (Mark1) The The Person Gui (Mark1) ToolBar PersonGui Constructor Adding Buttons Making Buttons Handling Events
More informationGUI Basics. Object Orientated Programming in Java. Benjamin Kenwright
GUI Basics Object Orientated Programming in Java Benjamin Kenwright Outline Essential Graphical User Interface (GUI) Concepts Libraries, Implementation, Mechanics,.. Abstract Windowing Toolkit (AWT) Java
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 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 informationDEPARTMENT OF COMPUTER APPLICATIONS SRM UNIVERSITY MC0617 ADVANCEDJAVA - LABMANUAL LAB LESSON PLAN. S.No. List of Exercises Batch I Batch II
DEPARTMENT OF COMPUTER APPLICATIONS SRM UNIVERSITY MC0617 ADVANCEDJAVA - LABMANUAL LAB LESSON PLAN S.No. List of Exercises Batch I Batch II SWING 1. Login form 31/1/2011 6/1/2011 2. Biodata 3/1/2011 13/1/2011
More informationJava Swing. Lists Trees Tables Styled Text Components Progress Indicators Component Organizers
Course Name: Advanced Java Lecture 19 Topics to be covered Java Swing Lists Trees Tables Styled Text Components Progress Indicators Component Organizers AWT to Swing AWT: Abstract Windowing Toolkit import
More informationBuilding Java Programs Bonus Slides
Building Java Programs Bonus Slides Graphical User Interfaces Copyright (c) Pearson 2013. All rights reserved. Graphical input and output with JOptionPane JOptionPane An option pane is a simple dialog
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 informationOOP Assignment V. For example, the scrolling text (moving banner) problem without a thread looks like:
OOP Assignment V If we don t use multithreading, or a timer, and update the contents of the applet continuously by calling the repaint() method, the processor has to update frames at a blinding rate. Too
More informationSwing UI. Powered by Pentalog. by Vlad Costel Ungureanu for Learn Stuff
Swing UI by Vlad Costel Ungureanu for Learn Stuff User Interface Command Line Graphical User Interface (GUI) Tactile User Interface (TUI) Multimedia (voice) Intelligent (gesture recognition) 2 Making the
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 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 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 informationHandout 14 Graphical User Interface (GUI) with Swing, Event Handling
Handout 12 CS603 Object-Oriented Programming Fall 15 Page 1 of 12 Handout 14 Graphical User Interface (GUI) with Swing, Event Handling The Swing library (javax.swing.*) Contains classes that implement
More informationimport java.applet.applet; import java.applet.audioclip; import java.net.url; public class Vjesala2 {
import java.awt.color; import java.awt.flowlayout; import java.awt.font; import java.awt.gridlayout; import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.jbutton;
More informationGraphical User Interfaces. Comp 152
Graphical User Interfaces Comp 152 Procedural programming Execute line of code at a time Allowing for selection and repetition Call one function and then another. Can trace program execution on paper from
More informationProgrammierpraktikum
Programmierpraktikum Claudius Gros, SS2012 Institut für theoretische Physik Goethe-University Frankfurt a.m. 1 of 25 17/01/13 11:45 Swing Graphical User Interface (GUI) 2 of 25 17/01/13 11:45 Graphical
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 informationGraphics programming. COM6516 Object Oriented Programming and Design Adam Funk (originally Kirill Bogdanov & Mark Stevenson)
Graphics programming COM6516 Object Oriented Programming and Design Adam Funk (originally Kirill Bogdanov & Mark Stevenson) Overview Aims To provide an overview of Swing and the AWT To show how to build
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 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 informationCompSci 125 Lecture 17. GUI: Graphics, Check Boxes, Radio Buttons
CompSci 125 Lecture 17 GUI: Graphics, Check Boxes, Radio Buttons Announcements GUI Review Review: Inheritance Subclass is a Parent class Includes parent s features May Extend May Modify extends! Parent
More informationName: CSC143 Exam 1 1 CSC 143. Exam 1. Write also your name in the appropriate box of the scantron
Name: CSC143 Exam 1 1 CSC 143 Exam 1 Write also your name in the appropriate box of the scantron Name: CSC143 Exam 1 2 Multiple Choice Questions (30 points) Answer all of the following questions. READ
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 informationTheory Test 3A. University of Cape Town ~ Department of Computer Science. Computer Science 1016S ~ For Official Use
Please fill in your Student Number and, optionally, Name. For Official Use Student Number : Mark : Name : Marker : University of Cape Town ~ Department of Computer Science Computer Science 1016S ~ 2007
More informationRobotPlanning.java Page 1
RobotPlanning.java Page 1 import java.awt.*; import java.awt.event.*; import java.awt.image.*; import javax.swing.*; import javax.swing.border.*; import java.util.*; * * RobotPlanning - 1030 GUI Demonstration.
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 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 informationProctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.
QUEEN'S UNIVERSITY SCHOOL OF COMPUTING HAND IN Answers Are Recorded on Question Paper CISC124, FALL TERM, 2013 FINAL EXAMINATION 7pm to 10pm, 18 DECEMBER 2013 Instructor: Alan McLeod If the instructor
More informationITEC 120 4/14/11. Review. Need. Objectives. GUI basics JFrame JPanel JLabel, JButton, JTextField Layout managers. Lecture 38 GUI Interactivity
Review ITEC 120 Lecture 38 GUI GUI basics JFrame JPanel JLabel, JButton, JTextField Layout managers Flow / Box Border / Grid Objectives Need Add interactivity When you click on a button How does your code
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 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 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 informationencompass a group of features for building Graphical User Interfaces (GUI).
Java GUI (intro) JFC Java Foundation Classes encompass a group of features for building Graphical User Interfaces (GUI). javax.swing.* used for building GUIs. Some basic functionality is already there
More informationCSCI 136 Written Exam #2 Fundamentals of Computer Science II Spring 2012
CSCI 136 Written Exam #2 Fundamentals of Computer Science II Spring 2012 Name: This exam consists of 6 problems on the following 8 pages. You may use your double- sided hand- written 8 ½ x 11 note sheet
More information