Results 1 to 2 of 2
  1. #1
    jazzinspace is offline Member
    Join Date
    Jan 2008
    Posts
    5
    Rep Power
    0

    Default Appointments Diary.

    This is my first ever whole program that I am attempting. I'm trying to create a simple appointments diary in java and using jewl as my GUI.

    The system will work like this:

    Using the HashMap class I will store a date and an appointment (from the calendar class) - new HashMap<GregorianCalendar, Appointment>.

    In a seperate class I will make the appointment itself. The user can record their name, the appointment, the duration, the location and the date of the appointment. This will all be stored as a HashMap.

    This will be inputted through a jewl interface - of which I have no idea how to construct a calendar looking UI. Apparently there is a class out there that is premade that looks just like a calendar.

    I don't know how to save this Diary so that when I close the program it will open up with all the appointments in it.

    I am a little stuck for where to start to be honest. Any help would be endlessly appreciated, I'll check back on this forum 2nite. Many thanks, Jack.

  2. #2
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    8

    Default

    Java Code:
    class YourGuiClass {
        DateBook dateBook;
    
        public YourGuiClass(DateBook db) {
            dateBook = db;
        }
    
        private JPanel buildGui() {
            // put your gui components together here
            // Use the "dateBook" reference to get the
            // appointment data to fill in the gui components.
            // rturn completed component.
        }
    
    
        public static void main(String[] args) {
            DateBook db = new DateBook();
            // add your appointments ...
            YourGuiClass ygc = new YourGuiClass(db);
            JPanel content = fgc.getContent();
            JFrame f = new JFrame();
            f.add(content);
            // add other gui components as desired
            // configure and show frame
        }
    }
    
    class DateBook {
        Map<Date, Appointment> appointments;
    
        public DateBook() {
            appointments = new HashMap<Date, Appointment>();
        }
    
        public void addAppointment(Appointmment appointment) {
            appointments.add(appointment.date, appointment);
        }
    
        // other methods as desired
    }
    
    class Appointment {
        String name;
        String location;
        Date date;
        int duration;
    
        public Appointment(String name, String location,
                           Date date, int duration) {
            this.name = name;
            ...
        }
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •