Skip to content

Commit 2d3d023

Browse files
author
DevKevYT
committed
WIP 1.9.13
1 parent 8d43ef6 commit 2d3d023

File tree

8 files changed

+95
-144
lines changed

8 files changed

+95
-144
lines changed

changelog.txt

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
/// Change log of the DevScript jar file ///
22

3-
NOTICE:
4-
the boolean "useCache" (constructor) is still useless, the command cache will be added in future updates to make the script even faster.
5-
Another future plan: Command: "include <abs|rel> <pathToFile>" a command to include external compiled libraries "plug in style".
6-
Added in 1.8.0 with the command: import "path_to_jar";
7-
83
1.9.13:
94
- The "import" command got very few love the last updates:
105
- The class of the imported .jar file only has to extend the "Library" class and does not need to be named "CustomLibrary"
@@ -17,8 +12,9 @@ NOTICE:
1712
- gui.clear
1813
- gui.setSize [sizeX] [sizeY]
1914
- gui.fullscreen [true/false]
20-
(The command "clearConsole" is still available but will be removed in future releases by the "window.clear" command)
21-
15+
(The command "clearConsole" is still available but will be removed in future releases by the "gui.clear" command)
16+
- Started to make some plans to implement a simple graphics library to control java awt elements.
17+
2218
1.9.12:
2319
- DevScript can now property handle the null variable $null. (="undefined")
2420
- Added an explanation for the "wait" command

src/com/devkev/devscript/raw/Process.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,6 @@ public synchronized void kill(Block block, String errorMessage) {
650650

651651
if(block == null) {
652652
error("A java error happened outside of the devscript environment: " + errorMessage);
653-
kill(main, "Unknown Java Exception");
654653
return;
655654
} else {
656655
//Check block and parent blocks. Also, maybe create a stacktrace?

src/com/devkev/gui/Console.java

Lines changed: 59 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
import java.awt.event.ActionEvent;
1717
import javax.swing.JTextArea;
1818
import javax.swing.ImageIcon;
19+
import javax.swing.border.LineBorder;
20+
import java.awt.Color;
21+
import javax.swing.JLabel;
1922

2023
public class Console extends JFrame {
2124

@@ -24,46 +27,86 @@ public class Console extends JFrame {
2427
private com.devkev.devscript.raw.Process p;
2528
private Window parent;
2629

30+
JTextArea consoleText;
31+
JScrollPane consolePane;
32+
JLabel consoleStatus;
33+
2734
volatile boolean waitForEnter = false;
2835
volatile int inputStart = 0;
2936

3037
public Console(com.devkev.devscript.raw.Process p, Window parent) {
38+
setTitle("DevScript Console");
3139
this.p = p;
3240
this.parent = parent;
3341
init();
3442
}
3543

3644
private void init() {
3745
setFont(new Font("Consolas", Font.PLAIN, 12));
38-
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
3946
setBounds(100, 100, 500, 239);
47+
setFocusableWindowState(true);
48+
setEnabled(true);
4049

4150
contentPane = new JPanel();
4251
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
43-
52+
4453
setContentPane(contentPane);
4554
contentPane.setLayout(null);
4655

4756
JButton terminate = new JButton("");
48-
terminate.setIcon(new ImageIcon("C:\\Users\\Philipp\\Desktop\\terminate-active.png"));
57+
terminate.setToolTipText("Terminate");
58+
terminate.setBorder(new LineBorder(new Color(0, 0, 0)));
59+
terminate.setIcon(new ImageIcon(Console.class.getResource("/icon/terminate-active.png")));
4960
terminate.addActionListener(new ActionListener() {
5061
public void actionPerformed(ActionEvent arg0) {
5162
}
5263
});
53-
terminate.setBounds(451, 166, 23, 23);
64+
terminate.setBounds(456, 5, 23, 23);
65+
terminate.addActionListener(new ActionListener() {
66+
@Override
67+
public void actionPerformed(ActionEvent e) {
68+
if(parent.p.isRunning()) {
69+
parent.p.kill(parent.p.getMain(), "Terminated by DevScript Console");
70+
consolePane.getVerticalScrollBar().setValue(consolePane.getVerticalScrollBar().getMaximum());
71+
}
72+
}
73+
});
74+
5475
contentPane.add(terminate);
5576

5677
JButton rerun = new JButton("");
57-
rerun.setIcon(new ImageIcon("C:\\Users\\Philipp\\Desktop\\rerun-active.png"));
58-
rerun.setBounds(418, 166, 23, 23);
78+
rerun.setToolTipText("Rerun Script");
79+
rerun.setBorder(new LineBorder(new Color(0, 0, 0)));
80+
rerun.setIcon(new ImageIcon(Console.class.getResource("/icon/rerun-active.png")));
81+
rerun.setBounds(429, 5, 23, 23);
82+
rerun.addActionListener(new ActionListener() {
83+
@Override
84+
public void actionPerformed(ActionEvent e) {
85+
if(p.isRunning()) return;
86+
87+
consoleText.setText("");
88+
toFront();
89+
setEnabled(true);
90+
consoleStatus.setText("Running ...");
91+
setVisible(true);
92+
//window.setEnabled(false);
93+
94+
p.execute(parent.textArea.getText(), true);
95+
p.setVariable("keyCode", "", false, true);
96+
}
97+
});
5998
contentPane.add(rerun);
6099

61-
JScrollPane scrollPane = new JScrollPane();
62-
scrollPane.setBounds(10, 11, 464, 144);
63-
contentPane.add(scrollPane);
100+
consolePane = new JScrollPane();
101+
consolePane.setBounds(5, 35, 474, 159);
102+
contentPane.add(consolePane);
103+
104+
consoleText = new JTextArea();
105+
consolePane.setViewportView(consoleText);
64106

65-
JTextArea console = new JTextArea();
66-
scrollPane.setViewportView(console);
107+
consoleStatus = new JLabel("");
108+
consoleStatus.setBounds(5, 5, 414, 23);
109+
contentPane.add(consoleStatus);
67110

68111
addKeyListener(new KeyListener() {
69112

@@ -101,16 +144,18 @@ public void windowClosing(WindowEvent arg0) {
101144
parent.window.setEnabled(true);
102145
inputStart = 0;
103146
parent.input.flush(null);
104-
console.setText("");
147+
consoleText.setText("");
105148
}
106149
public void windowActivated(WindowEvent arg0) {}
107150
});
108151

109152
addComponentListener(new ComponentListener() {
110153
@Override
111154
public void componentResized(ComponentEvent e) {
112-
console.setSize(parent.window.getRootPane().getWidth() - 10, parent.window.getRootPane().getHeight()-parent.bar.getHeight() - 10);
113-
console.updateUI();
155+
consolePane.setSize(getRootPane().getWidth() - 10, getRootPane().getHeight()-parent.bar.getHeight() - 20);
156+
terminate.setLocation(getRootPane().getWidth() - 28, 5);
157+
rerun.setLocation(getRootPane().getWidth() - 58, 5);
158+
consolePane.updateUI();
114159
}
115160
public void componentShown(ComponentEvent e) {}
116161
public void componentMoved(ComponentEvent e) {}

0 commit comments

Comments
 (0)