Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
executable file
·
84 lines (63 loc) · 1.88 KB

File metadata and controls

executable file
·
84 lines (63 loc) · 1.88 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
package io;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import javax.swing.*;
public class Mirror {
JTextArea text;
public Mirror() {
show(read("./src/io/Mirror.java"));
}
class ButtonListener implements ActionListener {
public void actionPerformed(ActionEvent arg0) {
write(text.getText(), "MeModified.java");
}
}
private void show(String str) {
text = new JTextArea();
text.setText(str);
JScrollPane scroller = new JScrollPane(text);
scroller
.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
scroller
.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
scroller.setPreferredSize(new Dimension(800, 800));
JPanel panel = new JPanel();
panel.add(scroller);
JButton button = new JButton("Save");
button.addActionListener(new ButtonListener());
JFrame frame = new JFrame();
frame.getContentPane().add(BorderLayout.CENTER, panel);
frame.getContentPane().add(BorderLayout.SOUTH, button);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(900, 900);
frame.setVisible(true);
}
private String read(String file) {
String fileAsString = null;
try {
BufferedReader reader = new BufferedReader(new FileReader(file));
StringBuffer stringBuff = new StringBuffer();
String line = null;
while ((line = reader.readLine()) != null)
stringBuff.append(line).append("\n");
reader.close();
fileAsString = stringBuff.toString();
} catch (IOException e) {
System.out.println("Could not read file");
}
return fileAsString;
}
private void write(String str, String file) {
try {
BufferedWriter out = new BufferedWriter(new FileWriter(file));
out.write(str, 0, str.length());
out.close();
} catch (IOException e) {
System.out.println("Could not write to file");
}
}
public static void main(String[] args) {
new Mirror();
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.