forked from YUR0ii/Red-Group
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommentPage.java
More file actions
77 lines (50 loc) · 1.55 KB
/
Copy pathCommentPage.java
File metadata and controls
77 lines (50 loc) · 1.55 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
//UNFINISHED!!!
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
public class CommentPage {
private String currentText;
private JFrame frame = new JFrame();
private JPanel panel = new JPanel();
private JButton commit = new JButton("Commit");
private JButton delete = new JButton("Delete");
private JTextField textBox = new JTextField();
CommentPage(String CT){
currentText = CT;
//frame = F;
//panel = P;
frame.add(panel);
panel.add(textBox);
textBox.setText(currentText);
frame.setSize(750,500);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
panel.setLayout(new BoxLayout(panel, BoxLayout.LINE_AXIS));
frame.setVisible(true);
initiateComponents();
}
private void initiateComponents() {
textBox.addKeyListener(new KeyListener(){
public void keyPressed(KeyEvent e) {}
public void keyReleased(KeyEvent e) {}
public void keyTyped(KeyEvent arg0) {
}
});
commit.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
frame.dispose();
}
});
delete.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
currentText = "";
frame.dispose();
}
});
}
}