rahulroy08
Programmer
Hi,
I'm working on a Java project, Which is to design an appointment scheduling software.
In my code,I have a TimeSlot class which gives the user the option to select the date and time.
But once the user selects a particular time slot for a particular day,then that must be removed from the list.
Can someone help me how to implement this,
Here is the code that creates a the frame for the TimeSlot,
<code>
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class TimeSlot1 extends Frame
{
Choice day,time;
Label l1,l2;
Button submit,cancel;
TimeSlot1()
{
setLayout(null);
setTitle("TimeSlot");
submit=new Button("Submit");
cancel=new Button("Cancel");
submit.setBounds(500,500,150,50);
cancel.setBounds(700,500,150,50);
l1=new Label("Day");
l2=new Label("Time");
l1.setBounds(150,200,50,25);
day=new Choice();
day.setBounds(200,200,100,25);
time=new Choice();
l2.setBounds(150,250,50,25);
time.setBounds(200,250,100,25);
add(day);
add(time);
add(submit);
add(cancel);
add(l1);
add(l2);
day.add(" ");
day.add("Monday");
day.add("Tuesday");
day.add("Wednesday");
day.add("Thursday");
day.add("Friday");
time.add(" ");
time.add("8.00 am");
time.add("8.15 am");
time.add("8.30 am");
time.add("8.45 am");
time.add("9.00 am");
time.add("9.15 am");
time.add("9.30 am");
time.add("9.45 am");
time.add("10.00 am");
time.add("10.15 am");
time.add("10.30 am");
time.add("10.45 am");
time.add("11.00 am");
time.add("11.15 am");
time.add("11.30 am");
time.add("11.45 am");
time.add("12.00 pm");
time.add("12.15 pm");
time.add("12.30 pm");
time.add("12.45 pm");
time.add("1.00 pm");
time.add("1.15 pm");
time.add("1.30 pm");
time.add("1.45 pm");
time.add("2.00 pm");
time.add("2.15 pm");
time.add("2.30 pm");
time.add("2.45 pm");
time.add("3.00 pm");
time.add("3.15 pm");
time.add("3.30 pm");
time.add("3.45 pm");
time.add("4.00 pm");
time.add("4.15 pm");
}
public static void main(String args[])
{
TimeSlot1 ts=new TimeSlot1();
Toolkit tk=Toolkit.getDefaultToolkit();
ts.setSize(tk.getScreenSize());
ts.setVisible(true);
}
}
</code>
Thanks,
Uday
I'm working on a Java project, Which is to design an appointment scheduling software.
In my code,I have a TimeSlot class which gives the user the option to select the date and time.
But once the user selects a particular time slot for a particular day,then that must be removed from the list.
Can someone help me how to implement this,
Here is the code that creates a the frame for the TimeSlot,
<code>
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class TimeSlot1 extends Frame
{
Choice day,time;
Label l1,l2;
Button submit,cancel;
TimeSlot1()
{
setLayout(null);
setTitle("TimeSlot");
submit=new Button("Submit");
cancel=new Button("Cancel");
submit.setBounds(500,500,150,50);
cancel.setBounds(700,500,150,50);
l1=new Label("Day");
l2=new Label("Time");
l1.setBounds(150,200,50,25);
day=new Choice();
day.setBounds(200,200,100,25);
time=new Choice();
l2.setBounds(150,250,50,25);
time.setBounds(200,250,100,25);
add(day);
add(time);
add(submit);
add(cancel);
add(l1);
add(l2);
day.add(" ");
day.add("Monday");
day.add("Tuesday");
day.add("Wednesday");
day.add("Thursday");
day.add("Friday");
time.add(" ");
time.add("8.00 am");
time.add("8.15 am");
time.add("8.30 am");
time.add("8.45 am");
time.add("9.00 am");
time.add("9.15 am");
time.add("9.30 am");
time.add("9.45 am");
time.add("10.00 am");
time.add("10.15 am");
time.add("10.30 am");
time.add("10.45 am");
time.add("11.00 am");
time.add("11.15 am");
time.add("11.30 am");
time.add("11.45 am");
time.add("12.00 pm");
time.add("12.15 pm");
time.add("12.30 pm");
time.add("12.45 pm");
time.add("1.00 pm");
time.add("1.15 pm");
time.add("1.30 pm");
time.add("1.45 pm");
time.add("2.00 pm");
time.add("2.15 pm");
time.add("2.30 pm");
time.add("2.45 pm");
time.add("3.00 pm");
time.add("3.15 pm");
time.add("3.30 pm");
time.add("3.45 pm");
time.add("4.00 pm");
time.add("4.15 pm");
}
public static void main(String args[])
{
TimeSlot1 ts=new TimeSlot1();
Toolkit tk=Toolkit.getDefaultToolkit();
ts.setSize(tk.getScreenSize());
ts.setVisible(true);
}
}
</code>
Thanks,
Uday