📄 timetable.java
字号:
ee.setVisible(true);
}
me2.setState(false);
}
if(cb==me2)
{
System.out.println("edit form3");
if(c==3)
{
System.out.println("edit3 is presses");
ee3.setVisible(true);
}
me1.setState(false);
}
}
public void actionPerformed(ActionEvent ae)
{
MenuItem s =(MenuItem)ae.getSource();
System.out.println(" action performed "+s);
if(s==mf1)
{
op.setVisible(true);
}
}
public void notice(int form2)
{
System.out.println(" the main ok "+form2);
if(form2==1)
{
cl.show(p1,"pan5");
c=2;
mg1.setState(false);
mg3.setState(false);
}
if(form2==2)
{
System.out.println("form3");
p5.database();
mg2.disable();
if(pan1.error==0)
{
cl.show(p1,"pan2");
c=3;
mg1.setState(false);
mg2.setState(false);
mg3.enable();
mg3.setState(true);
}
else
{
mg1.setState(true);
mg2.setState(false);
mg3.setState(false);
mg3.disable();
}
}
if(form2==3)
{
System.out.println("form3");
cl.show(p1,"pan2");
c=3;
mg1.setState(false);
mg2.setState(false);
}
}
public static void main(String arg[])
{
scheduler h = new scheduler();
}
}
//********************************************************************
class Mycanvas extends Canvas implements FocusListener
{
log2 www;
String str="hai";
int y=0;
float x=0;
static int i=1;
Mycanvas(log2 www)
{
this.www=www;
setBounds(7,7,230,20);
addFocusListener(this);
// repaint();
}
public void drawstring(String str,int x,int y,int x1,int y1)
{
// this.setBackground(new Color(10,20,20));
//this.setForeground(new Color(10,20,250));
www.app(" drawstring entered");
System.out.println("drawstring enteered");
Graphics ggg= getGraphics();
}
public void focusGained(FocusEvent fe)
{
//www.app("focus gained");
repaint();
}
public void focusLost(FocusEvent fe)
{
//www.app("focus lost");
}
public void draw(float x,float total)
{ x--;
this.x=x;
this.validate();
Graphics gg=getGraphics();
float iv=(x/total);
float div=(iv*iv*iv)*235;
for(int i=0;i<=22;i++)
{
gg.drawLine(0,i,(int)div,i);
}
this.requestFocus();
}
}
/* form 3 */
/**********************************************************************************************************/
class pan1 extends Panel implements ActionListener,ItemListener,FocusListener,KeyListener
{
static int error=0;
int finished=0;
Canvas can;
Mycanvas can1;
Label fg1,fg2;
Label e1,e2,e3,e4,e5;
Label l0,l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,l13,l14,l15,l16,l30,l40,l50,l51,lab;
Checkbox c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,check1,check3,check4,check2,check5,check6,check7,check8,check9,check10,check11,check12;
TextField tf1,tf3,tf4,tf5,tf6,tf7,tf8,tf9,tf10,tf11,tf12,tf13,tf14,tf15,tf16;
Panel np,sp,ep,wp,cp,emp,emp1,emp2,emp3,emp4,ap,ap1,ap2,ap3,p1,p2,p3,p4,p5,p0;
Panel add1,add2,add3,add4,pp1,pp2,pp3,pp4,ppp;
Button b1,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b17,b18,b30,b40,b41;
Choice ch,ch1,ch2,ch3,ch4,ch5,ch6,ch7,ch8,ch9,ch10,ch11,ch12,ch30,ch40,ch50,chhh;
String s;
Frame parent;
int max_limit=0, cont_enter=0;
static int esc_key=0,div;
int current_backtrack_no=0;
class_structure classes[]=new class_structure[50];
staff_structure ss[]=new staff_structure[100];
schedule sch[][][]=new schedule[50][7][20];
log2 www=new log2();
backtrack bb[]=new backtrack[300];
/*object to time table class is subject[][] */
Random r=new Random();
time_table subject[][];
int count=1;
int total_intid=0;
static int no_of_round=0;
int k=0,kk=0,counter_class=0,serial_no=0,special_period_flag=0,lab_counter=0;
int ALL = 100;
int unable_to_set=0;
int back_set=0,max_backtrack_no=0;
int counter=0,ct=0;
int init_counter=0,no_of_specific_period=0 ,no_of_general_period=0 ;
int no_of_general_non_attendable=0,no_of_specific_non_attendable=0;
int no_continuous_period=0;
int class_limit=0,subject_limit=0;
disp ddd = new disp();
error qqq;
int temp[]=new int[1000];
int unique_day[]=new int[10];
int dayyy[]=new int[200],perioddd[]=new int[200];
int alloted_day[]=new int[200];
int alloted_period[]=new int[200];
int alloted_continuous[]=new int[200];
int current_day=100,current_period=100;
static int yd=0;
int int_ud=0;
//
pan1(Frame parent)
{
this.parent=parent;
qqq=new error(parent,"ERROR");
subject=new time_table[50][100];
setSize(800,650);
setLayout(new BorderLayout());
setBackground(new Color(157,248,140));
setForeground(new Color(1,2,63));
b17=new Button("NEXT");
b18=new Button("READY");
b30=new Button("CONT1");
ch30=new Choice();
ch30.setSize(50,30);
ch30.resize(70,50);
b40=new Button("CONTINUESS");
Font f=new Font("SansSerif",Font.PLAIN,20);
l50=new Label("no of period");
l50.setFont(f);
l51=new Label("no of remaining per");
l51.setFont(f);
b41=new Button("EXITS");
l40=new Label("CLASS NAME");
ch40=new Choice();
ch50=new Choice();
//ch50.addItem("1");
//ch50.addItem("2");
//ch50.addItem("3");
//ch50.addItem("4");
//ch50.addItem("5");
l30=new Label("STAFF ID");
tf16=new TextField(10);
CheckboxGroup cg=new CheckboxGroup( );
CheckboxGroup mg=new CheckboxGroup( );
CheckboxGroup ng=new CheckboxGroup( );
CheckboxGroup og=new CheckboxGroup( );
CheckboxGroup ccc=new CheckboxGroup( );
np=new Panel(new GridLayout(3,1));
emp1=new Panel();
emp2=new Panel();
emp3=new Panel();
emp4=new Panel();
// emp4
l50 .setForeground(new Color(250,0,250));
l51.setForeground(new Color(250,0,250));
Font f1=new Font("SansSerif",Font.PLAIN,16);
fg1=new Label("NO OF PERIOD = ");
fg2=new Label("PERIOD AVAILABLE = ");
fg1.setForeground(new Color(210,20,20));
fg2.setForeground(new Color(210,20,20));
fg1.setFont(f1);
emp4.add(fg1);
emp4.add(l50);
fg2.setFont(f1);
emp4.add(fg2);
//p0.add(b41);
emp4.add(l51);
np.add(emp4);
//emp2
c5=new Checkbox("reservedPeriod");
c5.addItemListener(this);
c5.addFocusListener(this);
emp2.add(c5);
c6=new Checkbox("specialPeriod");
//c6.addItemListener(this);
//emp2.add(c6);
l1=new Label("subjectCode");
emp2.add(l1);
tf1=new TextField(15);
emp2.add(tf1);
Panel p=new Panel();
l2=new Label("class");
p.add(l2);
p.add(tf16);
c1=new Checkbox("lab y/n");
c1.addItemListener(this);
p.add(c1);
emp2.add(p);
np.add(emp2);
//emp3
l3=new Label("no.ofStaffUnderTaking");
emp3.add(l3);
chhh =new Choice();
emp3.add(chhh);
//tf2=new TextField(15);
//emp3.add(tf2);
c2=new Checkbox("forContinuousPeriod");
c2.addItemListener(this);
emp3.add(c2);
c3=new Checkbox("any priority");
c3.addItemListener(this);
emp3.add(c3);
c4=new Checkbox("anyNotAttendableperiod");
c4.addItemListener(this);
emp3.add(c4);
np.add(emp3);
//** add emp2,emp3,emp4 in np and add it in north of borderlayout
add(np,BorderLayout.NORTH);
//** create south panel
sp=new Panel(new GridLayout(2,1));
e1=new Label(" ");
e2=new Label(" ");
e3=new Label(" ");
e4=new Label(" ");
e5=new Label(" ");
Label e6=new Label(" progress bar ");
pp1=new Panel(new GridLayout(1,4));
sp.add(pp1);
pp2=new Panel(new GridLayout(1,2));
sp.add(pp2);
pp1.add(e1);
b1=new Button(" OK ");
b1.addActionListener(this);
b17.addActionListener(this);
b18.addActionListener(this);
b30.addActionListener(this);
b40.addActionListener(this);
pp1.add(b1);
pp1.add(b17);
pp1.add(b18);
//pp3=new Panel();
pp1.add(e2);
//ppp=new Panel();
//sp.add(ppp);
pp4=new Panel(new BorderLayout());
pp4.setBackground(new Color(250,30,100));
can1=new Mycanvas(www);
can1.setBackground(new Color(250,250,250));
e3.setBackground(new Color(85,128,141));
e4.setBackground(new Color(85,128,141));
e5.setBackground(new Color(85,128,141));
e6.setBackground(new Color(85,128,141));
//can1.setBackground(new Color(85,128,141));
//pp4.add(e3,BorderLayout.NORTH);
//pp4.add(e4,BorderLayout.SOUTH);
pp4.add(can1,BorderLayout.CENTER);
pp4.add(e5,BorderLayout.EAST);
pp4.add(e6,BorderLayout.WEST);
lab=new Label("status bar");
lab.setBackground(new Color(85,128,141));
pp2.add(lab);
pp2.add(pp4);
//sp.add(pp4);
/*sp.add(pp4);
sp.add(e3);
sp.add(e4);
sp.add(e5);*/
//add(sp,BorderLayout.SOUTH);
ep=new Panel();
//add(ep,BorderLayout.EAST);
wp=new Panel();
//add(wp,BorderLayout.WEST);
//** in center panel created p1,p2,p3,p4
cp=new Panel(new BorderLayout());
Panel cpp=new Panel(new GridLayout(3,1,10,10));
cp.add(cpp,BorderLayout.NORTH);
Panel cppp=new Panel(new GridLayout(3,1,10,10));
cp.add(cppp,BorderLayout.CENTER);
Panel cpppp=new Panel(new GridLayout(3,1,10,10));
cp.add(cpppp,BorderLayout.SOUTH);
/*staff id in north*/
Panel ppp4=new Panel();
ppp4.add(l30);
ppp4.add(ch30);
ppp4.add(b30);
cpp.add(ppp4);
/*for continuous period in north*/
p1=new Panel();
l5=new Label("noOfContinuousPeriod");
l5.disable();
p1.add(l5);
ch=new Choice();
ch.disable();
p1.add(ch);
b5=new Button("CONT2");
b5.disable();
p1.add(b5);
b6=new Button("EXT2");
b6.disable();
p1.add(b6);
cpp.add(p1);
Panel extending1=new Panel();
cpp.add(extending1);
/*generic in center */
Panel gen1=new Panel(new GridLayout(1,13,5,5));
c7=new Checkbox("generic",ccc,true);
c7.addItemListener(this);
c7.disable();
check1=new Checkbox("",mg,true);
check1.addItemListener(this);
gen1.add(c7);
gen1.add(check1);
l6=new Label("day");
l6.disable();
gen1.add(l6);
ch1=new Choice();
ch1.add("monday");
ch1.add("tuesday");
ch1.add("thursday");
ch1.add("wednesday");
ch1.add("friday");
ch1.add("saturday");
ch1.add("sunday");
ch1.disable();
gen1.add(ch1);
check2=new Checkbox("",mg,false);
check2.addItemListener(this);
gen1.add(check2);
l7=new Label("Session");
l7.disable();
gen1.add(l7);
ch5=new Choice();
ch5.add("session-I");
ch5.add("session-II");
ch5.disable();
gen1.add(ch5);
check3=new Checkbox("",mg,false);
check3.addItemListener(this);
gen1.add(check3);
l8=new Label("Period");
l8.disable();
gen1.add(l8);
ch9=new Choice();
//ch10=new Choice();
ch9.disable();
gen1.add(ch9);
b7=new Button("CONT3");
b7.setSize(20,30);
b7.disable();
gen1.add(b7);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -