Skip to content

Commit 0cbe544

Browse files
authored
Add files via upload
1 parent 6d634d1 commit 0cbe544

1 file changed

Lines changed: 37 additions & 2 deletions

File tree

com/devkev/gui/Window.java

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,15 @@
2828
import java.net.URI;
2929
import java.net.URISyntaxException;
3030
import java.util.ArrayList;
31+
import java.util.Enumeration;
32+
import java.util.jar.JarEntry;
33+
import java.util.jar.JarFile;
3134

3235
import javax.swing.BorderFactory;
3336
import javax.swing.JButton;
3437
import javax.swing.JFileChooser;
3538
import javax.swing.JFrame;
39+
import javax.swing.JLabel;
3640
import javax.swing.JMenu;
3741
import javax.swing.JMenuBar;
3842
import javax.swing.JMenuItem;
@@ -51,6 +55,7 @@
5155

5256
import com.devkev.devscript.raw.ApplicationInput;
5357
import com.devkev.devscript.raw.ApplicationListener;
58+
import com.devkev.devscript.raw.ConsoleMain;
5459
import com.devkev.devscript.raw.Output;
5560
import com.devkev.devscript.raw.Process;
5661

@@ -74,6 +79,8 @@ public class Window {
7479
private int historyIndex = 0;
7580
public int maxHistorySize = 50;
7681

82+
JLabel commandPreview;
83+
7784
public Window() {
7885
try {
7986
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
@@ -148,7 +155,7 @@ public boolean dispatchKeyEvent(KeyEvent e) {
148155

149156
JMenu m = new JMenu("File");
150157

151-
JMenuItem newFile = new JMenuItem("New");
158+
JMenuItem newFile = new JMenuItem("New...");
152159
newFile.setAccelerator(KeyStroke.getKeyStroke("control N"));
153160
newFile.addActionListener(new ActionListener() {
154161
public void actionPerformed(ActionEvent e) {
@@ -158,6 +165,8 @@ public void actionPerformed(ActionEvent e) {
158165
}
159166
});
160167
m.add(newFile);
168+
m.addSeparator();
169+
161170

162171
JMenuItem loadFile = new JMenuItem(getFormattedBarText("Open..."));
163172
loadFile.setAccelerator(KeyStroke.getKeyStroke("control O"));
@@ -190,7 +199,7 @@ public void actionPerformed(ActionEvent e) {
190199
}
191200
});
192201
m.add(loadFile);
193-
JMenuItem saveFile = new JMenuItem("Save File");
202+
JMenuItem saveFile = new JMenuItem("Save File...");
194203
saveFile.setAccelerator(KeyStroke.getKeyStroke("control S"));
195204
saveFile.addActionListener(new ActionListener() {
196205
public void actionPerformed(ActionEvent e) {
@@ -349,6 +358,32 @@ public void keyPressed(KeyEvent e) {}
349358
pane.setBorder(BorderFactory.createLineBorder(Color.BLACK));
350359
window.add(pane);
351360

361+
commandPreview = new JLabel("This is a test");
362+
commandPreview.setBorder(BorderFactory.createLineBorder(Color.black, 2));
363+
commandPreview.setBackground(Color.lightGray);
364+
commandPreview.setBounds(20, 20, 100, 40);
365+
commandPreview.setLocation(30, 30);
366+
commandPreview.addKeyListener(new KeyListener() {
367+
@Override
368+
public void keyTyped(KeyEvent e) {
369+
370+
}
371+
372+
@Override
373+
public void keyReleased(KeyEvent e) {
374+
}
375+
376+
@Override
377+
public void keyPressed(KeyEvent e) {
378+
System.out.println(e.getKeyCode());
379+
if(e.isControlDown() && e.getKeyCode() == KeyEvent.VK_SPACE) {
380+
System.out.println("PReview!");
381+
}
382+
}
383+
});
384+
commandPreview.setVisible(true);
385+
window.add(commandPreview);
386+
352387
initRunWindow();
353388
window.pack();
354389
window.setSize(500, 500);

0 commit comments

Comments
 (0)