There is a problem with my GUI. I am trying to use SWT for this. I made a separate class next to my main one called GUI, in it I have a SWT GUI which has a combo box and a start script button.
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.graphics.Point;
public class GUI {
public String treeName;
public static String errorMessage;
protected Shell shell;
/**
* Launch the application.
* @param args
*/
public static void main(String[] args) {
try {
GUI window = new GUI();
window.open();
} catch (Exception e) {
errorMessage = "Error";
}
}
/**
* Open the window.
*/
public void open() {
Display display = Display.getDefault();
createContents();
shell.open();
shell.layout();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
}
/**
* Create contents of the window.
*/
protected void createContents() {
shell = new Shell();
shell.setMinimumSize(new Point(136, 40));
shell.setSize(272, 240);
shell.setText("SWT Application");
shell.setLayout(null);
Combo combo = new Combo(shell, SWT.READ_ONLY);
combo.setBounds(66, 44, 128, 23);
combo.setItems(new String[] {"Tree", "Oak", "Willow", "Maple", "Yew", "Magic"});
combo.select(0);
Button btnNewButton = new Button(shell, SWT.NONE);
btnNewButton.setBounds(66, 108, 128, 54);
btnNewButton.setText("Start script");
btnNewButton.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
treeName = combo.getText();
shell.close();
}
});
}
}
In my main:
public void onStart() {
GUI gui = new GUI();
}
It's not even showing up! The logger is giving me some error messages.
Uncaught exception!
java.lang.NoClassDefFoundError: org/eclipse/swt/widgets/Composite
at Main.onStart(Main.java:26)
at org.osbot.rs07.event.ScriptExecutor.IiIiiiiiIiIi(yl:197)
at org.osbot.rs07.event.ScriptExecutor.start(yl:28)
at org.osbot.Lb.run(vf:245)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.eclipse.swt.widgets.Composite
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 7 more
[INFO][Bot #1][02/05 05:34:10 PM]: Terminating script Skeleton...
[INFO][Bot #1][02/05 05:34:10 PM]: Script Skeleton has exited!
Is it possible to make SWT work with OSBot?