4
4
import java .awt .Canvas ;
5
5
import java .awt .Color ;
6
6
import java .awt .Component ;
7
+ import java .awt .Dimension ;
7
8
import java .awt .Font ;
8
9
import java .awt .Graphics2D ;
9
10
import java .awt .KeyboardFocusManager ;
@@ -82,9 +83,13 @@ public class FastDMM extends JFrame implements ActionListener, TreeSelectionList
82
83
private JLabel coords ;
83
84
public JLabel selection ;
84
85
private JTabbedPane leftTabs ;
85
- private JPanel editorPanel ;
86
+
87
+ private JPanel rightPanel ;
86
88
private JTabbedPane editorTabs ;
87
89
private Canvas canvas ;
90
+
91
+ private JTabbedPane rightBottomTabs ;
92
+ private JPanel rightBottomOutputpanel ;
88
93
89
94
private JMenuBar menuBar ;
90
95
private JMenu menuRecent ;
@@ -101,6 +106,8 @@ public class FastDMM extends JFrame implements ActionListener, TreeSelectionList
101
106
private JCheckBoxMenuItem menuItemAutoSave ;
102
107
103
108
private JPopupMenu currPopup ;
109
+
110
+ private PrintStream outputStream ;
104
111
105
112
public JTree objTreeVis ;
106
113
public JList <ObjInstance > instancesVis ;
@@ -139,9 +146,11 @@ public static final void main(String[] args) throws IOException, LWJGLException
139
146
fastdmm .init ();
140
147
fastdmm .loop ();
141
148
} catch (Exception ex ) {
149
+ // If an error gets this high you should throw an exception popup and kill the app.
142
150
StringWriter sw = new StringWriter ();
143
151
PrintWriter pw = new PrintWriter (sw );
144
152
ex .printStackTrace (pw );
153
+ ex .printStackTrace ();
145
154
JOptionPane .showMessageDialog (fastdmm , sw .getBuffer (), "Error" , JOptionPane .ERROR_MESSAGE );
146
155
System .exit (1 );
147
156
} finally {
@@ -151,7 +160,7 @@ public static final void main(String[] args) throws IOException, LWJGLException
151
160
152
161
// FastDMM is now a singleton.
153
162
private FastDMM () {
154
- }
163
+ }
155
164
156
165
// FastDMM is now a singleton.
157
166
private static FastDMM fastDMM ;
@@ -213,9 +222,9 @@ public void initSwing() {
213
222
leftTabs .addTab ("Instances" , instancesPanel );
214
223
leftPanel .add (leftTabs , BorderLayout .CENTER );
215
224
216
- editorPanel = new JPanel ();
217
- editorPanel .setLayout (new BorderLayout ());
218
- editorPanel .add (canvas , BorderLayout .CENTER );
225
+ rightPanel = new JPanel ();
226
+ rightPanel .setLayout (new BorderLayout ());
227
+ rightPanel .add (canvas , BorderLayout .CENTER );
219
228
220
229
editorTabs = new JTabbedPane ();
221
230
editorTabs .addChangeListener (new ChangeListener () {
@@ -241,10 +250,27 @@ public void stateChanged(ChangeEvent e) {
241
250
+ dmm .file .getName ().replaceFirst ("[.][^.]+$" , "" ));
242
251
}
243
252
}
244
- });
245
- editorPanel .add (editorTabs , BorderLayout .NORTH );
253
+ });
254
+ rightPanel .add (editorTabs , BorderLayout .NORTH );
255
+
256
+ rightBottomTabs = new JTabbedPane ();
257
+ rightBottomTabs .setPreferredSize (new Dimension (800 , 200 ));
258
+ rightBottomTabs .addChangeListener (new ChangeListener () {
259
+ public void stateChanged (ChangeEvent e ) {
260
+ }
261
+ });
262
+
263
+ JTextArea outputTextArea = new JTextArea ();
264
+
265
+ OutputStream outputStream = new TextAreaOutputStream (outputTextArea , "Debug" , Color .RED );
266
+
267
+ System .setErr (new PrintStream (outputStream ));
268
+
269
+ rightBottomTabs .addTab ("Output" , new JScrollPane (outputTextArea ));
270
+
271
+ rightPanel .add (rightBottomTabs , BorderLayout .SOUTH );
246
272
247
- getContentPane ().add (editorPanel , BorderLayout .CENTER );
273
+ getContentPane ().add (rightPanel , BorderLayout .CENTER );
248
274
getContentPane ().add (leftPanel , BorderLayout .WEST );
249
275
250
276
setSize (1280 , 720 );
@@ -460,6 +486,7 @@ public void actionPerformed(ActionEvent e) {
460
486
}
461
487
dmm .save ();
462
488
} catch (Exception ex ) {
489
+ ex .printStackTrace ();
463
490
StringWriter sw = new StringWriter ();
464
491
PrintWriter pw = new PrintWriter (sw );
465
492
ex .printStackTrace (pw );
@@ -608,6 +635,7 @@ public void run() {
608
635
menuRecentMaps .setVisible (true );
609
636
areMenusFrozen = false ;
610
637
} catch (Exception ex ) {
638
+ ex .printStackTrace ();
611
639
StringWriter sw = new StringWriter ();
612
640
PrintWriter pw = new PrintWriter (sw );
613
641
ex .printStackTrace (pw );
@@ -667,7 +695,7 @@ private void openDMM(File filetoopen) {
667
695
loadedMaps .add (dmm );
668
696
int mapIndex = loadedMaps .indexOf (dmm );
669
697
;
670
- editorTabs .insertTab (dmm .relPath , null , new EmptyTabPanel (editorPanel ), dmm .relPath , mapIndex );
698
+ editorTabs .insertTab (dmm .relPath , null , new EmptyTabPanel (rightPanel ), dmm .relPath , mapIndex );
671
699
editorTabs .setTabComponentAt (mapIndex , new EditorTabComponent (this , dmm ));
672
700
editorTabs .setSelectedIndex (mapIndex );
673
701
viewportX = 0 ;
@@ -679,6 +707,7 @@ private void openDMM(File filetoopen) {
679
707
StringWriter sw = new StringWriter ();
680
708
PrintWriter pw = new PrintWriter (sw );
681
709
ex .printStackTrace (pw );
710
+ ex .printStackTrace ();
682
711
JOptionPane .showMessageDialog (FastDMM .this , sw .getBuffer (), "Error" , JOptionPane .ERROR_MESSAGE );
683
712
dmm = null ;
684
713
menuItemExpand .setEnabled (false );
@@ -1141,6 +1170,7 @@ private void addToRecent(File dme, DMM dmm) {
1141
1170
try {
1142
1171
Files .write (Paths .get (path ), main .toString ().getBytes (), StandardOpenOption .CREATE );
1143
1172
} catch (IOException e ) {
1173
+ e .printStackTrace ();
1144
1174
StringWriter sw = new StringWriter ();
1145
1175
PrintWriter pw = new PrintWriter (sw );
1146
1176
e .printStackTrace (pw );
@@ -1156,6 +1186,7 @@ private void addToRecent(File dme, DMM dmm) {
1156
1186
PrintWriter pw = new PrintWriter (sw );
1157
1187
e .printStackTrace (pw );
1158
1188
JOptionPane .showMessageDialog (FastDMM .this , sw .getBuffer (), "Error" , JOptionPane .ERROR_MESSAGE );
1189
+ e .printStackTrace ();
1159
1190
}
1160
1191
main = new JSONObject (new JSONTokener (Objects .requireNonNull (reader )));
1161
1192
@@ -1223,6 +1254,7 @@ private void addToRecent(File dme, DMM dmm) {
1223
1254
writer .flush ();
1224
1255
writer .close ();
1225
1256
} catch (IOException e ) {
1257
+ e .printStackTrace ();
1226
1258
StringWriter sw = new StringWriter ();
1227
1259
PrintWriter pw = new PrintWriter (sw );
1228
1260
e .printStackTrace (pw );
@@ -1244,6 +1276,7 @@ private void initRecent(String mode) {
1244
1276
try {
1245
1277
reader = new FileReader (recentPath );
1246
1278
} catch (FileNotFoundException e ) {
1279
+ e .printStackTrace ();
1247
1280
StringWriter sw = new StringWriter ();
1248
1281
PrintWriter pw = new PrintWriter (sw );
1249
1282
e .printStackTrace (pw );
@@ -1318,6 +1351,7 @@ private void convertintojson() {
1318
1351
}
1319
1352
}
1320
1353
} catch (IOException e ) {
1354
+ e .printStackTrace ();
1321
1355
StringWriter sw = new StringWriter ();
1322
1356
PrintWriter pw = new PrintWriter (sw );
1323
1357
e .printStackTrace (pw );
@@ -1328,6 +1362,7 @@ private void convertintojson() {
1328
1362
try {
1329
1363
Files .write (Paths .get (dummy ), "" .getBytes (), StandardOpenOption .CREATE );
1330
1364
} catch (IOException e ) {
1365
+ e .printStackTrace ();
1331
1366
StringWriter sw = new StringWriter ();
1332
1367
PrintWriter pw = new PrintWriter (sw );
1333
1368
e .printStackTrace (pw );
0 commit comments