Notebook - an OOP Example

This is a very short, simple program that implements a personal Notebook.  It has buttons for adding notes, opening the calculator, and starting a word-processor.  We will extend this using standard OOP techniques to make a useable notebook program.  The program needs EasyApp.  Click here to download an archive : Notebook.zip

img2.gif

 

import java.awt.*;

public class Notebook extends EasyApp
{
   public static void main(String[] args)
   {  new Notebook(); }
   
   Button bAddNote = addButton("Add Note",20,50,80,30,this);
   Button bCalc = addButton("Calculator",20,90,80,30,this);
   Button bWrite = addButton("Write",20,130,80,30,this);
   
   public void actions(Object source, String command)
   {
      if (source == bAddNote)
      {  new Note(); }
      else if (source == bCalc)
      {  runProgram("calc.exe"); }
      else if (source == bWrite)
      {  runProgram("write.exe"); }
   }
}

class Note extends EasyApp
{
   Label  name = addLabel("Note",20,50,50,30,this);
   TextField id = addTextField("",70,50,150,30,this);
   TextArea info = addTextArea("",20,90,200,150,this);
   
   public Note()
   {
      setSize(250,250);
   }
   
   public void actions(Object source, String command)
   {  
      
   }    
}