Getting Started with Java Development and Testing: Netbeans IDE, Ant & JUnit

Size: px
Start display at page:

Download "Getting Started with Java Development and Testing: Netbeans IDE, Ant & JUnit"

Transcription

1 Getting Started with Java Development and Testing: Netbeans IDE, Ant & JUnit 1. Introduction These tools are all available free over the internet as is Java itself. A brief description of each follows. They are demonstrated in this example. Java Netbeans latest version of Java. Online documentation and tutorials are also available an integrated development environment. Includes Ant. Ant JUnit tool/classes for automated building and other tasks of software development. tool/classes for unit testing and reporting of code during development To illustrate the usage of these tools as we might want to use them in Extreme Programming (tests are written first) we will introduce a simple example application. 2. Example Application The application supports the following stories. a. There shall be 4 states. Start, Finish and 2 intermediate states. b. The user may navigate between states by using 2 buttons, Next and Back. c. The interface will visually provide feedback about the current system state. A sketch of what the application s Graphical User Interface (GUI) might look like follows: Figure 1: Sketch of application s proposed user interface (GUI). > Start State 1 State 2 Finish Back Next Tools H.O. CS435, M. Wainer page 1

2 Notice that the stories are small and lack many details. The idea is that a customer is readily available for the development team to meet with to work out the details. In this example we will assume all the stories should be implemented for this iteration. The first code that should be written (aside from a spike if necessary) are the tests which help to define what your objects should do. 3. Readying the basic classes - focus on the Model Sometimes it is hard to think about the basic objects when all you can imagine is the sketch of the GUI. However, it is commonly recognized, that the GUI and the underlying functionality are most often better implemented as separate but cooperating objects. The underlying functionality (often referred to as the model) is independent of the particular GUI used to represent and manipulate it. This follows the Model-View-Controller paradigm (see Figure 2). We can develop the model separate from the interface. This better allows porting to different window systems, development of GUI s by trained GUI designers, better use of specialized hardware, etc. There are 2 immediate advantages for us: 1. Development can proceed without needing to know GUI programming; 2. Unit tests are much more easily automated if you don t need to worry about the GUI. Thus we focus first on the model component. This object should be able to represent the states required. It should have methods that allow the view and controller to communicate user manipulation requests and to respond to state queries. The model class for our example is StateModel. Model Underlying, application object, business logic, data, etc. Q. What state are you in? A. Model is in state X User wants to move to next state. GUI View Presents the model to the user. Controller Allows user to manipulate/query the model attributes methods StateModel curstate: keeps current state getstate(): returns current state nextstate(): go to next state backstate(): go back one state Figure 2: The MVC separates the model from the way it is presented and manipulated by the user. Left, the class which represents the model for the example application. Now we can begin to write tests which confirm the behavior of the model. The tests are to be written in Java using JUnit. In effect, the tests will stand in for the View and Controller objects.writing the tests within the Netbeans environment will allow Ant to automatically, compile, execute and generate reports about the tests. Later the Ant script can be modified to switch out the model tests and add in the view and controller code and even deployment tasks. Tools H.O. CS435, M. Wainer page 2

3 4. Using Netbeans for Testing, Implementation, Etc. To get things started faster and how smooth over the process of assuring files are organized properly, begin by creating a working directory for this lab, say labintro. Copy the start.jar and build.xml files to the new directory. Bring up Netbeans and start a new project.(if this is the first time that you are using Netbeans you may also be asked to specify a directory to store your settings. On the Windows machines in the lab use H:\NetBInfo. The H drive is networked so you will have access to your settings even when you use a different PC. a. Use the Project menu to bring up the Project Manager. b. Create a New project (the example name used is toolex) c. Under the Netbeans Explorer you will need to mount a file system for your project. Make sure the Netbeans Explorer is in Filesystems mode. To mount your directory, use the File --> Mount Filesystem menu and specify a Filesystem which is a Local Directory. Select your project directory (labintro). Follow the steps in Figure After creating your new project, mount your working directory for this lab (labintro). This is what you should see in the File Explorer. Clicking on the levers shows what is inside. 2. Double-click on the unjarstart target of the build file. your path to labintro 3. The Ant script executes and decompresses the files contained in the jar file start.jar. 4. If you ve opened the build file close it and then reopen it. A new larger build.xml file should have been loaded from the jar file. 5. Also mount the directory labintro/src as a filesystem. This will allow the IDE to find the source files when it scans for parsing errors. your path to labintro Figure 3: Creating the initial files and directory structure in the labintro directory. your path to labintro/src The Ant script which we will use to automate building, testing and other tasks is in the build.xml file. Sample code to copy and paste is contained in the toolshosrc.txt file. Local property values to customize scripts are placed in the local.properties file. The source code is contained in the directory src/cs435ex1. To start with, you have source code files StateModel and StateModelTester representing the model class and a class for testing it. The model class is just stubbed as we will let the test drive the design. The next section gets us started on the testing and coding. 5. Test First Development with JUnit and Ant The purist approach to Test-First software development writes tests which will always fail at first. They fail because the code for the objects being tested hasn t been written yet so the test cannot possibly pass. Our tests will use the JUnit testing framework. Open the StateModelTester source to examine the first test. See Figure 4. Tools H.O. CS435, M. Wainer page 3

4 /* * StateModelTester.java * * Created on August 21, 2003, 4:25 PM */ package cs435ex1; import junit.framework.*; File name also gives class name We use the JUnit framework /** * wainer */ public class StateModelTester extends TestCase { extending the JUnit class TestCase /** Creates a new instance of StateModelTester */ public StateModelTester(String aname) { super(aname); public static Test suite() { return new TestSuite(StateModelTester.class); Using reflection, tests are collected and run Our test methods all begin with test public void testinitialstate() { StateModel model = new StateModel(); assertequals("check initial state", StateModel.START, model.getstate() ); JUnit provides assert methods for testing Figure 4: A start on the StateModelTester class which uses the JUnit framework to test the StateModel class. This file uses the JUnit framework to specify tests by building tests using asserts to compare the expected and actual results. To compile and run successfully, we must specify where the JUnit framework is. This will likely be different on different machines and that is why the location is specified in the local.properties file. Use the File Explorer to Edit your local.properties file to specify the directory that junit.jar is contained in. After saving you should be able to execute the compile target (in the build file) and eliminate the problems about finding JUnit. The editor will still mark JUnit methods etc. with an X, see the Common Problems section at the end of this handout to fix this. Of course, this test will still fail to compile since the method getstate() and the constant START are not even defined. A purist approach to Test-Driven-Development is to try the test and let the compiler tell you what you need to fix. The advantage of this method is that you won t be implementing things unless you absolutely need them. We will go ahead and add some code to the StateModel class so at least things will compile. Our bare-bones implementation follows. Executing the compile target should now proceed without error. Tools H.O. CS435, M. Wainer page 4

5 Figure 5: Adding just enough code to StateModel so that the first test can compile. /* * StateModel.java * * Created on August 21, 2003, 4:43 PM */ package cs435ex1; /** * wainer */ public class StateModel { static final int START = 1; added to allow compilation /** Creates a new instance of StateModel */ public StateModel() { public int getstate() { return 0; To run the tests, execute the target utest (for unit tests). A graphics display of the success or failure of your tests should appear. A green bar indicates 100% success, a red bar indicates at least one problem. (Figure 6). The compiled byte codes are written to a new directory build Figure 6: The Unit test should compile and run but as expected will fail during execution. 6. Coding to Pass the Test Production coding (and testing) with Extreme Programming is to be done with Pair Programming. That aside, the tests should drive the code. We have a test that failed so we must code what is needed to pass it. In this case, we need to maintain the state with a variable and set it properly Tools H.O. CS435, M. Wainer page 5

6 when initialized. The state also needs to be accurately retrieved. See the modifications in Figure 7 below. Running the utest target should now result in the test passing. package cs435ex1; // make sure to include the package statement public class StateModel { static final int START = 1; private int curstate; /** Creates a new instance of StateModel */ public StateModel() { curstate = START; public int getstate() { return curstate; Figure 7: Adding code to so that the StateModel passes the test. Just enough code was added to pass the test. 7. Repeating the Cycle: Test Coding, Testing, Code Corrections to Pass Tests Obviously we aren t finished yet. Many cycles of writing tests, running tests and coding are needed. A cycle takes on the order of just a few minutes. Figure 8 shows tests for the back and next navigation methods. Run these tests first to assure they fail then use Figure 9 to modify State- Model so that it passes the tests.failing and then passing is more informative than always passing. public void testbasicnavigation() { StateModel model = new StateModel(); model.nextstate(); assertequals("next to State1", StateModel.STATE1, model.getstate() ); model.nextstate(); assertequals("next to State2", StateModel.STATE2, model.getstate() ); model.backstate(); assertequals("back to State1", StateModel.STATE1, model.getstate() ); model.nextstate(); // move to state2 model.nextstate(); // move to finish assertequals("next to Finish", StateModel.FINISH, model.getstate() ); model.backstate(); assertequals("back to State2", StateModel.STATE2, model.getstate() ); Figure 8: Tests for typical navigation behavior using backstate and nextstate methods. We should make sure to test problematic areas. For example, what should happen if we try to move back from the start state or go next from the finish state? The customer should determine what sort of behavior makes sense. Part of the customer responsibility is to write tests for the stories. In this case, our rules will be that a back move from state start does nothing and a next Tools H.O. CS435, M. Wainer page 6

7 move from state finish does nothing. Figure 10 shows the test code for these exception cases. Your test cases should make sure to cover boundary conditions and other unusual cases which may be encountered. Running the Unit tests now will show the red bar as the new boundary tests fail while the earlier tests continue to pass.. public class StateModel { static final int START = 1; static final int STATE1 = 2; static final int STATE2 = 3; static final int FINISH = 4; private int curstate; /** Creates a new instance of StateModel */ public StateModel() { curstate = START; public int getstate() { return curstate; Figure 9: Code to support typical navigation behavior using backstate and nextstate methods and a current state variable. public void nextstate() { curstate++; public void backstate() { curstate--; public void testbndrynavigation() { StateModel model = new StateModel(); model.backstate(); assertequals("back from Start", StateModel.START, model.getstate() ); model.nextstate(); model.backstate(); model.backstate(); model.backstate(); assertequals("back again from Start", StateModel.START, model.getstate() ); // move from start to S1, S2, Finish model.nextstate(); model.nextstate(); model.nextstate(); assertequals("next to Finish", StateModel.FINISH, model.getstate() ); model.nextstate(); model.nextstate(); model.nextstate(); // and try to move further assertequals("nexts at Finish", StateModel.FINISH, model.getstate() ); Figure 10: Tests for navigation behavior at boundary conditions. Tools H.O. CS435, M. Wainer page 7

8 .To pass the new boundary navigation test, modify the code as shown in Figure 11. Figure 11: Revising the nextstate and backstate methods as shown can fix the problem. All tests now pass. Extreme Programming promotes the idea of keeping things simple because You Ain t Gonna Need It (YAGNI). Meaning that we shouldn t be spending a lot of effort designing for all future possibilities since many future plans are frequently changed or cancelled. We used that principle here to design a very simple mechanism for supporting state change. We expect that change will happen so when our current solution is no longer sufficient we will refactor and evolve the design. 8. Creating and Compiling the Application and Interface public void nextstate() { if (curstate < FINISH) curstate++; public void backstate() { if (curstate > START) curstate--; So far we have created the underlying object model and tests for that object. We need to create the actual user application which calls upon the model and supports interaction with the user. While progress is being made in automatic testing tools for GUI code, we will not consider that here. We construct a simple Swing interface for our example Java application; a screen shot is shown in Figure 12. In Xp you might use a spike to quickly test out ideas such as what is required for an interface. Any code developed as part of a spike does not meet the standard of production code (It wasn t developed test-first with pair programming). Figure 12: A java application which uses Swing to provide a GUI for the statemodel. As yet it is not hooked up to the StateModel code. It also fails to provide the user with sufficient feedback since the current state is not indicated. /* * StateApp.java * */ package cs435ex1; import javax.swing.*; import java.awt.*; import java.awt.event.*; /** * wainer */ public class StateApp { Figure 13: StateApp.java, source code to create the application and interface shown in Figure 12. JLabel startlabel; JLabel state1label; JLabel state2label; JLabel finishlabel; JButton nextbut; JButton backbut; public StateApp() { Tools H.O. CS435, M. Wainer page 8

9 Figure 13 continued. public static void main(string[] args) { JFrame frame = new JFrame("Example State Application GUI"); StateApp app = new StateApp(); // Create Buttons app.nextbut = new JButton("Next"); app.nextbut.addactionlistener(new ActionListener() { public void actionperformed(actionevent e) { // make the button click do something ); app.backbut = new JButton("Back"); app.backbut.addactionlistener(new ActionListener() { public void actionperformed(actionevent e) { // make the button click do something ); // group the buttons in a JPanel JPanel buttonpane = new JPanel(); // uses default flow layout buttonpane.add(app.nextbut); buttonpane.add(app.backbut); // Create the labels and have them align at their horizontal centers app.startlabel = new JLabel("Start"); app.startlabel.sethorizontalalignment(jlabel.center); app.state1label= new JLabel("State 1"); app.state1label.sethorizontalalignment(jlabel.center); app.state2label= new JLabel("State 2"); app.state2label.sethorizontalalignment(jlabel.center); app.finishlabel= new JLabel("Finish"); app.finishlabel.sethorizontalalignment(jlabel.center); JPanel labelpane = new JPanel(); // group the labels in a JPanel // Use a GridLayout to align the labels in a single column labelpane.setlayout(new GridLayout(4,1)); labelpane.add(app.startlabel); labelpane.add(app.state1label); labelpane.add(app.state2label); labelpane.add(app.finishlabel); // Place the buttons and labels into the frame frame.getcontentpane().add(buttonpane,borderlayout.south); frame.getcontentpane().add(labelpane,borderlayout.center); frame.addwindowlistener(new WindowAdapter() { // so app exits upon window closing public void windowclosing(windowevent e) { System.exit(0); ); //Finish setting up the frame, and show it. frame.pack(); frame.setsize(340,300); frame.setvisible(true); Tools H.O. CS435, M. Wainer page 9

10 The source code for StateApp.java must be added to the project directory. First you will need to create a new Java class file. It should be stored in a place consistent with its package name. Select the cs435ex1 folder which is mounted as a file system. Hold down the right button to get a popup. You will have a New option and a chance to select Java Class. Do this and name the file StateApp. Its package should be cs435ex1. After you hit finish the file should be created for you in the same place as the other source files. You can copy/paste the code from the toolshosrc.txt file. To run the application (instead of the test code), the build file needs another target. Open the build.xml file for editing. Insert the following to create a run target within your build.xml file. Once you have added the new target, it should appear in the Explorer within the build file. Selecting and executing the run target will run the StateApp class and the GUI will be displayed <target name="run" depends="compile" description="run the Application" > <java classname="cs435ex1.stateapp" failonerror="true" fork="true"> <classpath> <pathelement location="${build.dir/classes"/> </classpath> </java> </target> Figure 14: Ant target to compile and run the application. 9. Connecting the Application to the Model public void updatelabels(statemodel m) { // set all to unselected - black startlabel.setforeground(color.black); state1label.setforeground(color.black); state2label.setforeground(color.black); finishlabel.setforeground(color.black); // query the model to find and show the current state int thestate = m.getstate(); switch (thestate) { case StateModel.START: startlabel.setforeground(color.red); break; case StateModel.STATE1: state1label.setforeground(color.red); break; case StateModel.STATE2: state2label.setforeground(color.red); break; case StateModel.FINISH: finishlabel.setforeground(color.red); break; model.backstate(); // for back button only model.nextstate(); // for next button only app.updatelabels(model); //Make sure the true initial state is shown app.updatelabels(model); Define another method for StateApp. updatelabels is responsible for making sure that the interface reflects the state of the model. Red letters indicate the current state. Put final in front of the declaration for app and add a line to declare a model object. (in main) final StateModel model = new StateModel(); The button handlers act on the model and then query the model s state. (add to both button s actionperformed methods) To make sure the initial state is visualized correctly, query the model s state. (add before frame.pack() ) Figure 15: Code to add to StateApp.java to create the application and interface which utilizes the model. Tools H.O. CS435, M. Wainer page 10

11 Assuming that you have everything working so far, you have a GUI application which runs but is not connected to the model. Our strategy is to make the application act as a wrapper around the functionality of the model. The application is acting as the view and controller components; it needs to instantiate a model object. It will query the object and visualize the object s state in its interface. User interaction (control inputs) are be passed from the application to the model by calling the model object s methods. In a more sophisticated application we would probably use a full implementation of Model-View-Controller. Following the YAGNI idea we just keep it simple here. The code fragments in Figure 15 can be added to the StateApp source to produce the connected working application 10. What Next? If automatic tests aren t used to check the application/interface, manual tests are used. (Passing tests is how we know when we re done.) These tests may be associated with the stories and are provided by the customer (or by closely working with the customer to establish the tests). Developers should also get frequent feedback from the customer about the interface design and appearance. At some point, suggestions must be expressed as new stories and the customer must make the business decisions about which stories have higher priorities. Fixing bugs and glitches are necessarily compared with the value of adding new features. Requests for documentation and enhancements to the user interface can also be treated as stories. 11. Refactoring After a while, changes in code build up and you often realize that things are more complicated than they should be. The code is said to start to smell and it starts to become more error prone and difficult to maintain. Refactoring is the process of reorganizing the code. One way to tell if refactoring is appropriate is to notice if you have nearly identical code which repeats itself several times. In our example, creating JLabels uses several calls which are nearly identical for each label. A refactoring might create a new method which consolidates those calls. Figure 16 shows such a method and how it might be used. // add this method in StateApp public JLabel initlabel(string text) { JLabel lab = new JLabel(text); lab.sethorizontalalignment(jlabel.center); return lab; Figure 16: An example of refactoring that applies to StateApp. The code which creates new JLabels has been simplified by introducing a new method. // Creating Labels is now much simpler labelpane.add(app.startlabel = app.initlabel("start")); labelpane.add(app.state1label = app.initlabel("state 1")); labelpane.add(app.state2label = app.initlabel("state 2")); labelpane.add(app.finishlabel = app.initlabel("finish")); Replace the label creation code in main with the simpler refactored version. Tools H.O. CS435, M. Wainer page 11

12 12. Distribution Since it is important for your customer to obtain and run your application, you must consider how they will be able to do this with a minimum amount of fuss. Projects often consist of many class and other support files. These file are often bundled together to make distribution simpler. Java uses jar files as a standard way to do this. Figure 17 shows another target that can be added to your build file to generate a jar file for distribution. The manifest tells java which class contains main. Jar files can also be tested. One way is to run from the jar file (see figure 17). Another test would be to confirm that it actually contains the files that it should. Windows XP should recognize a jar file with a manifest indicating the main class as a double-clickable executable jar file. <target name="archive" depends="compile" description="creates a distribution jar file" > <jar casesensitive="false" destfile="${dist.dir/stateex.jar"> <fileset dir="${build.dir/classes"> <include name="**/*.class"/> <exclude name="**/*tester.class"/> </fileset> <manifest> <attribute name="main-class" value="cs435ex1.stateapp"/> </manifest> </jar> </target> <target name="runjar" depends="archive" description="run the jarred Application" > <java failonerror="true" fork="true" jar="dist/stateex.jar"/> </target> Figure 17: Ant targets to create a jar file for distribution and to test run it. 13. Final Directory Structures your path to labintro build/classes directory - compiled code is placed here. Directory is created by Ant. src directory - Our source files are placed here in subdirectories corresponding to package names. The same directory is mounted again. We mount this directory separately to enable the IDE to parse the files for errors. your path to labintro/src byte codes the compiled byte codes belonging to the cs435ex1 package dist directory - files ready for distribution placed here. Directory is created by Ant. Ant files - build.xml and local.properties. Ant runs targets in the build file. toolshosrc.txt - contains code from the H.O. for you to copy & paste. Tools H.O. CS435, M. Wainer page 12

13 Common Problems Extra subdirectories appear Make sure you have included the package statement in your source files. Check the relative positions of your files (see Figure 3 especially step 5) Can t compile test code Make sure the JUnit files are installed and the path element in your build file is given for its location. Annoying glyphs appear in the source editor The editor is scanning the files and if it can t find a particular package (like JUnit) all the functions from that file will be flagged with a red boxed x. You can tell the editor where the package is located, the scan will succeed and the glyphs will go away. From the main window open the Tools Menu and select Options (see Figure below). You ll want to pick the Editing section, Java Sources subsection and select the Expert tab. Change the Parser Class Path so it gives the location of the package which the IDE can t find. You may have to wait for the IDE to rescan the file before it notices that the statements can be parsed and removes the glyph. Editing Section; Java Sources subsection Update this path Expert tab Tools H.O. CS435, M. Wainer page 13

14 Notes: Tools H.O. CS435, M. Wainer page 14

Getting Started with Java Development and Testing: Netbeans IDE, Ant & JUnit

Getting Started with Java Development and Testing: Netbeans IDE, Ant & JUnit Getting Started with Java Development and Testing: Netbeans IDE, Ant & JUnit 1. Introduction These tools are all available free over the internet as is Java itself. A brief description of each follows.

More information

State Application Using MVC

State 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 information

Prototyping a Swing Interface with the Netbeans IDE GUI Editor

Prototyping a Swing Interface with the Netbeans IDE GUI Editor Prototyping a Swing Interface with the Netbeans IDE GUI Editor Netbeans provides an environment for creating Java applications including a module for GUI design. Here we assume that we have some existing

More information

Core XP Practices with Java and Eclipse: Part 1

Core XP Practices with Java and Eclipse: Part 1 1. Introduction Core XP Practices with Java and Eclipse: Part 1 This tutorial will illustrate some core practices of Extreme Programming(XP) while giving you a chance to get familiar with Java and the

More information

GUI Forms and Events, Part II

GUI 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 information

Control Flow: Overview CSE3461. An Example of Sequential Control. Control Flow: Revisited. Control Flow Paradigms: Reacting to the User

Control 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 information

Eclipsing Your IDE. Figure 1 The first Eclipse screen.

Eclipsing Your IDE. Figure 1 The first Eclipse screen. Eclipsing Your IDE James W. Cooper I have been hearing about the Eclipse project for some months, and decided I had to take some time to play around with it. Eclipse is a development project (www.eclipse.org)

More information

The JFrame Class Frame Windows GRAPHICAL USER INTERFACES. Five steps to displaying a frame: 1) Construct an object of the JFrame class

The 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 information

Swing from A to Z Some Simple Components. Preface

Swing 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 information

(Incomplete) History of GUIs

(Incomplete) History of GUIs CMSC 433 Programming Language Technologies and Paradigms Spring 2004 Graphical User Interfaces April 20, 2004 (Incomplete) History of GUIs 1973: Xerox Alto 3-button mouse, bit-mapped display, windows 1981:

More information

Storing and Managing Code with CVS

Storing and Managing Code with CVS Storing and Managing Code with CVS One of the most important things you do, as a software developer, is version source code and other project files. What does it mean to version a file? According to Merriam

More information

CSE 70 Final Exam Fall 2009

CSE 70 Final Exam Fall 2009 Signature cs70f Name Student ID CSE 70 Final Exam Fall 2009 Page 1 (10 points) Page 2 (16 points) Page 3 (22 points) Page 4 (13 points) Page 5 (15 points) Page 6 (20 points) Page 7 (9 points) Page 8 (15

More information

NetBeans IDE Java Quick Start Tutorial

NetBeans IDE Java Quick Start Tutorial NetBeans IDE Java Quick Start Tutorial Welcome to NetBeans IDE! This tutorial provides a very simple and quick introduction to the NetBeans IDE workflow by walking you through the creation of a simple

More information

Beyond CSE143. What s Left To Do? Templates. Using Templates. A Template Class. A Problem with Reusing Code CSE 143

Beyond CSE143. What s Left To Do? Templates. Using Templates. A Template Class. A Problem with Reusing Code CSE 143 What s Left To Do? Beyond CSE143 Templates Modern Software Development Windows and Java 143 Wrapup Beyond the C++ covered in this course Many topics, many more details of topics we did cover Main omission:

More information

Window Interfaces Using Swing Objects

Window 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 information

CSEN401 Computer Programming Lab. Topics: Graphical User Interface Window Interfaces using Swing

CSEN401 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 information

Swing from A to Z Using Focus in Swing, Part 2. Preface

Swing from A to Z Using Focus in Swing, Part 2. Preface Swing from A to Z Using Focus in Swing, Part 2 By Richard G. Baldwin Java Programming, Lecture Notes # 1042 November 27, 2000 Preface Introduction Sample Program Interesting Code Fragments Summary What's

More information

Graphical User Interface (GUI)

Graphical User Interface (GUI) Graphical User Interface (GUI) An example of Inheritance and Sub-Typing 1 Java GUI Portability Problem Java loves the idea that your code produces the same results on any machine The underlying hardware

More information

To gain experience using GUI components and listeners.

To 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 information

MIT AITI Swing Event Model Lecture 17

MIT 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 information

CPS122 Lecture: Graphical User Interfaces and Event-Driven Programming

CPS122 Lecture: Graphical User Interfaces and Event-Driven Programming CPS122 Lecture: Graphical User Interfaces and Event-Driven Programming Objectives: Last revised 1/15/10 1. To introduce the notion of a component and some basic Swing components (JLabel, JTextField, JTextArea,

More information

G51PGP Programming Paradigms. Lecture 008 Inner classes, anonymous classes, Swing worker thread

G51PGP 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 information

Building Graphical User Interfaces. GUI Principles

Building Graphical User Interfaces. GUI Principles Building Graphical User Interfaces 4.1 GUI Principles Components: GUI building blocks Buttons, menus, sliders, etc. Layout: arranging components to form a usable GUI Using layout managers. Events: reacting

More information

Frames, 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 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 information

Building 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 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 information

CS415 Human Computer Interaction

CS415 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 information

Carrera: Analista de Sistemas/Licenciatura en Sistemas. Asignatura: Programación Orientada a Objetos

Carrera: Analista de Sistemas/Licenciatura en Sistemas. Asignatura: Programación Orientada a Objetos Carrera: / Asignatura: Programación Orientada a Objetos REFACTORING EXERCISE WITH ECLIPSE - 2008- Observation: This refactoring exercise was extracted of the web site indicated in the section Reference

More information

Window Interfaces Using Swing Objects

Window 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 information

Javadocing in Netbeans (rev )

Javadocing in Netbeans (rev ) Javadocing in Netbeans (rev. 2011-05-20) This note describes how to embed HTML-style graphics within your Javadocs, if you are using Netbeans. Additionally, I provide a few hints for package level and

More information

Interfaces & Polymorphism part 2: Collections, Comparators, and More fun with Java graphics

Interfaces & 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 information

Programming Language Concepts: Lecture 8

Programming Language Concepts: Lecture 8 Programming Language Concepts: Lecture 8 Madhavan Mukund Chennai Mathematical Institute madhavan@cmi.ac.in http://www.cmi.ac.in/~madhavan/courses/pl2009 PLC 2009, Lecture 8, 11 February 2009 GUIs and event

More information

Building Graphical User Interfaces. Overview

Building Graphical User Interfaces. Overview Building Graphical User Interfaces 4.1 Overview Constructing GUIs Interface components GUI layout Event handling 2 1 GUI Principles Components: GUI building blocks. Buttons, menus, sliders, etc. Layout:

More information

First Name: AITI 2004: Exam 2 July 19, 2004

First 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 information

Graphics User Defined Forms, Part I

Graphics 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 information

Calculator Class. /** * Create a new calculator and show it. */ public Calculator() { engine = new CalcEngine(); gui = new UserInterface(engine); }

Calculator 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 information

1005ICT Object Oriented Programming Lecture Notes

1005ICT 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 information

Task-Oriented Solutions to Over 175 Common Problems. Covers. Eclipse 3.0. Eclipse CookbookTM. Steve Holzner

Task-Oriented Solutions to Over 175 Common Problems. Covers. Eclipse 3.0. Eclipse CookbookTM. Steve Holzner Task-Oriented Solutions to Over 175 Common Problems Covers Eclipse 3.0 Eclipse CookbookTM Steve Holzner Chapter CHAPTER 6 6 Using Eclipse in Teams 6.0 Introduction Professional developers frequently work

More information

Event Driven Programming

Event Driven Programming Event Driven Programming Part 1 Introduction Chapter 12 CS 2334 University of Oklahoma Brian F. Veale 1 Graphical User Interfaces So far, we have only dealt with console-based programs Run from the console

More information

Class 16: The Swing Event Model

Class 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 information

The NetBeans IDE is a big file --- a minimum of around 30 MB. After you have downloaded the file, simply execute the file to install the software.

The NetBeans IDE is a big file --- a minimum of around 30 MB. After you have downloaded the file, simply execute the file to install the software. Introduction to Netbeans This document is a brief introduction to writing and compiling a program using the NetBeans Integrated Development Environment (IDE). An IDE is a program that automates and makes

More information

Continuous Integration (CI) with Jenkins

Continuous Integration (CI) with Jenkins TDDC88 Lab 5 Continuous Integration (CI) with Jenkins This lab will give you some handson experience in using continuous integration tools to automate the integration periodically and/or when members of

More information

Java Swing Introduction

Java Swing Introduction Course Name: Advanced Java Lecture 18 Topics to be covered Java Swing Introduction What is Java Swing? Part of the Java Foundation Classes (JFC) Provides a rich set of GUI components Used to create a Java

More information

SINGLE EVENT HANDLING

SINGLE 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 information

CS 201 Software Development Methods Spring Tutorial #1. Eclipse

CS 201 Software Development Methods Spring Tutorial #1. Eclipse CS 201 Software Development Methods Spring 2005 Tutorial #1 Eclipse Written by Matthew Spear and Joseph Calandrino Edited by Christopher Milner and Benjamin Taitelbaum ECLIPSE 3.0 DEVELOPING A SIMPLE PROGRAM

More information

Topic 9: Swing. Swing is a BIG library Goal: cover basics give you concepts & tools for learning more

Topic 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 information

Topic 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!

Topic 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 information

Introduction to the JAVA UI classes Advanced HCI IAT351

Introduction 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 information

KF5008 Program Design & Development. Lecture 1 Usability GUI Design and Implementation

KF5008 Program Design & Development. Lecture 1 Usability GUI Design and Implementation KF5008 Program Design & Development Lecture 1 Usability GUI Design and Implementation Types of Requirements Functional Requirements What the system does or is expected to do Non-functional Requirements

More information

This assignment requires that you complete the following tasks (in no particular order).

This assignment requires that you complete the following tasks (in no particular order). Construction Objectives The objectives of this assignment are: (1) Implement your FCS design with high-quality code and thorough unit tests (2) Gain experience doing a task breakdown (3) Gain experience

More information

Graphic User Interfaces. - GUI concepts - Swing - AWT

Graphic 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 information

Graphical User Interface (GUI)

Graphical User Interface (GUI) Graphical User Interface (GUI) An example of Inheritance and Sub-Typing 1 Java GUI Portability Problem Java loves the idea that your code produces the same results on any machine The underlying hardware

More information

Name: Checked: Learn about listeners, events, and simple animation for interactive graphical user interfaces.

Name: Checked: Learn about listeners, events, and simple animation for interactive graphical user interfaces. Lab 15 Name: Checked: Objectives: Learn about listeners, events, and simple animation for interactive graphical user interfaces. Files: http://www.csc.villanova.edu/~map/1051/chap04/smilingface.java http://www.csc.villanova.edu/~map/1051/chap04/smilingfacepanel.java

More information

We are on the GUI fast track path

We 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 information

Programming Languages and Techniques (CIS120e)

Programming Languages and Techniques (CIS120e) Programming Languages and Techniques (CIS120e) Lecture 29 Nov. 19, 2010 Swing I Event- driven programming Passive: ApplicaHon waits for an event to happen in the environment When an event occurs, the applicahon

More information

AP CS Unit 11: Graphics and Events

AP 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 information

Introduction to Extreme Programming. Extreme Programming is... Benefits. References: William Wake, Capital One Steve Metsker, Capital One Kent Beck

Introduction to Extreme Programming. Extreme Programming is... Benefits. References: William Wake, Capital One Steve Metsker, Capital One Kent Beck Introduction to Extreme Programming References: William Wake, Capital One Steve Metsker, Capital One Kent Beck Extreme Programming is... Lightweight software development method used for small to medium-sized

More information

Construction: version control and system building

Construction: version control and system building Construction: version control and system building Paul Jackson School of Informatics University of Edinburgh The problem of systems changing Systems are constantly changing through development and use

More information

Overview. Building Graphical User Interfaces. GUI Principles. AWT and Swing. Constructing GUIs Interface components GUI layout Event handling

Overview. Building Graphical User Interfaces. GUI Principles. AWT and Swing. Constructing GUIs Interface components GUI layout Event handling Overview Building Graphical User Interfaces Constructing GUIs Interface components GUI layout Event handling 4.1 GUI Principles AWT and Swing Components: GUI building blocks. Buttons, menus, sliders, etc.

More information

Configure Eclipse with Selenium Webdriver

Configure Eclipse with Selenium Webdriver Configure Eclipse with Selenium Webdriver To configure Eclipse with Selenium webdriver, we need to launch the Eclipse IDE, create a Workspace, create a Project, create a Package, create a Class and add

More information

Object-Oriented Programming: Revision. Revision / Graphics / Subversion. Ewan Klein. Inf1 :: 2008/09

Object-Oriented Programming: Revision. Revision / Graphics / Subversion. Ewan Klein. Inf1 :: 2008/09 Object-Oriented Programming: Revision / Graphics / Subversion Inf1 :: 2008/09 Breaking out of loops, 1 Task: Implement the method public void contains2(int[] nums). Given an array of ints and a boolean

More information

Command-Line Applications. GUI Libraries GUI-related classes are defined primarily in the java.awt and the javax.swing packages.

Command-Line Applications. GUI Libraries GUI-related classes are defined primarily in the java.awt and the javax.swing packages. 1 CS257 Computer Science I Kevin Sahr, PhD Lecture 14: Graphical User Interfaces Command-Line Applications 2 The programs we've explored thus far have been text-based applications A Java application is

More information

CS Exam 1 Review Suggestions

CS 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 information

Computer Science 62 Lab 8

Computer Science 62 Lab 8 Computer Science 62 Lab 8 Wednesday, March 26, 2014 Today s lab has two purposes: it is a continuation of the binary tree experiments from last lab and an introduction to some command-line tools. The Java

More information

Assignment 1. Application Development

Assignment 1. Application Development Application Development Assignment 1 Content Application Development Day 1 Lecture The lecture provides an introduction to programming, the concept of classes and objects in Java and the Eclipse development

More information

GUI Program Organization. Sequential vs. Event-driven Programming. Sequential Programming. Outline

GUI Program Organization. Sequential vs. Event-driven Programming. Sequential Programming. Outline Sequential vs. Event-driven Programming Reacting to the user GUI Program Organization Let s digress briefly to examine the organization of our GUI programs We ll do this in stages, by examining three example

More information

Strategy Pattern. What is it?

Strategy Pattern. What is it? Strategy Pattern 1 What is it? The Strategy pattern is much like the State pattern in outline, but a little different in intent. The Strategy pattern consists of a number of related algorithms encapsulated

More information

Software Development. COMP220/COMP285 Seb Coope Ant: Structured Build

Software Development. COMP220/COMP285 Seb Coope Ant: Structured Build Software Development COMP220/COMP285 Seb Coope Ant: Structured Build These slides are mainly based on Java Development with Ant - E. Hatcher & S.Loughran. Manning Publications, 2003 Imposing Structure

More information

Widget Toolkits CS MVC

Widget Toolkits CS MVC Widget Toolkits 1 CS349 -- MVC Widget toolkits Also called widget libraries or GUI toolkits or GUI APIs Software bundled with a window manager, operating system, development language, hardware platform

More information

Lab 4. D0010E Object-Oriented Programming and Design. Today s lecture. GUI programming in

Lab 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 information

COMP-202 Unit 10: Basics of GUI Programming (Non examinable) (Caveat: Dan is not an expert in GUI programming, so don't take this for gospel :) )

COMP-202 Unit 10: Basics of GUI Programming (Non examinable) (Caveat: Dan is not an expert in GUI programming, so don't take this for gospel :) ) COMP-202 Unit 10: Basics of GUI Programming (Non examinable) (Caveat: Dan is not an expert in GUI programming, so don't take this for gospel :) ) Course Evaluations Please do these. -Fast to do -Used to

More information

Programming Languages and Techniques (CIS120)

Programming 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 information

Example: CharCheck. That s It??! What do you imagine happens after main() finishes?

Example: CharCheck. That s It??! What do you imagine happens after main() finishes? Event-Driven Software Paradigm Today Finish Programming Unit: Discuss Graphics In the old days, computers did exactly what the programmer said Once started, it would run automagically until done Then you

More information

Creating Flex Applications with IntelliJ IDEA

Creating Flex Applications with IntelliJ IDEA Creating Flex Applications with IntelliJ IDEA In this tutorial you will: 1. Create an IntelliJ IDEA project with Flex-enabled module 2. Create Ant build configuration to compile and run Flex application

More information

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #17. Loops: Break Statement

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #17. Loops: Break Statement Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #17 Loops: Break Statement (Refer Slide Time: 00:07) In this session we will see one more feature that is present

More information

Outline. Topic 9: Swing. GUIs Up to now: line-by-line programs: computer displays text user types text AWT. A. Basics

Outline. 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 information

8. Quality Assurance

8. Quality Assurance 8. Quality Assurance Prof. Dr. Dirk Riehle, M.B.A. Friedrich Alexander-University Erlangen-Nürnberg Version of 22.03.2012 Agile Methods by Dirk Riehle is licensed under a Creative Commons Attribution-

More information

Practical Objects: Test Driven Software Development using JUnit

Practical Objects: Test Driven Software Development using JUnit 1999 McBreen.Consulting Practical Objects Test Driven Software Development using JUnit Pete McBreen, McBreen.Consulting petemcbreen@acm.org Test Driven Software Development??? The Unified Process is Use

More information

Example 3-1. Password Validation

Example 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 information

CSE wi Final Exam 3/12/18. Name UW ID#

CSE wi Final Exam 3/12/18. Name UW ID# Name UW ID# There are 13 questions worth a total of 100 points. Please budget your time so you get to all of the questions. Keep your answers brief and to the point. The exam is closed book, closed notes,

More information

GUI 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. 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 information

Life Without NetBeans

Life Without NetBeans Life Without NetBeans Part A Writing, Compiling, and Running Java Programs Almost every computer and device has a Java Runtime Environment (JRE) installed by default. This is the software that creates

More information

CPS221 Lecture: Threads

CPS221 Lecture: Threads Objectives CPS221 Lecture: Threads 1. To introduce threads in the context of processes 2. To introduce UML Activity Diagrams last revised 9/5/12 Materials: 1. Diagram showing state of memory for a process

More information

Graphical User Interface (GUI)

Graphical 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 information

CSE wi Final Exam 3/12/18 Sample Solution

CSE wi Final Exam 3/12/18 Sample Solution Question 1. (8 points, 2 each) Equality. Recall that there are several different notions of object equality that we ve encountered this quarter. In particular, we have the following three: Reference equality:

More information

RAIK 183H Examination 2 Solution. November 11, 2013

RAIK 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 information

JAVA ~ as opposed to Java Script

JAVA ~ as opposed to Java Script JAVA ~ as opposed to Java Script STEP ONE: INSTALLING JAVA DEVELOPMENT TOOLS [NetBeans IDE 7.3 ]:- To program with Java, the NetBeans IDE is a wise IDE to use. There are others. https://netbeans.org/downloads/index.html

More information

Example Programs. COSC 3461 User Interfaces. GUI Program Organization. Outline. DemoHelloWorld.java DemoHelloWorld2.java DemoSwing.

Example Programs. COSC 3461 User Interfaces. GUI Program Organization. Outline. DemoHelloWorld.java DemoHelloWorld2.java DemoSwing. COSC User Interfaces Module 3 Sequential vs. Event-driven Programming Example Programs DemoLargestConsole.java DemoLargestGUI.java Demo programs will be available on the course web page. GUI Program Organization

More information

Lecture (06) Java Forms

Lecture (06) Java Forms Lecture (06) Java Forms Dr. Ahmed ElShafee 1 Dr. Ahmed ElShafee, Fundamentals of Programming I, Introduction You don t have to output everything to a terminal window in Java. In this lecture, you ll be

More information

Laboratory 1: Eclipse and Karel the Robot

Laboratory 1: Eclipse and Karel the Robot Math 121: Introduction to Computing Handout #2 Laboratory 1: Eclipse and Karel the Robot Your first laboratory task is to use the Eclipse IDE framework ( integrated development environment, and the d also

More information

Starting Out with Java: From Control Structures Through Objects Sixth Edition

Starting Out with Java: From Control Structures Through Objects Sixth Edition Starting Out with Java: From Control Structures Through Objects Sixth Edition Chapter 12 A First Look at GUI Applications Chapter Topics 12.1 Introduction 12.2 Creating Windows 12.3 Equipping GUI Classes

More information

Packaging Your Program into a Distributable JAR File

Packaging Your Program into a Distributable JAR File Colin Kincaid Handout #5 CS 106A August 8, 2018 Packaging Your Program into a Distributable JAR File Based on a handout by Eric Roberts and Brandon Burr Now that you ve written all these wonderful programs,

More information

Decisions: Logic Java Programming 2 Lesson 7

Decisions: Logic Java Programming 2 Lesson 7 Decisions: Logic Java Programming 2 Lesson 7 In the Java 1 course we learned about if statements, which use booleans (true or false) to make decisions. In this lesson, we'll dig a little deeper and use

More information

CSE 143 Au04 Midterm 1 Page 1 of 9

CSE 143 Au04 Midterm 1 Page 1 of 9 CSE 143 Au04 Midterm 1 Page 1 of 9 Question 1. (4 points) When we re modifying Java code, some of the things we do will change the coupling between the class we re working on and other classes that it

More information

Basic Keywords Practice Session

Basic Keywords Practice Session Basic Keywords Practice Session Introduction In this article from my free Java 8 course, we will apply what we learned in my Java 8 Course Introduction to our first real Java program. If you haven t yet,

More information

Embedding Graphics in JavaDocs (netbeans IDE)

Embedding Graphics in JavaDocs (netbeans IDE) Embedding Graphics in JavaDocs (netbeans IDE) This note describes how to embed HTML-style graphics within your JavaDocs, if you are using Netbeans. Additionally, I provide a few hints for package level

More information

Java Programming Lecture 6

Java 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 information

About this exam review

About this exam review Final Exam Review About this exam review I ve prepared an outline of the material covered in class May not be totally complete! Exam may ask about things that were covered in class but not in this review

More information

Eclipse Setup. Opening Eclipse. Setting Up Eclipse for CS15

Eclipse Setup. Opening Eclipse. Setting Up Eclipse for CS15 Opening Eclipse Eclipse Setup Type eclipse.photon & into your terminal. (Don t open eclipse through a GUI - it may open a different version.) You will be asked where you want your workspace directory by

More information

You Can Make a Difference! Due April 11/12 (Implementation plans due in class on 4/9)

You Can Make a Difference! Due April 11/12 (Implementation plans due in class on 4/9) You Can Make a Difference! Due April 11/12 (Implementation plans due in class on 4/9) In last week s lab, we introduced some of the basic mechanisms used to manipulate images in Java programs. Now, we

More information

Java 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 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 information