In-class Examples List
CS 235 - Java Programming
Fall 2015
Last modified: Sunday, December 13, 2015
Important Notes:
- This is merely a selection of files and examples, most of which were
mentioned or used in the class (lectures and labs). It is not a
comprehensive
list, nor are all lectures and labs included. Formatting is generally
minimal.
- Week 15, Lecture, December 7, 2015 - a few words about packages
and jars (now including a working executable jar example)
- Week 14, Lab, December 2, 2015
-
GameDie and initial GameDieTest
for Week 14 Lab Exercise
- GameDie.java
- Week 14 Lab version, for JUnit practice;
now includes
top data field and
getTop accessor method
- GameDieTest.java
- JUnit test class for
GameDie
as it ended up at the end of the Week 14 Lecture
- Week 14, Lecture, November 30, 2015 - small intro to
testing a Java class using JUnit, small examples of
reading from and writing to a file, small examples
of a Java generic collection class (
ArrayList)
- Week 13, Lab, November 18, 2015 - take two, making sure all in
class can run JDBC from nrs-projects
- Week 13 Lab Exercise handout -
includes steps to take on nrs-projects to be able to run
JDBC from nrs-projects (for anyone who missed the Week 13 Lab!)
- paste this into the END of your .bashrc file on
nrs-projects (make sure it is a SINGLE line!) to add the Oracle
driver classes to your Java CLASSPATH:
export CLASSPATH=$CLASSPATH:/opt/oracle/product/11.2.0/client_1/oui/jlib/ojdbc6.jar:.
-
GetDate.java
- querying the current date from Oracle
-
EmpSal.java
- querying (fictitious!) employee names and salaries
from Oracle
-
AddToLog.java
- adding a row with a command-line-given name
to a table named
log_table in
Oracle
-
AddManyToLog.java
- adding a row for each command-line-given name
to a table named
log_table in
Oracle
- Week 13, Lecture, November 16, 2015 - more JDBC examples -
changing a database, committing changes when you choose,
and using a PreparedStatement
- Week 11, Lecture, November 2, 2015 - intro to JDBC (Java DataBase
Connectivity)
- Week 10, Lab, October 28, 2015 - adding a few more
components and another listener, including JMenuBar/JMenu/JMenuItem,
JComboBox, JScrollBar, and AdjustmentListener
-
Week 10 Lab
projected notes
-
ComponentPlay.java
- version as of the end of the Week 10 lab,
then, um, modified/cleaned up AFTER lab;
Java application showing examples of JCheckBox,
ItemListener, JRadioButton, JMenuBar/JMenu/JMenuItem,
JComboBox, JScrollBar, and AdjustmentListener
- Week 10, Lecture, October 26, 2015 - a few words on threads
and Swing; started discussing more components and listeners,
starting with JCheckBox, ItemListener, and JRadioButton
- Week 9, Lab, October 21, 2015 - intro to very simple graphics
and Swing; using a thread started and stopped by buttons
to control a simple animation
-
Week 9 Lab
projected notes
-
DrawPlay1.java
- Java application showing painting/drawing on
a JPanel subclass
-
BlockThread1.java
- Java application demonstrating use of a thread
to move the red rectangle across the screen - WITH
the added functionality that begin and end buttons
allow the user to start and stop the red rectangle's
movement.
- Week 9, Lecture, October 19, 2015 - intro to using the
Runnable interface to create your own threads
- Week 8, Lab, October 14, 2015 - intro to layout managers, part
2, continued - more on GridBagLayout (followed by a lab
exercise)
- Week 8, Lecture, October 12, 2015 - intro to layout managers, part 2 -
BoxLayout, NO layout (absolute positioning), started to talk about
GridBagLayout
- Week 7, Lab, October 7, 2015 - multi-panel example (with sub-panels
using different layout managers)
-
LayoutTrio.java
- A GUI application with subpanels using
different layout managers
(FlowLayout, BorderLayout, GridLayout)
- FlowOnlyEx.java
- A GUI application that currently just uses
FlowLayout (to be modified as part of today's lab
exercise)
- Week 6, Lecture, September 28, 2015 - intro to layout managers, part 1 -
FlowLayout, BorderLayout, and GridLayout
- Week 5, Lab, September 23, 2015 -
specifying justification in a
JTextField with
setHorizontalAlignment, formatting values
using System.out.printf and String.format,
and intro to handling exceptions using try-catch blocks
-
Week 5 Lab projected notes
(including DrJava
Interactions window snippets playing with
setHorizontalAlignment,
System.out.printf and String.format
-
TryMe3.java - first
try-catch example
-
Mult2.java - used for Problem 2 of Week 5 Lab Exercise
- Week 5, Lecture, September 21, 2015 - Java GUI applications continued:
adding in borders and JTextFields
- Week 4, Lab, September 16, 2015 - Java GUI applications continued:
intro to the Java 1.1 event model, making buttons sensitive
to user clicks, intro to the Font class
-
Week 4 Lab projected notes
-
ButtonTest.java - another example adapted
from "Core Java", Chapter 8;
an example of handling events in Java, handling
ActionEvents on JButtons - this is the
version created during lab
- Week 4, Lecture, September 14, 2015 - beginning of intro to Java
applications with GUIs; intro to JFrame, JPanel, JLabel
-
Week 4 Lecture projected notes
(includes excerpts from playing with
JOptionPane in DrJava Interactions
window)
-
SimpleFrameTest.java - a first JFrame example
adapted from
"Core Java", C. Horstmann
and G. Cornell, p. 340
-
SimpleLabelTest.java - example adding JLabels to
a JPanel on a JFrame
(kind of adapted from "Core Java" example's structure
from pp. 354-355)
- Week 3, Lab, September 10, 2015 - some more info on Java *objects*
for C++ programmers
- (There was no Week 3, Lecture -- September 7 was the Labor Day
holiday)
- Week 2, Lab, September 2, 2015 - Java basics for C++ programmers,
continued
- Week 2, Lecture, August 31, 2015 - Java basics for C++ programmers
- Week 1, Lab, August 26, 2015 -
two examples comparing C++ and Java
(and practicing with the CS 235 submit tool,
~st10/235submit, on nrs-projects.humboldt.edu)
Back to Course Home Page
Please send questions to:
sharon.tuttle@humboldt.edu