Course List:
http://www.c-jump.com/bcc/
CIS-257 Java Samples
First day in class demo
-
MainApp.java
(download) class MainApp uses CDemo object
-
CDemo.java
(download) class CDemo demonstartes immutable strings in Java
Date to words demo
-
MainApp.java
(download) main driver program
-
Date2TextConverter.java
(download) Date2TextConverter utility class
-
Validator.java
(download) class Validator for keyboard input
StringBuilder demo 1/30/2014
-
AppMain.java
(download) main driver program
StringBuilder replace substrings
-
MainApp.java
(download) main driver program
GregorianCalendar and Date demo 2/3/2014
-
AppMain.java
(download) main driver program
Desktop Calculator v3
-
MainApp.java
(download) main driver program
-
Validator.java
(download) class Validator for keyboard input
-
TokenStream.java
(download) class TokenStream tokenizes the input
-
AstNode.java
(download) class AstNode represents a building block for AST, the abstract syntax tree
-
Lexer.java
(download) class Lexer parses input tokens and assembles the AST
Feb 7, 2017 Inheritance Demo
-
MainApp.java
(download) main driver program
-
BaseBinaryOp.java
(download) abstract class BaseBinaryOp used as a superclass (base class)
-
BinaryOp.java
(download) class BinaryOp is a subclass (derived class)
-
MultiplyOp.java
(download) class MultiplyOp is a subclass (derived class)
-
ProgrammableAppliance.java
(download) class ProgrammableAppliance keeps ArrayList of the binary op objects
Feb 6, 2014 Inheritance Demo
-
MainApp.java
(download) main driver program
-
Employee.java
(download) class Employee
-
Manager.java
(download) class Manager extends Employee
Feb 5, 2013 Inheritance Demo v.1
-
InheritanceMain.java
(download) Main application class, InheritanceMain
-
VWCharacter.java
(download) class VWCharacter -- top of the class hierarchy
-
Cat.java
(download) class Cat extends VWCharacter
-
Dog.java
(download) class Dog extends VWCharacter
Feb 5, 2013 Inheritance C++ Demo
-
main.cpp
(download) Main application class, InheritanceMain
-
vwcharacter.h
(download) class VWCharacter -- top of the class hierarchy
-
cat.h
(download) class Cat extends VWCharacter
-
dog.h
(download) class Dog extends VWCharacter
Feb 5, 2013 Inheritance Demo v.2
-
InheritanceMain.java
(download) Main application class, InheritanceMain
-
VWCharacter.java
(download) class VWCharacter -- top of the class hierarchy
-
Cat.java
(download) class Cat extends VWCharacter
-
Dog.java
(download) class Dog extends VWCharacter
Feb 7, 2013 Product Inheritance Demo
-
Hw2Main.java
(download) Main application class
-
Product.java
(download) class Product with code, description, price attributes
-
Dvd.java
(download) class Dvd extends Product
-
Game.java
(download) class Game extends Dvd
Interface Demo
-
Printable.java
(download) Printable interface
-
Product.java
(download) class Product implements Printable interface
-
Book.java
(download) class Book extends Product implements Printable
Spring 2016 Serializable demo
-
MainApp.java
(download) App demonstrating Serializable interface
-
Employee.java
(download) class Employee implements Serializable
-
Validator.java
(download) class Validator for keyboard input
Spring 2017 Inheritance Demo
-
Company.java
(download) class Company
-
Employee.java
(download) abstract class Employee
-
EmployeeFT.java
(download) class EmployeeFT extends Employee
-
EmployeePT.java
(download) class EmployeePT extends Employee
-
EmployeeType.java
(download) enum EmployeeType
-
TimeSlotType.java
(download) enum TimeSlotType
-
TimeSlot.java
(download) abstract class TimeSlot
-
MainApp.java
(download) App demonstrating inheritance and enum types
-
TimeSlotWeekday.java
(download) class TimeSlotWeekday extends TimeSlot
-
TimeSlotWeekend.java
(download) class TimeSlotWeekend extends TimeSlot
-
TimeTable.java
(download) class TimeTable
Spring 2016 Inheritance Demo
-
MainApp.java
(download) GUI classes demonstrating inheritance
-
Component.java
(download) class Component encapsulates properties of a rectangular shape
-
Gadget.java
(download) Basic behavior of abstract GUI component
-
Window.java
(download) class Window extends Component
-
Button.java
(download) class Button extends Gadget
-
TextBox.java
(download) class TextBox extends Gadget
-
IClick.java
(download) interface IClick
-
EventHandler.java
(download) class EventHandler implements IClick
Cloneable class demo I
-
ProductsMain.java
(download) main( ) uses cloned Product object -- shallow copy
-
Product.java
(download) Cloneable class Product -- shallow copy
Cloneable class demo II
-
ProductsMain.java
(download) main( ) uses cloned Product object -- shallow copy
-
Product.java
(download) Cloneable class Product -- shallow copy
-
StringWrapper.java
(download) class StringWrapper -- makes shallow copy even worse
Cloneable class demo III
-
ProductsMain.java
(download) main( ) uses Product copy constructor -- deep copy
-
Product.java
(download) Cloneable class Product -- deep copy with copy constructor
-
StringWrapper.java
(download) class StringWrapper
Enumeration demo
-
EnumMain.java
(download) main( ) uses enumeration, import static
-
ColorConstants.java
(download) enum ColorConstants with custom values
Exception demo I
-
ExceptionsMain.java
(download) ArithmeticException, try-catch-finally
Exception demo II
-
ExceptionsMain.java
(download) ArithmeticException more specific than Exception
Exception demo III
-
ExceptionsMain.java
(download) using printStackTrace( ) and re-throw
-
ExceptionCustom.java
(download) class ExceptionCustom extends Exception
Exception demo VI
-
ExceptionsMain.java
(download) using printStackTrace( ) and throws clause
-
ExceptionCustom.java
(download) class ExceptionCustom extends Exception
Exception demo VII
-
AppMain.java
(download) using instanceof and | operators
-
ExDemo.java
(download) class ExDemoSpecific extends ExDemo
-
ExDemoSpecific.java
(download) using instanceof and } operators
Exception demo VIII
-
AppMain.java
(download) main program
-
MazeGame.java
(download) class MazeGame is a singleton class
-
ExBadUserPrivilege.java
(download) class ExBadUserPrivilege extends Exception
-
ExBadConfiguration.java
(download) class ExBadConfiguration extends Exception
Exception demo IX
-
AppMain.java
(download) using IndexOutOfBoundsException (unchecked exception)
MVC Demo - concatenate strings
-
MainWindow.java
(download) Swing window designed in NetBeans (download NetBeans form file here: MainWindow.form)
-
ControllerConcatenation.java
(download) The Controller class example
-
ConcatenationEngine.java
(download) The business object example
Swing demo A1
-
SwingMain.java
(download) Minimal JFrame and JButton example
Swing demo A1 with animation
-
SwingMain.java
(download) JFrame, JButton, and Thread.sleep() example
Swing demo A2
-
SwingMain.java
(download) Minimal JFrame, JPanel and JButton example
Swing demo A3 -- OS-specific look and feel
-
SwingMain.java
(download) UIManager.getSystemLookAndFeelClassName( ) .setLookAndFeel( )
Swing demo A4 -- Close Window Box
-
SwingMain.java
(download) JFrame.addWindowListener() JButton
Swing demo A5 -- Sublassing main application frame
-
SwingMain.java
(download) class SwingMain
-
ApplicationFrame.java
(download) class ApplicationFrame extends javax.swing.JFrame, Dimension, JPanel, java.awt.event.WindowAdapter, JFrame.addWindowListener
Swing demo A6 -- Reusable FrameApplication
-
SwingMain.java
(download) class SwingMain
-
FrameApplication.java
(download) class FrameApplication extends javax.swing.JFrame
Swing demo A7 -- GUI window with two buttons
-
SwingMain.java
(download) class SwingMain
-
FrameApplication.java
(download) class FrameApplication extends javax.swing.JFrame
-
FrameTwoButtons.java
(download) class FrameTwoButtons extends FrameApplication implements ActionListener
Swing demo A8 -- GUI window with three radio buttons
-
SwingMain.java
(download) class SwingMain
-
FrameApplication.java
(download) class FrameApplication extends javax.swing.JFrame
-
FrameApplicationClosing.java
(download) class FrameApplicationClosing extends java.awt.event.WindowAdapter
-
FrameRadioButtons.java
(download) class FrameRadioButtons extends FrameApplication implements ActionListener
-
GroupRadioButtonsListener.java
(download) class GroupRadioButtonsListener implements ActionListener
-
GroupRadioButtons.java
(download) class GroupRadioButtons extends JPanel, GroupRadioButtonsListener, JRadioButton, ButtonGroup, GridLayout, BorderFactory, Border
Swing demo A9 -- GUI window with radio buttons and menu
-
SwingMain.java
(download) class SwingMain
-
FrameApplication.java
(download) class FrameApplication extends javax.swing.JFrame
-
FrameRadioButtons.java
(download) class FrameRadioButtons extends FrameApplication implements ActionListener
-
FrameApplicationClosing.java
(download) class FrameApplicationClosing extends java.awt.event.WindowAdapter
-
GroupRadioButtons.java
(download) class GroupRadioButtons extends JPanel
-
GroupRadioButtonsListener.java
(download) class GroupRadioButtonsListener implements ActionListener
-
MenuFileExitListener.java
(download) class MenuFileExitListener extends javax.swing.AbstractAction
Swing demo A10 -- GUI window with radio buttons, menus, and dialogs
-
SwingMain.java
(download) class SwingMain
-
FrameApplication.java
(download) class FrameApplication extends javax.swing.JFrame
-
FrameRadioButtons.java
(download) class FrameRadioButtons extends FrameApplication implements ActionListener
-
FrameApplicationClosing.java
(download) class FrameApplicationClosing extends java.awt.event.WindowAdapter
-
GroupRadioButtons.java
(download) class GroupRadioButtons extends JPanel
-
GroupRadioButtonsListener.java
(download) class GroupRadioButtonsListener implements ActionListener
-
DialogViewOptions.java
(download) class DialogViewOptions extends JDialog implements ActionListener, PanelWithTabs
-
PanelWithTabs.java
(download) class PanelWithTabs extends JPanel, JLabel. JTextField
MVC Demo - Food Order
-
WindowMenu.java
(download) Main Window extends JFrame WindowMenu.form
-
WindowOrders.java
(download) Another Window extends JFrame WindowOrders.form
-
ControllerMenu.java
(download) Use Case Controller class
-
OrderHistory.java
(download) Business Object
MVC Demo - Account Balance
-
MainWindow.java
(download) Main Window extends JFrame MainWindow.form. NetBeans project: Week10_banking.zip
-
WindowAccountBalance.java
(download) Another Window extends JFrame WindowAccountBalance.form
-
ControllerTransaction.java
(download) Use Case Controller class
-
Account.java
(download) Business Object
2D Graphics demo 01
-
AppMain.java
(download) Uses JFrame with overloaded paint() method: shopsimulation_01.zip
-
ViewSimulation.java
(download) class ViewSimulation extends JFrame
-
ThreadPainter.java
(download) class ThreadPainter implements Runnable
2D Graphics demo 02 -- scratch pad designer
-
AppMain.java
(download) Uses JPanel with overloaded paint() method: shopsimulation_02.zip
-
ViewSimulation.java
(download) class ViewSimulation extends JFrame
-
ThreadPainter.java
(download) class ThreadPainter implements Runnable
-
D2Canvas.java
(download) class D2Canvas extends JPanel
2D Graphics demo 03 -- mouse events added
-
AppMain.java
(download) Download: viewdesigner_03.zip
-
ViewDesigner.java
(download) class ViewDesigner extends JFrame
-
ThreadPainter.java
(download) class ThreadPainter implements Runnable
-
D2Canvas.java
(download) class D2Canvas extends JPanel
implements MouseListener, MouseMotionListener
2D Graphics demo 04 -- controller and subject added
-
AppMain.java
(download) Download: viewdesigner_04.zip
-
ViewDesigner.java
(download) class ViewDesigner extends JFrame
-
ThreadPainter.java
(download) class ThreadPainter implements Runnable
-
D2Canvas.java
(download) class D2Canvas extends JPanel
implements MouseListener, MouseMotionListener
-
ControllerDesign.java
(download) class ControllerDesign controls all data manipulation within the use case
-
ISubject.java
(download) interface ISubject -- base interface for all simulation subjects
-
SubjectShopper.java
(download) class SubjectShopper -- sample simulation subject
Multithreading -- wait-notify-interrupt example 01
-
AppMain.java
(download) main thread calls notify() and interrupt() on a waiting worker thread
-
IOThread.java
(download) class IOThread implements Runnable -- the worker thread
Multithreading -- wait-notify-interrupt example 02
-
AppMain.java
(download) main thread calls notify() and interrupt() on a waiting worker thread
-
IOThread.java
(download) class IOThread implements Runnable -- the worker thread
-
SynchronizedCounter.java
(download) class SynchronizedCounter -- a shared resource between threads
Multithreading -- Order Queue demo
-
OrderQueueApp.java
(download) class OrderQueueApp -- main class
-
Order.java
(download) class Order
-
OrderQueue.java
(download) class OrderQueue
-
OrderTaker.java
(download) class OrderTaker extends Thread
-
OrderHandler.java
(download) class OrderHandler extends Thread
File attributes, creation time, modified time
-
AppMain.java
(download) Using Path, Paths, BasicFileAttributes, Date, and GregorianCalendar
Checking file permissions, creating directories
-
MainApp.java
(download) Using Path, Paths, Files, AccessMode.WRITE READ EXECUTE
Recursive dir traversal with Files.walkFileTree and DirectoryStream
-
AppMain.java
(download) Using DirectoryStream, BasicFileAttributes, SimpleFileVisitor, FileVisitResult
-
DirectoryVisitor.java
(download) class DirectoryVisitor extends SimpleFileVisitor
-
DirectoryParser.java
(download) class DirectoryParser implements recursive traversal algorithm
FileChannel, StandardOpenOption, and ByteBuffer
-
MainApp.java
(download) Writing raw integer into a file with FileChannel
Custom drawing using mouse
-
FrameDemo2D.java
(download) NetBeans form: FrameDemo2D.form)
-
DrawingBox2D.java
(download) class DrawingBox2D extends JPanel (custom draw box)