forked from pquiring/javaforce
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathViewLog.java
More file actions
executable file
·127 lines (108 loc) · 3.78 KB
/
Copy pathViewLog.java
File metadata and controls
executable file
·127 lines (108 loc) · 3.78 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
package javaforce;
/** View Log File
*
* @author pquiring
*/
import java.io.*;
public class ViewLog extends javax.swing.JFrame {
/**
* Creates new form ViewLog
*/
public ViewLog(String file) {
initComponents();
JFAWT.centerWindow(this);
try {
FileInputStream fis = new FileInputStream(file);
byte txt[] = JF.readAll(fis);
load(txt);
} catch (Exception e) {
JFLog.log(e);
}
}
public ViewLog(InputStream is) {
initComponents();
load(JF.readAll(is));
}
public ViewLog(byte txt[]) {
initComponents();
load(txt);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
close = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
txt = new javax.swing.JTextArea();
setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
formWindowClosing(evt);
}
});
close.setText("Close");
close.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
closeActionPerformed(evt);
}
});
txt.setEditable(false);
txt.setColumns(20);
txt.setRows(5);
jScrollPane1.setViewportView(txt);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(close))
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 498, Short.MAX_VALUE))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 417, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(close)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void closeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_closeActionPerformed
isClosed = true;
dispose();
}//GEN-LAST:event_closeActionPerformed
private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
isClosed = true;
}//GEN-LAST:event_formWindowClosing
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
final String file = args[0];
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new ViewLog(file).setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton close;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea txt;
// End of variables declaration//GEN-END:variables
private void load(byte data[]) {
txt.setText(new String(data));
}
public boolean isClosed = false;
}