mirror of
https://github.com/2006-Scape/Script-Factory.git
synced 2026-07-03 00:38:11 +00:00
Made it Java 1.7 LOL
This commit is contained in:
Generated
+124
@@ -0,0 +1,124 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Palette2">
|
||||||
|
<group name="Swing">
|
||||||
|
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Button" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="RadioButton" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="CheckBox" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Label" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||||
|
<preferred-size width="-1" height="20" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
</group>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
<version>1.5</version>
|
<version>1.5</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<jdk.version>1.8</jdk.version>
|
<jdk.version>1.7</jdk.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
@@ -56,8 +56,8 @@
|
|||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>2.3.2</version>
|
<version>2.3.2</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.8</source>
|
<source>1.7</source>
|
||||||
<target>1.8</target>
|
<target>1.7</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
|||||||
+3
-2
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7">
|
||||||
<output url="file://$MODULE_DIR$/target/classes" />
|
<output url="file://$MODULE_DIR$/target/classes" />
|
||||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
@@ -11,7 +11,6 @@
|
|||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="library" name="Maven: org.parabot:client:2.8.1" level="project" />
|
|
||||||
<orderEntry type="module-library">
|
<orderEntry type="module-library">
|
||||||
<library>
|
<library>
|
||||||
<CLASSES>
|
<CLASSES>
|
||||||
@@ -21,5 +20,7 @@
|
|||||||
<SOURCES />
|
<SOURCES />
|
||||||
</library>
|
</library>
|
||||||
</orderEntry>
|
</orderEntry>
|
||||||
|
<orderEntry type="library" name="Maven: org.parabot:client:2.8.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.parabot:317-api-minified:1.201" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
@@ -50,7 +50,12 @@ public class Action {
|
|||||||
|
|
||||||
public int[] getParamArray()
|
public int[] getParamArray()
|
||||||
{
|
{
|
||||||
return params.stream().mapToInt(Integer::parseInt).toArray();
|
int[] array = new int[params.size()];
|
||||||
|
for (int i = 0; i < params.size(); i++) {
|
||||||
|
array[i] = Integer.parseInt(params.get(i));
|
||||||
|
}
|
||||||
|
return array;
|
||||||
|
//return params.stream().mapToInt(Integer::parseInt).toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action(String action, ArrayList<JTextArea> inputs) {
|
public Action(String action, ArrayList<JTextArea> inputs) {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package scriptfactory.Actions;
|
package scriptfactory.Actions;
|
||||||
|
|
||||||
|
import org.parabot.environment.api.utils.Filter;
|
||||||
import org.parabot.environment.api.utils.Time;
|
import org.parabot.environment.api.utils.Time;
|
||||||
import org.parabot.environment.input.Keyboard;
|
import org.parabot.environment.input.Keyboard;
|
||||||
import org.parabot.environment.input.Mouse;
|
import org.parabot.environment.input.Mouse;
|
||||||
@@ -97,9 +98,14 @@ public class ActionHandler {
|
|||||||
Time.sleep(a.getParam(2));
|
Time.sleep(a.getParam(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleGroundItemInteract(Action a) {
|
public void handleGroundItemInteract(final Action a) {
|
||||||
try {
|
try {
|
||||||
GroundItem item = GroundItems.getNearest(o -> o.getId() == a.getParam(0))[0];
|
GroundItem item = GroundItems.getNearest(new Filter<GroundItem>() {
|
||||||
|
@Override
|
||||||
|
public boolean accept(GroundItem o) {
|
||||||
|
return o.getId() == a.getParam(0);
|
||||||
|
}
|
||||||
|
})[0];
|
||||||
if (item == null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
log("Could not find item with id" + a.getParam(0));
|
log("Could not find item with id" + a.getParam(0));
|
||||||
@@ -121,20 +127,40 @@ public class ActionHandler {
|
|||||||
Bank.depositAllExcept(a.getParamArray());
|
Bank.depositAllExcept(a.getParamArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void interactWithEntity(int[] id, String option)
|
private void interactWithEntity(final int[] id, String option)
|
||||||
{
|
{
|
||||||
SceneObject candidateObject = SceneObjects.getClosest(id);
|
SceneObject candidateObject = SceneObjects.getClosest(id);
|
||||||
Npc candidateNpc = Npcs.getClosest(o -> !o.isInCombat() && Arrays.stream(id).anyMatch(i -> i == o.getDef().getId()));
|
Npc candidateNpc = Npcs.getClosest(new Filter<Npc>() {
|
||||||
|
@Override
|
||||||
|
public boolean accept(Npc o) {
|
||||||
|
for (int i1 : id) {
|
||||||
|
if (o.getDef().getId() == i1) {
|
||||||
|
return !o.isInCombat();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
debugString = "id: " + Arrays.toString(id);
|
debugString = "id: " + Arrays.toString(id);
|
||||||
tryToInteract(candidateObject, candidateNpc, option);
|
tryToInteract(candidateObject, candidateNpc, option);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void interactWithEntityByTile(Tile tile, String option) {
|
private void interactWithEntityByTile(final Tile tile, String option) {
|
||||||
SceneObject[] sos = SceneObjects.getNearest(o -> o.getLocation().equals(tile));
|
SceneObject[] sos = SceneObjects.getNearest(new Filter<SceneObject>() {
|
||||||
|
@Override
|
||||||
|
public boolean accept(SceneObject o) {
|
||||||
|
return o.getLocation().equals(tile);
|
||||||
|
}
|
||||||
|
});
|
||||||
SceneObject candidateObject = null;
|
SceneObject candidateObject = null;
|
||||||
if (sos.length > 0)
|
if (sos.length > 0)
|
||||||
candidateObject = sos[0];
|
candidateObject = sos[0];
|
||||||
Npc[] npca = Npcs.getNearest(o -> o.getLocation().equals(tile));
|
Npc[] npca = Npcs.getNearest(new Filter<Npc>() {
|
||||||
|
@Override
|
||||||
|
public boolean accept(Npc o) {
|
||||||
|
return o.getLocation().equals(tile);
|
||||||
|
}
|
||||||
|
});
|
||||||
Npc candidateNpc = null;
|
Npc candidateNpc = null;
|
||||||
if (npca.length > 0)
|
if (npca.length > 0)
|
||||||
candidateNpc = npca[0];
|
candidateNpc = npca[0];
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package scriptfactory.Actions.Logic;
|
package scriptfactory.Actions.Logic;
|
||||||
|
|
||||||
|
import org.parabot.environment.api.utils.Filter;
|
||||||
|
import org.rev317.min.api.wrappers.GroundItem;
|
||||||
import scriptfactory.Actions.Action;
|
import scriptfactory.Actions.Action;
|
||||||
import org.rev317.min.api.methods.*;
|
import org.rev317.min.api.methods.*;
|
||||||
|
|
||||||
@@ -9,7 +11,7 @@ import static scriptfactory.VarsMethods.log;
|
|||||||
import static scriptfactory.VarsMethods.toPintArray;
|
import static scriptfactory.VarsMethods.toPintArray;
|
||||||
|
|
||||||
public class LogicHandler {
|
public class LogicHandler {
|
||||||
public boolean determineIf(Action a) {
|
public boolean determineIf(final Action a) {
|
||||||
switch (a.getMethod().replaceAll("-", " "))
|
switch (a.getMethod().replaceAll("-", " "))
|
||||||
{
|
{
|
||||||
case "Item is in Inventory":
|
case "Item is in Inventory":
|
||||||
@@ -17,7 +19,12 @@ public class LogicHandler {
|
|||||||
case "Inventory slots used":
|
case "Inventory slots used":
|
||||||
return Inventory.getCount() >= a.getParam(0);
|
return Inventory.getCount() >= a.getParam(0);
|
||||||
case "Item is on Ground":
|
case "Item is on Ground":
|
||||||
return GroundItems.getGroundItems(o-> o.getId() == a.getParam(0)).length > 0;
|
return GroundItems.getGroundItems(new Filter<GroundItem>() {
|
||||||
|
@Override
|
||||||
|
public boolean accept(GroundItem o) {
|
||||||
|
return o.getId() == a.getParam(0);
|
||||||
|
}
|
||||||
|
}).length > 0;
|
||||||
case "Entity is around":
|
case "Entity is around":
|
||||||
ArrayList<Integer> ids = new ArrayList<>();
|
ArrayList<Integer> ids = new ArrayList<>();
|
||||||
for (int i = 0; i < a.getParamCount(); i++)
|
for (int i = 0; i < a.getParamCount(); i++)
|
||||||
|
|||||||
@@ -2,15 +2,17 @@ package scriptfactory.AdvancedGui;
|
|||||||
|
|
||||||
import scriptfactory.Actions.Action;
|
import scriptfactory.Actions.Action;
|
||||||
import scriptfactory.AdvancedGui.ScriptFactorySDN.ScriptFactorySDNGui;
|
import scriptfactory.AdvancedGui.ScriptFactorySDN.ScriptFactorySDNGui;
|
||||||
|
import scriptfactory.Consumer;
|
||||||
import scriptfactory.GUI.EnterJButton;
|
import scriptfactory.GUI.EnterJButton;
|
||||||
import scriptfactory.NewGuis.UncommonActionGuiInfo;
|
import scriptfactory.NewGuis.UncommonActionGuiInfo;
|
||||||
import scriptfactory.VarsMethods;
|
import scriptfactory.VarsMethods;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
import static scriptfactory.NewGuis.NewStatementGUI.addEscapeHotkey;
|
import static scriptfactory.NewGuis.NewStatementGUI.addEscapeHotkey;
|
||||||
import static scriptfactory.VarsMethods.log;
|
import static scriptfactory.VarsMethods.log;
|
||||||
@@ -71,8 +73,8 @@ public class AdvancedOptionsGUI extends JFrame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void generateMoveLineFrame() {
|
private void generateMoveLineFrame() {
|
||||||
JTextField lineToMove = new JTextField(6);
|
final JTextField lineToMove = new JTextField(6);
|
||||||
JTextField lineToInsertAbove = new JTextField(6);
|
final JTextField lineToInsertAbove = new JTextField(6);
|
||||||
EnterJButton submitMove = new EnterJButton("Submit");
|
EnterJButton submitMove = new EnterJButton("Submit");
|
||||||
|
|
||||||
moveLineFrame.setLayout(new GridLayout(5, 1, 5, 15));
|
moveLineFrame.setLayout(new GridLayout(5, 1, 5, 15));
|
||||||
@@ -87,49 +89,64 @@ public class AdvancedOptionsGUI extends JFrame {
|
|||||||
|
|
||||||
moveLineFrame.pack();
|
moveLineFrame.pack();
|
||||||
|
|
||||||
submitMove.addActionListener(b ->
|
submitMove.addActionListener(new ActionListener() {
|
||||||
{
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent b) {
|
||||||
int lineToMoveAsPint = VarsMethods.parsePint(lineToMove.getText());
|
int lineToMoveAsPint = VarsMethods.parsePint(lineToMove.getText());
|
||||||
int lineToPlaceAboveAsPint = VarsMethods.parsePint(lineToInsertAbove.getText());
|
int lineToPlaceAboveAsPint = VarsMethods.parsePint(lineToInsertAbove.getText());
|
||||||
|
|
||||||
Action removed = actions.remove(lineToMoveAsPint);
|
Action removed = actions.remove(lineToMoveAsPint);
|
||||||
if (lineToPlaceAboveAsPint <= lineToMoveAsPint)
|
if (lineToPlaceAboveAsPint <= lineToMoveAsPint)
|
||||||
actions.add(lineToPlaceAboveAsPint, removed);
|
actions.add(lineToPlaceAboveAsPint, removed);
|
||||||
else
|
else if (lineToPlaceAboveAsPint > actions.size())
|
||||||
if (lineToPlaceAboveAsPint > actions.size())
|
|
||||||
actions.add(removed);
|
actions.add(removed);
|
||||||
else
|
else
|
||||||
actions.add(lineToPlaceAboveAsPint - 1, removed);
|
actions.add(lineToPlaceAboveAsPint - 1, removed);
|
||||||
updateTextfield.accept(5);
|
updateTextfield.accept(5);
|
||||||
moveLineFrame.setVisible(false);
|
moveLineFrame.setVisible(false);
|
||||||
log("Successfully moved line " + lineToMove.getText() + ".");
|
log("Successfully moved line " + lineToMove.getText() + ".");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initButtons()
|
private void initButtons()
|
||||||
{
|
{
|
||||||
tipsAndTricksButton.addActionListener(o -> {
|
tipsAndTricksButton.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent o) {
|
||||||
tipsFrame.setVisible(true);
|
tipsFrame.setVisible(true);
|
||||||
this.setVisible(false);
|
AdvancedOptionsGUI.this.setVisible(false);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
moveLineButton.addActionListener(o -> {
|
moveLineButton.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent o) {
|
||||||
moveLineFrame.setVisible(true);
|
moveLineFrame.setVisible(true);
|
||||||
this.setVisible(false);
|
AdvancedOptionsGUI.this.setVisible(false);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
recoverPreviousScript.addActionListener(o ->
|
recoverPreviousScript.addActionListener(new ActionListener() {
|
||||||
{
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent o) {
|
||||||
VarsMethods.loadscript(actions, new File(VarsMethods.CACHED_LOC));
|
VarsMethods.loadscript(actions, new File(VarsMethods.CACHED_LOC));
|
||||||
updateTextfield.accept(5);
|
updateTextfield.accept(5);
|
||||||
this.setVisible(false);
|
AdvancedOptionsGUI.this.setVisible(false);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
uncommonActionButton.addActionListener(o -> {
|
uncommonActionButton.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent o) {
|
||||||
uncommonActionGui.setVisible(true);
|
uncommonActionGui.setVisible(true);
|
||||||
this.setVisible(false);
|
AdvancedOptionsGUI.this.setVisible(false);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
premadeScriptsButton.addActionListener(o -> {
|
premadeScriptsButton.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent o) {
|
||||||
sdnGui.setVisible(true);
|
sdnGui.setVisible(true);
|
||||||
this.setVisible(false);
|
AdvancedOptionsGUI.this.setVisible(false);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import javax.swing.tree.DefaultMutableTreeNode;
|
|||||||
import javax.swing.tree.DefaultTreeModel;
|
import javax.swing.tree.DefaultTreeModel;
|
||||||
import javax.swing.tree.TreeCellRenderer;
|
import javax.swing.tree.TreeCellRenderer;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
@@ -169,21 +171,27 @@ public class ScriptFactorySDNGui extends JFrame {
|
|||||||
|
|
||||||
JButton cmdStart = new JButton("Download");
|
JButton cmdStart = new JButton("Download");
|
||||||
cmdStart.setBounds(WIDTH - 156 - 4, HEIGHT - 24 - 4, 156, 24);
|
cmdStart.setBounds(WIDTH - 156 - 4, HEIGHT - 24 - 4, 156, 24);
|
||||||
cmdStart.addActionListener(e -> {
|
cmdStart.addActionListener(new ActionListener() {
|
||||||
String s = getScriptName(tree.getSelectionPath().toString());
|
@Override
|
||||||
downloadScript(format.get(s));
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
String s = ScriptFactorySDNGui.this.getScriptName(tree.getSelectionPath().toString());
|
||||||
|
ScriptFactorySDNGui.this.downloadScript(format.get(s));
|
||||||
JOptionPane.showMessageDialog(null, "Script downloaded successfully. You can now run it by clicking \"Load\" in the main menu.");
|
JOptionPane.showMessageDialog(null, "Script downloaded successfully. You can now run it by clicking \"Load\" in the main menu.");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
JButton cmdHome = new JButton("Open home");
|
JButton cmdHome = new JButton("Open home");
|
||||||
cmdHome.setBounds(WIDTH - (96 * 2 + 60) - 4 - 32, HEIGHT - 24 - 4, 96 + 32,
|
cmdHome.setBounds(WIDTH - (96 * 2 + 60) - 4 - 32, HEIGHT - 24 - 4, 96 + 32,
|
||||||
24);
|
24);
|
||||||
cmdHome.addActionListener(e -> {
|
cmdHome.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
try {
|
try {
|
||||||
Desktop.getDesktop().open(new File(DEFAULT_DIR));
|
Desktop.getDesktop().open(new File(DEFAULT_DIR));
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
panel.add(scrlScriptTree);
|
panel.add(scrlScriptTree);
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package scriptfactory;
|
||||||
|
|
||||||
|
public interface Consumer<T> {
|
||||||
|
void accept(T t);
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@ public class EnterJButton extends JButton {
|
|||||||
public EnterJButton(String text)
|
public EnterJButton(String text)
|
||||||
{
|
{
|
||||||
super(text);
|
super(text);
|
||||||
EnterJButton me = this;
|
final EnterJButton me = this;
|
||||||
this.addKeyListener(new KeyAdapter() {
|
this.addKeyListener(new KeyAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void keyPressed(KeyEvent keyEvent) {
|
public void keyPressed(KeyEvent keyEvent) {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import scriptfactory.Actions.Logic.If;
|
|||||||
import scriptfactory.Actions.Logic.Endif;
|
import scriptfactory.Actions.Logic.Endif;
|
||||||
import scriptfactory.Actions.Action;
|
import scriptfactory.Actions.Action;
|
||||||
import scriptfactory.Actions.Logic.IfNot;
|
import scriptfactory.Actions.Logic.IfNot;
|
||||||
|
import scriptfactory.Consumer;
|
||||||
import scriptfactory.GUI.MainPanels.ActionPanel;
|
import scriptfactory.GUI.MainPanels.ActionPanel;
|
||||||
import scriptfactory.AdvancedGui.AdvancedOptionsGUI;
|
import scriptfactory.AdvancedGui.AdvancedOptionsGUI;
|
||||||
import scriptfactory.NewGuis.ActionGuiInfo;
|
import scriptfactory.NewGuis.ActionGuiInfo;
|
||||||
@@ -14,12 +15,14 @@ import javax.swing.*;
|
|||||||
import javax.swing.border.EtchedBorder;
|
import javax.swing.border.EtchedBorder;
|
||||||
import javax.swing.text.BadLocationException;
|
import javax.swing.text.BadLocationException;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
import static scriptfactory.VarsMethods.log;
|
import static scriptfactory.VarsMethods.log;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Cyn on 1/9/2018.
|
* Created by Cyn on 1/9/2018.
|
||||||
*/
|
*/
|
||||||
@@ -41,12 +44,12 @@ public class GUI extends JFrame {
|
|||||||
private AdvancedOptionsGUI advancedOptions;
|
private AdvancedOptionsGUI advancedOptions;
|
||||||
private ArrayList<Action> actions;
|
private ArrayList<Action> actions;
|
||||||
|
|
||||||
public GUI(ArrayList<Action> actions)
|
public GUI(final ArrayList<Action> actions)
|
||||||
{
|
{
|
||||||
this.actions = actions;
|
this.actions = actions;
|
||||||
|
|
||||||
//These are like little functions we pass around
|
//These are like little functions we pass around
|
||||||
Consumer<Integer> updateTextfield = (Integer i) -> {
|
/*Consumer<Integer> updateTextfield = (Integer i) -> {
|
||||||
updateActionList();
|
updateActionList();
|
||||||
};
|
};
|
||||||
Consumer<Integer> removeAction = (Integer toRemove) -> {
|
Consumer<Integer> removeAction = (Integer toRemove) -> {
|
||||||
@@ -58,6 +61,28 @@ public class GUI extends JFrame {
|
|||||||
Consumer<Boolean> endIf = (Boolean remove) -> {
|
Consumer<Boolean> endIf = (Boolean remove) -> {
|
||||||
actions.add(new Endif());
|
actions.add(new Endif());
|
||||||
updateTextfield.accept(1);
|
updateTextfield.accept(1);
|
||||||
|
};*/
|
||||||
|
final Consumer<Integer> updateTextfield = new Consumer<Integer>() {
|
||||||
|
@Override
|
||||||
|
public void accept(Integer i) {
|
||||||
|
GUI.this.updateActionList();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Consumer<Integer> removeAction = new Consumer<Integer>() {
|
||||||
|
@Override
|
||||||
|
public void accept(Integer toRemove) {
|
||||||
|
log("Trying to remove " + toRemove);
|
||||||
|
int pint = toRemove;
|
||||||
|
actions.remove(pint);
|
||||||
|
GUI.this.updateActionList();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Consumer<Boolean> endIf = new Consumer<Boolean>() {
|
||||||
|
@Override
|
||||||
|
public void accept(Boolean remove) {
|
||||||
|
actions.add(new Endif());
|
||||||
|
updateTextfield.accept(1);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
newAction = new ActionGuiInfo(actions, updateTextfield);
|
newAction = new ActionGuiInfo(actions, updateTextfield);
|
||||||
@@ -82,34 +107,45 @@ public class GUI extends JFrame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addActionListeners() {
|
private void addActionListeners() {
|
||||||
startButton.addActionListener(o -> {
|
startButton.addActionListener(new ActionListener() {
|
||||||
this.setVisible(false);
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent o) {
|
||||||
|
GUI.this.setVisible(false);
|
||||||
log("Executing the following script:");
|
log("Executing the following script:");
|
||||||
for (Action a : actions)
|
for (Action a : actions) {
|
||||||
{
|
|
||||||
log(a.toString());
|
log(a.toString());
|
||||||
}
|
}
|
||||||
VarsMethods.tickSpeed = VarsMethods.parsePint(tickSpeedField.getText());
|
VarsMethods.tickSpeed = VarsMethods.parsePint(tickSpeedField.getText());
|
||||||
selectedFile = new File(VarsMethods.CACHED_LOC);
|
selectedFile = new File(VarsMethods.CACHED_LOC);
|
||||||
saveContents();
|
GUI.this.saveContents();
|
||||||
scriptStarted = true;
|
scriptStarted = true;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
saveButton.addActionListener(o -> {
|
saveButton.addActionListener(new ActionListener() {
|
||||||
if (updateFile())
|
@Override
|
||||||
saveContents();
|
public void actionPerformed(ActionEvent o) {
|
||||||
|
if (GUI.this.updateFile())
|
||||||
|
GUI.this.saveContents();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
loadButton.addActionListener(o -> {
|
loadButton.addActionListener(new ActionListener() {
|
||||||
if (updateFile())
|
@Override
|
||||||
loadContents();
|
public void actionPerformed(ActionEvent o) {
|
||||||
|
if (GUI.this.updateFile())
|
||||||
|
GUI.this.loadContents();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
addSleepButton.addActionListener(o -> {
|
addSleepButton.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent o) {
|
||||||
ArrayList<JTextArea> sleepAmountFieldAsAL = new ArrayList<>();
|
ArrayList<JTextArea> sleepAmountFieldAsAL = new ArrayList<>();
|
||||||
sleepAmountFieldAsAL.add(sleepAmountField);
|
sleepAmountFieldAsAL.add(sleepAmountField);
|
||||||
actions.add(new Action("Sleep", sleepAmountFieldAsAL));
|
actions.add(new Action("Sleep", sleepAmountFieldAsAL));
|
||||||
updateActionList();
|
GUI.this.updateActionList();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package scriptfactory.GUI.MainPanels;
|
package scriptfactory.GUI.MainPanels;
|
||||||
|
|
||||||
|
import scriptfactory.Consumer;
|
||||||
import scriptfactory.GUI.EnterJButton;
|
import scriptfactory.GUI.EnterJButton;
|
||||||
import scriptfactory.AdvancedGui.AdvancedOptionsGUI;
|
import scriptfactory.AdvancedGui.AdvancedOptionsGUI;
|
||||||
import scriptfactory.NewGuis.ActionGuiInfo;
|
import scriptfactory.NewGuis.ActionGuiInfo;
|
||||||
@@ -10,7 +11,8 @@ import javax.swing.*;
|
|||||||
import javax.swing.text.Style;
|
import javax.swing.text.Style;
|
||||||
import javax.swing.text.StyleConstants;
|
import javax.swing.text.StyleConstants;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.util.function.Consumer;
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by SRH on 1/10/2018.
|
* Created by SRH on 1/10/2018.
|
||||||
@@ -65,26 +67,41 @@ public class ActionPanel extends JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initButtons() {
|
private void initButtons() {
|
||||||
actionButton.addActionListener(o -> {
|
actionButton.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent o) {
|
||||||
newAction.setVisible(true);
|
newAction.setVisible(true);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
startIfButton.addActionListener(o -> {
|
startIfButton.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent o) {
|
||||||
newCondition.setVisible(true);
|
newCondition.setVisible(true);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
endIfButton.addActionListener(o -> {
|
endIfButton.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent o) {
|
||||||
endIf.accept(true);
|
endIf.accept(true);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
removeButton.addActionListener(o -> {
|
removeButton.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent o) {
|
||||||
String path = JOptionPane.showInputDialog("Enter the line# you wish to delete:");
|
String path = JOptionPane.showInputDialog("Enter the line# you wish to delete:");
|
||||||
|
|
||||||
removeAction.accept(VarsMethods.parsePint(path));
|
removeAction.accept(VarsMethods.parsePint(path));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
advancedButton.addActionListener(o -> {
|
advancedButton.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent o) {
|
||||||
advancedOptions.setVisible(true);
|
advancedOptions.setVisible(true);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package scriptfactory.NewGuis;
|
|||||||
|
|
||||||
|
|
||||||
import scriptfactory.Actions.Action;
|
import scriptfactory.Actions.Action;
|
||||||
|
import scriptfactory.Consumer;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by SRH on 1/9/2018.
|
* Created by SRH on 1/9/2018.
|
||||||
|
|||||||
@@ -2,8 +2,9 @@ package scriptfactory.NewGuis;
|
|||||||
|
|
||||||
|
|
||||||
import scriptfactory.Actions.Action;
|
import scriptfactory.Actions.Action;
|
||||||
|
import scriptfactory.Consumer;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by SRH on 1/9/2018.
|
* Created by SRH on 1/9/2018.
|
||||||
|
|||||||
@@ -3,15 +3,16 @@ package scriptfactory.NewGuis;
|
|||||||
import scriptfactory.Actions.Action;
|
import scriptfactory.Actions.Action;
|
||||||
import scriptfactory.Actions.Logic.If;
|
import scriptfactory.Actions.Logic.If;
|
||||||
import scriptfactory.Actions.Logic.IfNot;
|
import scriptfactory.Actions.Logic.IfNot;
|
||||||
|
import scriptfactory.Consumer;
|
||||||
import scriptfactory.GUI.EnterJButton;
|
import scriptfactory.GUI.EnterJButton;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.awt.event.KeyAdapter;
|
import java.awt.event.KeyAdapter;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
import static scriptfactory.VarsMethods.MAX_PARAMS;
|
import static scriptfactory.VarsMethods.MAX_PARAMS;
|
||||||
|
|
||||||
@@ -37,7 +38,7 @@ public class NewStatementGUI extends JFrame {
|
|||||||
* @param actionTypes: List of possible actions the user can select
|
* @param actionTypes: List of possible actions the user can select
|
||||||
* @param descStrings: Descriptions to display for the actions
|
* @param descStrings: Descriptions to display for the actions
|
||||||
*/
|
*/
|
||||||
void initGui(String title, ArrayList<Action> actionList, Consumer<Integer> updateTextfield, String[] actionTypes, Descriptions[] descStrings) {
|
void initGui(String title, final ArrayList<Action> actionList, final Consumer<Integer> updateTextfield, String[] actionTypes, Descriptions[] descStrings) {
|
||||||
setTitle(title);
|
setTitle(title);
|
||||||
setLayout(new BorderLayout());
|
setLayout(new BorderLayout());
|
||||||
|
|
||||||
@@ -59,20 +60,26 @@ public class NewStatementGUI extends JFrame {
|
|||||||
|
|
||||||
addEscapeHotkey(this);
|
addEscapeHotkey(this);
|
||||||
|
|
||||||
add.addActionListener(o -> {
|
add.addActionListener(new ActionListener() {
|
||||||
if (this.getTitle().contains("action"))
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent o) {
|
||||||
|
if (NewStatementGUI.this.getTitle().contains("action"))
|
||||||
actionList.add(new Action(selectedAction, inputs));
|
actionList.add(new Action(selectedAction, inputs));
|
||||||
else
|
else
|
||||||
actionList.add(new If(selectedAction, inputs));
|
actionList.add(new If(selectedAction, inputs));
|
||||||
updateTextfield.accept(5);
|
updateTextfield.accept(5);
|
||||||
this.setVisible(false);
|
NewStatementGUI.this.setVisible(false);
|
||||||
clearInputs();
|
NewStatementGUI.this.clearInputs();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
addInverse.addActionListener(o -> {
|
addInverse.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent o) {
|
||||||
actionList.add(new IfNot(selectedAction, inputs));
|
actionList.add(new IfNot(selectedAction, inputs));
|
||||||
updateTextfield.accept(5);
|
updateTextfield.accept(5);
|
||||||
this.setVisible(false);
|
NewStatementGUI.this.setVisible(false);
|
||||||
clearInputs();
|
NewStatementGUI.this.clearInputs();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,15 +89,18 @@ public class NewStatementGUI extends JFrame {
|
|||||||
* @param actionTypes: scriptfactory.Actions user can select
|
* @param actionTypes: scriptfactory.Actions user can select
|
||||||
* @param descs: Field descriptions for that action
|
* @param descs: Field descriptions for that action
|
||||||
*/
|
*/
|
||||||
private JComboBox actionTypeCombo(String[] actionTypes, Descriptions[] descs) {
|
private JComboBox actionTypeCombo(String[] actionTypes, final Descriptions[] descs) {
|
||||||
JComboBox actionType = new JComboBox(actionTypes);
|
final JComboBox actionType = new JComboBox(actionTypes);
|
||||||
selectedAction = actionTypes[0]; //prevents null
|
selectedAction = actionTypes[0]; //prevents null
|
||||||
setupInputFields(descs[0]);
|
setupInputFields(descs[0]);
|
||||||
|
|
||||||
actionType.addActionListener(o -> {
|
actionType.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent o) {
|
||||||
selectedAction = actionType.getSelectedItem().toString();
|
selectedAction = actionType.getSelectedItem().toString();
|
||||||
|
|
||||||
setupInputFields(descs[actionType.getSelectedIndex()]);
|
NewStatementGUI.this.setupInputFields(descs[actionType.getSelectedIndex()]);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return actionType;
|
return actionType;
|
||||||
@@ -145,7 +155,7 @@ public class NewStatementGUI extends JFrame {
|
|||||||
* Currently supports Tab, Shift Tab
|
* Currently supports Tab, Shift Tab
|
||||||
* @param textArea current TextArea to operate on
|
* @param textArea current TextArea to operate on
|
||||||
*/
|
*/
|
||||||
private void setHKNavigation(JTextArea textArea) {
|
private void setHKNavigation(final JTextArea textArea) {
|
||||||
textArea.addKeyListener(new KeyAdapter() {
|
textArea.addKeyListener(new KeyAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void keyPressed(KeyEvent keyEvent) {
|
public void keyPressed(KeyEvent keyEvent) {
|
||||||
@@ -160,8 +170,13 @@ public class NewStatementGUI extends JFrame {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addEscapeHotkey(JFrame temp) {
|
public static void addEscapeHotkey(final JFrame temp) {
|
||||||
ActionListener escListener = e -> temp.setVisible(false);
|
ActionListener escListener = new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
temp.setVisible(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
temp.getRootPane().registerKeyboardAction(escListener,
|
temp.getRootPane().registerKeyboardAction(escListener,
|
||||||
KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
|
KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
|
||||||
JComponent.WHEN_IN_FOCUSED_WINDOW);
|
JComponent.WHEN_IN_FOCUSED_WINDOW);
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package scriptfactory.NewGuis;
|
package scriptfactory.NewGuis;
|
||||||
|
|
||||||
import scriptfactory.Actions.Action;
|
import scriptfactory.Actions.Action;
|
||||||
|
import scriptfactory.Consumer;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
public class UncommonActionGuiInfo extends NewStatementGUI {
|
public class UncommonActionGuiInfo extends NewStatementGUI {
|
||||||
public UncommonActionGuiInfo(ArrayList<Action> actionList, Consumer<Integer> updateTextField)
|
public UncommonActionGuiInfo(ArrayList<Action> actionList, Consumer<Integer> updateTextField)
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user