-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTask.java
More file actions
112 lines (89 loc) · 2.54 KB
/
Task.java
File metadata and controls
112 lines (89 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Task extends JPanel{
JLabel srno;
JTextField taskName;
JButton done;
Boolean status;
Task(){
this.setPreferredSize(new Dimension(370,40));
this.setLayout(new BorderLayout());
status=false;
srno= new JLabel();
srno.setPreferredSize(new Dimension(20,20));
srno.setHorizontalAlignment(JLabel.CENTER);
srno.setForeground(new Color(255,255,255));
srno.setBackground(new Color(54,57,63));
srno.setOpaque(true);
this.add(srno,BorderLayout.WEST);
taskName= new JTextField(" Enter your task");
taskName.setBorder(BorderFactory.createEmptyBorder());
taskName.setBackground(Color.gray);
taskName.setForeground(new Color(255,255,255));
taskName.setCaretColor(Color.white);
this.add(taskName,BorderLayout.CENTER);
done= new JButton("Done");
done.setPreferredSize(new Dimension(40,20));
done.setBorder(BorderFactory.createEmptyBorder());
done.setBackground(new Color(59,165,93));
done.setForeground(Color.white);
this.add(done,BorderLayout.EAST);
}
Task(String a, String b){
this.setPreferredSize(new Dimension(370,40));
this.setLayout(new BorderLayout());
if(Integer.parseInt(b)==1)
status=true;
else
status=false;
srno= new JLabel();
srno.setPreferredSize(new Dimension(20,20));
srno.setHorizontalAlignment(JLabel.CENTER);
srno.setForeground(new Color(255,255,255));
srno.setBackground(new Color(54,57,63));
srno.setOpaque(true);
taskName= new JTextField(a);
taskName.setBorder(BorderFactory.createEmptyBorder());
taskName.setBackground(Color.gray);
taskName.setForeground(new Color(255,255,255));
done= new JButton("done");
done.setPreferredSize(new Dimension(40,20));
done.setBorder(BorderFactory.createEmptyBorder());
done.setBackground(new Color(59,165,93));
if(status){
taskName.setBackground(new Color(59,165,93));
done.setBackground(new Color(86,138,196));
}
this.add(srno,BorderLayout.WEST);
this.add(taskName,BorderLayout.CENTER);
this.add(done,BorderLayout.EAST);
}
public void changeIndex(int num){
this.srno.setText(num+"");
this.revalidate();
}
public void changeState(){
taskName.setBackground(new Color(59,165,93));
done.setBackground(new Color(86,138,196));
status=true;
}
public JButton getDone(){
return done;
}
//for DB
public String getTaskName(){
return taskName.getText();
}
public boolean getStatus(){
return status;
}
//for DB
public int getIntStatus(){
int val = (status) ? 1 : 0;
return val;
}
public JLabel getSrNo(){
return srno;
}
}