[TASK] Added link to Scripts page

This commit is contained in:
Jeroen Ketelaar
2019-05-13 18:30:26 -05:00
parent fd8f1e0291
commit cf5d3a6574
2 changed files with 49 additions and 26 deletions
@@ -28,4 +28,5 @@ public class Configuration extends org.parabot.api.Configuration {
public static final String COMMUNITY_PAGE = "https://www.parabot.org/community/";
public static final String REGISTRATION_PAGE = COMMUNITY_PAGE + "register/";
public static final String BDN_PAGE = "http://bdn.parabot.org/scripts/";
}
@@ -1,5 +1,6 @@
package org.parabot.core.ui;
import org.parabot.core.Configuration;
import org.parabot.core.Context;
import org.parabot.core.Directories;
import org.parabot.core.desc.ScriptDescription;
@@ -17,8 +18,10 @@ import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URLEncoder;
import java.util.HashMap;
@@ -42,8 +45,8 @@ public final class ScriptSelector extends JFrame {
private JEditorPane scriptInfo;
public ScriptSelector() {
this.categories = new HashMap<String, DefaultMutableTreeNode>();
this.format = new HashMap<String, ScriptDescription>();
this.categories = new HashMap<>();
this.format = new HashMap<>();
this.root = new DefaultMutableTreeNode("Scripts");
this.WIDTH = 640;
this.HEIGHT = 256 + 128;
@@ -185,10 +188,29 @@ public final class ScriptSelector extends JFrame {
}
});
JButton cmdScripts = new JButton("Add scripts");
cmdScripts.setBounds(12, HEIGHT - 24 - 4, 96 + 32,
24);
cmdScripts.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
URI uri = URI
.create(Configuration.BDN_PAGE);
try {
Desktop.getDesktop().browse(uri);
} catch (IOException e1) {
JOptionPane.showMessageDialog(null, "Connection Error",
"Error", JOptionPane.ERROR_MESSAGE);
e1.printStackTrace();
}
}
});
panel.add(scrlScriptTree);
panel.add(scrlScriptInfo);
panel.add(cmdStart);
panel.add(cmdHome);
panel.add(cmdScripts);
this.add(panel);
this.pack();