Skip to content
Snippets Groups Projects
Commit 52407287 authored by Brutzman, Don's avatar Brutzman, Don
Browse files

add button for issues list to console

parent 0255ac05
No related branches found
No related tags found
No related merge requests found
......@@ -17,6 +17,9 @@ import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
// Local imports
import org.web3d.util.Xj3dVersionInformation;
......@@ -33,15 +36,17 @@ import org.web3d.vrml.sav.DocumentLocator;
* @author Justin Couch
* @version $Revision: 1.1 $
*/
public class AWTConsoleWindow extends Frame
implements ActionListener, ErrorHandler {
public class AWTConsoleWindow extends Frame implements ActionListener, ErrorHandler
{
/** The textfield to put the error information in */
private TextArea errorField;
/** Clear button to remove stuff from window */
private Button clearButton;
/** Issues button to launch issues list */
private Button issuesButton;
/** DocumentLocator used for printing out line/column information */
private DocumentLocator docLocator;
......@@ -63,9 +68,14 @@ public class AWTConsoleWindow extends Frame
clearButton = new Button("Clear");
clearButton.addActionListener(AWTConsoleWindow.this);
p1.add(clearButton);
issuesButton = new Button("Issues list");
issuesButton.addActionListener(AWTConsoleWindow.this);
if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE))
p1.add(issuesButton);
else System.out.println("Unable to support issues button, this installation does not support Java Desktop");
setSize(800, 600); // wide enough for typical paths
setLocation(80, 80);
......@@ -249,7 +259,26 @@ public class AWTConsoleWindow extends Frame
public void actionPerformed(ActionEvent evt) {
Object src = evt.getSource();
if(src == clearButton)
if (src == clearButton)
{
errorField.setText("");
}
else if (src == issuesButton)
{
String issuesUrl = "https://gitlab.nps.edu/Savage/xj3d/issues";
// https://stackoverflow.com/questions/5226212/how-to-open-url-in-default-webbrowser-using-java
if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE))
{
try
{
URI issuesURI = new URI(issuesUrl);
Desktop.getDesktop().browse(issuesURI);
}
catch (IOException | URISyntaxException e)
{
System.err.println("Unable to connect to " + issuesUrl);
}
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment