GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — java_ide/IDE.java at master · tonetheman/java_ide

Expand file tree

/

IDE.java

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
141 lines (127 loc) · 3.54 KB
/

IDE.java

Copy path

File metadata and controls

141 lines (127 loc) · 3.54 KB
Raw
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
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.io.*;
abstract class ParentRunnable implements Runnable {
IDE parent;
public ParentRunnable(IDE parent) {
this.parent = parent;
}
abstract public void run();
}
public class IDE {
JFrame mf = null;
DefaultListModel projectFiles = new DefaultListModel();
JList projectList = null;
DefaultListModel classPathModel = new DefaultListModel();
JList classPathList = null;
public void loadProjectFile(File f) {
try {
projectFiles.clear();
Properties props = new Properties();
FileInputStream inf = new FileInputStream(f);
props.load(inf);
int count = Integer.parseInt(
props.getProperty("sourcefiles"));
for(int i=0;i<count;i++) {
projectFiles.addElement(
props.getProperty("f"+i)
);
}
count = Integer.parseInt(
props.getProperty("classpathentries"));
for(int i=0;i<count;i++) {
classPathModel.addElement(
props.getProperty("c"+i));
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void showCompileResults(String s) {
System.out.println(s);
}
public void compileFile(String filename) {
System.out.println("compiling " + filename);
String[] args = new String[4];
args[0] = "-verbose";
args[1] = "-d";
args[2] = "./classes";
args[3] = filename;
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
com.sun.tools.javac.Main.compile(args, pw);
System.out.println(sw.toString());
}
public String loadFile(File f) {
return null;
}
public void gui() {
mf = new JFrame("ide");
mf.setSize(500,500);
mf.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
JEditorPane editor = new JEditorPane();
editor.setEditable(true);
editor.setSize(400,300);
JScrollPane scroller = new JScrollPane(editor);
scroller.setMinimumSize(new Dimension(200,200));
mf.getContentPane().setLayout(new BorderLayout());
mf.getContentPane().add(scroller, BorderLayout.CENTER);
JPanel bottom = new JPanel();
mf.getContentPane().add(bottom, BorderLayout.SOUTH);
JPanel top = new JPanel();
top.setLayout(new FlowLayout());
JButton open = new JButton("open");
open.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JFileChooser fc = new JFileChooser(".");
int ret = fc.showOpenDialog(mf);
if (ret==JFileChooser.APPROVE_OPTION) {
File inf = fc.getSelectedFile();
loadProjectFile(inf);
}
}
});
top.add(open);
JButton save = new JButton("save");
top.add(save);
JButton compile = new JButton("compile");
final ParentRunnable runner = new ParentRunnable(this) {
public void run() {
int idx = projectList.getSelectedIndex();
String filename = (String)projectFiles
.get(idx);
compileFile(filename);
}
};
compile.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
SwingUtilities.invokeLater(runner);
}
});
top.add(compile);
mf.getContentPane().add(top, BorderLayout.NORTH);
JPanel left = new JPanel();
left.setLayout(new FlowLayout());
projectList = new JList(projectFiles);
projectList.setSelectionMode(
ListSelectionModel.SINGLE_INTERVAL_SELECTION);
left.add(projectList);
classPathList = new JList(classPathModel);
left.add(classPathList);
mf.getContentPane().add(left,BorderLayout.WEST);
mf.setVisible(true);
}
public void run() {
gui();
}
public static void main(String[] args) {
IDE mainline = new IDE();
mainline.run();
}
}
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.