Remove windowbuilder crap

master
rarkenin 2013-11-12 19:49:17 -05:00
parent 4a3f6f2a7c
commit 12c7aaa0f6
6 changed files with 345 additions and 21 deletions

View File

@ -12,6 +12,5 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="forms-1.3.0.jar" sourcepath="forms-1.3.0-src.zip"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

Binary file not shown.

View File

@ -0,0 +1,146 @@
package net.mosstest.launcher;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import net.miginfocom.swing.MigLayout;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JFileChooser;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JCheckBox;
import java.awt.Color;
import java.awt.Window.Type;
import javax.swing.JProgressBar;
import javax.swing.Box;
import javax.swing.SwingConstants;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import javax.swing.BoxLayout;
import java.awt.Cursor;
import java.awt.Dimension;
public class GUIBugReportDialog extends JDialog {
private final JPanel contentPanel = new JPanel();
private JTextField reporterName;
private JTextField email;
private JTextField problemSummary;
/**
* Launch the application.
*/
public static void main(String[] args) {
try {
GUIBugReportDialog dialog = new GUIBugReportDialog("test traceback");
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Create the dialog.
*/
public GUIBugReportDialog(String traceback) {
setMinimumSize(new Dimension(640, 480));
setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
setTitle("Report a bug");
setBounds(100, 100, 640, 480);
getContentPane().setLayout(new BorderLayout());
this.contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(this.contentPanel, BorderLayout.CENTER);
this.contentPanel.setLayout(new MigLayout("", "[][grow]", "[][][][grow][grow]"));
{
JLabel lblName = new JLabel("Name:");
this.contentPanel.add(lblName, "cell 0 0,alignx trailing");
}
{
this.reporterName = new JTextField();
this.contentPanel.add(this.reporterName, "cell 1 0,growx");
this.reporterName.setColumns(10);
}
{
JLabel lblEmailoptional = new JLabel("e-mail (optional):");
this.contentPanel.add(lblEmailoptional, "cell 0 1,alignx trailing");
}
{
this.email = new JTextField();
this.contentPanel.add(this.email, "cell 1 1,growx");
this.email.setColumns(10);
}
{
JLabel lblProblemDescription = new JLabel("Problem summary:");
this.contentPanel.add(lblProblemDescription, "cell 0 2,alignx trailing");
}
{
this.problemSummary = new JTextField();
this.contentPanel.add(this.problemSummary, "cell 1 2,growx");
this.problemSummary.setColumns(10);
}
{
JLabel lblDetailedProblemDescription = new JLabel(
"Detailed problem description:");
this.contentPanel.add(lblDetailedProblemDescription, "cell 0 3,alignx trailing");
}
{
JScrollPane scrollPane = new JScrollPane();
this.contentPanel.add(scrollPane, "cell 1 3,grow");
{
JTextArea txtLongDesc = new JTextArea();
txtLongDesc.setWrapStyleWord(true);
txtLongDesc.setLineWrap(true);
txtLongDesc
.setText("Please describe your problem here, preferably including what you had done, what you expected to happen, what happened, and any other details about the world or game.\r\n\r\nPlease note that we cannot help with third-party games or mods.");
scrollPane.setViewportView(txtLongDesc);
}
}
{
JCheckBox chckbxIncludeTechnicalInformation = new JCheckBox(
"Include technical information");
this.contentPanel.add(chckbxIncludeTechnicalInformation, "cell 0 4,alignx trailing,aligny top");
}
{
JScrollPane scrollPane = new JScrollPane();
this.contentPanel.add(scrollPane, "cell 1 4,grow");
{
JTextArea textArea = new JTextArea();
textArea.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
textArea.setBackground(new Color(204, 204, 204));
textArea.setEditable(false);
textArea.setWrapStyleWord(true);
textArea.setLineWrap(true);
textArea.setText("The following information will be included in the bug report if this box is checked: \r\n\r\n"+traceback);
scrollPane.setViewportView(textArea);
}
}
{
JPanel buttonPane = new JPanel();
getContentPane().add(buttonPane, BorderLayout.SOUTH);
buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.X_AXIS));
{
JProgressBar progressBar = new JProgressBar();
buttonPane.add(progressBar);
}
{
JButton okButton = new JButton("Submit");
buttonPane.add(okButton);
okButton.setActionCommand("OK");
getRootPane().setDefaultButton(okButton);
}
{
JButton cancelButton = new JButton("Cancel");
buttonPane.add(cancelButton);
cancelButton.setActionCommand("Cancel");
}
}
}
}

View File

@ -14,6 +14,22 @@ import javax.swing.ListSelectionModel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.table.AbstractTableModel;
import javax.swing.JTextArea;
import java.awt.Color;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.layout.ColumnSpec;
import com.jgoodies.forms.layout.RowSpec;
import java.awt.Component;
import java.awt.Point;
import java.awt.Rectangle;
import javax.swing.SpringLayout;
import net.miginfocom.swing.MigLayout;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import java.awt.CardLayout;
import javax.swing.BoxLayout;
public class GUIClientsideLauncher {
@ -32,7 +48,7 @@ public class GUIClientsideLauncher {
}
private JFrame frame;
private JFrame frmMosstestClientLauncher;
private JTable table;
/**
@ -49,8 +65,8 @@ public class GUIClientsideLauncher {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
GUIClientsideLauncher window = new GUIClientsideLauncher();
window.frame.setVisible(true);
GUIClientsideLauncher window = new GUIClientsideLauncher(new ArrayList<SingleplayerListEntry>());
window.frmMosstestClientLauncher.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
@ -61,20 +77,22 @@ public class GUIClientsideLauncher {
/**
* Create the application.
*/
public GUIClientsideLauncher() {
initialize();
public GUIClientsideLauncher(ArrayList<SingleplayerListEntry> singleplayerEntries) {
initialize(singleplayerEntries);
}
/**
* Initialize the contents of the frame.
* @param singleplayerEntries
*/
private void initialize() {
this.frame = new JFrame();
this.frame.setBounds(100, 100, 800, 480);
this.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
private void initialize(ArrayList<SingleplayerListEntry> singleplayerEntries) {
this.frmMosstestClientLauncher = new JFrame();
frmMosstestClientLauncher.setTitle("Mosstest Client launcher <0.0.1-initial>");
this.frmMosstestClientLauncher.setBounds(100, 100, 800, 480);
this.frmMosstestClientLauncher.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
this.frame.getContentPane().add(tabbedPane, BorderLayout.CENTER);
this.frmMosstestClientLauncher.getContentPane().add(tabbedPane, BorderLayout.CENTER);
JPanel singleplayerTab = new JPanel();
tabbedPane.addTab("Singleplayer", null, singleplayerTab, null);
@ -98,12 +116,88 @@ public class GUIClientsideLauncher {
singleplayerControlBtns.add(btnDelete);
this.table = new JTable();
this.table.setModel(new SingleplayerListTableModel());
this.table.setFillsViewportHeight(true);
this.table.setModel(new SingleplayerListTableModel(singleplayerEntries));
this.table.getColumnModel().getColumn(0).setPreferredWidth(90);
this.table.getColumnModel().getColumn(1).setPreferredWidth(256);
this.table.getColumnModel().getColumn(2).setPreferredWidth(104);
this.table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
singleplayerTab.add(this.table, BorderLayout.CENTER);
//singleplayerTab.add(this.table, BorderLayout.CENTER);
JScrollPane singleplayerScrollPane = new JScrollPane(this.table);
singleplayerScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
singleplayerTab.add(singleplayerScrollPane, BorderLayout.CENTER);
JPanel aboutTab = new JPanel();
tabbedPane.addTab("About", null, aboutTab, null);
tabbedPane.setEnabledAt(1, true);
SpringLayout sl_aboutTab = new SpringLayout();
aboutTab.setLayout(sl_aboutTab);
JPanel communityToolsButtonPanel = new JPanel();
sl_aboutTab.putConstraint(SpringLayout.NORTH, communityToolsButtonPanel, 405, SpringLayout.NORTH, aboutTab);
sl_aboutTab.putConstraint(SpringLayout.WEST, communityToolsButtonPanel, 0, SpringLayout.WEST, aboutTab);
sl_aboutTab.putConstraint(SpringLayout.EAST, communityToolsButtonPanel, 787, SpringLayout.WEST, aboutTab);
aboutTab.add(communityToolsButtonPanel);
communityToolsButtonPanel.setLayout(new GridLayout(0, 5, 0, 0));
JButton btnReportBug = new JButton("Report a bug...");
communityToolsButtonPanel.add(btnReportBug);
JButton btnRequestNewFeature = new JButton("Request new feature...");
communityToolsButtonPanel.add(btnRequestNewFeature);
JButton btnVisitWebsite = new JButton("Visit website");
communityToolsButtonPanel.add(btnVisitWebsite);
JButton btnGithubProject = new JButton("GitHub project");
communityToolsButtonPanel.add(btnGithubProject);
JButton btnVisitForums = new JButton("Visit forums");
communityToolsButtonPanel.add(btnVisitForums);
JTextArea textArea = new JTextArea();
aboutTab.add(textArea);
textArea.setText(" __ __ ____ _____ _____ _______ ______ _____ _______ \r\n"
+ " | \\/ |/ __ \\ / ____/ ____|__ __| ____|/ ____|__ __|\r\n"
+ " | \\ / | | | | (___| (___ | | | |__ | (___ | | \r\n"
+ " | |\\/| | | | |\\___ \\\\___ \\ | | | __| \\___ \\ | | \r\n"
+ " | | | | |__| |____) |___) | | | | |____ ____) | | | \r\n"
+ " |_| |_|\\____/|_____/_____/ |_| |______|_____/ |_| \r\n"
+ " \r\n"
+ " 0.0.1-initial \r\n"
+ ""
+ "Made by hexafraction, thatnerd2, et al.\r\n"
+ "Default game code and textures created by dolinksy296, hexafraction, et. al.\r\n"
+ "\r\n"
+ "Uses the following libraries:\r\n"
+ "* Apache Commons Lang\r\n"
+ "* Apache Commons Collections\r\n"
+ "* JInput\r\n"
+ "* jmonkeyengine/jme3\r\n"
+ "* niftygui\r\n"
+ "* Google Guava Collections\r\n"
+ "* Apache Commons CLI (currently unused)\r\n"
+ "* Apache Commons Configuration\r\n"
+ "* Mozilla Rhino\r\n"
+ "* leveldbjni\r\n"
+ "* junit4 for testing\r\n"
+ "\r\n"
+ "Made with the help of Eclipse, Git, Maven, and countless services such as TravisCI and GitHub.\r\n");
textArea.setWrapStyleWord(true);
textArea.setBackground(new Color(192, 192, 192));
textArea.setEditable(false);
JScrollPane scrollPane = new JScrollPane(textArea);
sl_aboutTab.putConstraint(SpringLayout.NORTH, scrollPane, 0, SpringLayout.NORTH, aboutTab);
sl_aboutTab.putConstraint(SpringLayout.WEST, scrollPane, 0, SpringLayout.WEST, aboutTab);
sl_aboutTab.putConstraint(SpringLayout.SOUTH, scrollPane, 0, SpringLayout.NORTH, communityToolsButtonPanel);
sl_aboutTab.putConstraint(SpringLayout.EAST, scrollPane, 787, SpringLayout.WEST, aboutTab);
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
aboutTab.add(scrollPane);
}
class SingleplayerListTableModel extends AbstractTableModel {
@ -148,13 +242,15 @@ public class GUIClientsideLauncher {
* Don't need to implement this method unless your table's editable.
*/
public boolean isCellEditable(int row, int col) {
// Note that the data/cell address is constant,
// no matter where the cell appears onscreen.
if (col < 2) {
return false;
} else {
return true;
}
return false;
}
/**
* @param entries
*/
public SingleplayerListTableModel(
ArrayList<SingleplayerListEntry> entries) {
this.entries = entries;
}
}

View File

@ -15,6 +15,9 @@ import com.jgoodies.forms.factories.FormFactory;
import com.jgoodies.forms.layout.ColumnSpec;
import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.layout.RowSpec;
import java.awt.Dialog.ModalityType;
import javax.swing.DefaultComboBoxModel;
import com.jme3.material.RenderState.TestFunction;
public class GUIWorldCreationDialog extends JDialog {
@ -40,6 +43,10 @@ public class GUIWorldCreationDialog extends JDialog {
* Create the dialog.
*/
public GUIWorldCreationDialog() {
setTitle("Create new singleplayer world...");
setModal(true);
setModalityType(ModalityType.APPLICATION_MODAL);
setResizable(false);
setBounds(100, 100, 450, 159);
getContentPane().setLayout(new BorderLayout());
this.contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
@ -79,7 +86,7 @@ public class GUIWorldCreationDialog extends JDialog {
this.contentPanel.add(lblGameProfile, "2, 6, right, default");
}
{
this.comboBox = new JComboBox<String>(); //todo pass array in with set of games.
this.comboBox = new JComboBox<String>();
this.contentPanel.add(this.comboBox, "4, 6, fill, default");
}
{

View File

@ -0,0 +1,76 @@
package net.mosstest.launcher;
import java.awt.BorderLayout;
import java.awt.Dialog.ModalityType;
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;
import com.jgoodies.forms.factories.FormFactory;
import com.jgoodies.forms.layout.ColumnSpec;
import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.layout.RowSpec;
public class GUIWorldDeletionDialog extends JDialog {
private final JPanel contentPanel = new JPanel();
/**
* Launch the application.
*/
public static void main(String[] args) {
try {
GUIWorldDeletionDialog dialog = new GUIWorldDeletionDialog("test from main");
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Create the dialog.
*/
public GUIWorldDeletionDialog(String worldName) {
setTitle("Delete singleplayer world...");
setModal(true);
setModalityType(ModalityType.APPLICATION_MODAL);
setResizable(false);
setBounds(100, 100, 600, 105);
getContentPane().setLayout(new BorderLayout());
this.contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(this.contentPanel, BorderLayout.CENTER);
this.contentPanel.setLayout(new FormLayout(new ColumnSpec[] {
FormFactory.RELATED_GAP_COLSPEC,
FormFactory.DEFAULT_COLSPEC,},
new RowSpec[] {
FormFactory.RELATED_GAP_ROWSPEC,
FormFactory.DEFAULT_ROWSPEC,}));
{
JLabel lblAreYouSure = new JLabel("Are you sure you wish to delete the world called "+worldName+"? This operation cannot be undone.");
this.contentPanel.add(lblAreYouSure, "2, 2, right, default");
}
{
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
getContentPane().add(buttonPane, BorderLayout.SOUTH);
{
JButton btnYes = new JButton("Yes");
btnYes.setActionCommand("Yes");
buttonPane.add(btnYes);
getRootPane().setDefaultButton(btnYes);
}
{
JButton cancelButton = new JButton("No");
buttonPane.add(cancelButton);
}
}
}
}