forked from laboon/SlowLifeGUI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WriteButton.java
31 lines (20 loc) · 694 Bytes
/
WriteButton.java
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
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class WriteButton extends JButton {
private MainPanel _m;
public WriteButton(MainPanel m) {
super("Write");
_m = m;
addActionListener(new WriteButtonListener());
}
class WriteButtonListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
String toWrite = _m.toString();
boolean success = FileAccess.saveFile("backup.txt", toWrite);
if (!success) {
JOptionPane.showMessageDialog((Component) e.getSource(), "COULD NOT WRITE FILE backup.txt", "BROUGHT TO YOU BY BILL LABOON", JOptionPane.WARNING_MESSAGE);
}
}
}
}