package VierGewinnt;
import java.awt.BorderLayout;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.GroupLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JDesktopPane;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.LayoutStyle;
import javax.swing.WindowConstants;
import javax.swing.border.TitledBorder;
import javax.swing.SwingUtilities;
/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit [url=http://www.cloudgarden.com]Cloud Garden (Java Resources)[/url] for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class GUI extends javax.swing.JFrame {
{
//Set Look & Feel
try {
javax.swing.UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
} catch(Exception e) {
e.printStackTrace();
}
}
private JButton newgame;
private JPanel jPanel1;
private JLabel test;
private JTextField status;
private JLabel statuslabel;
private ButtonGroup buttonGroup1;
private JTextField playername2;
private JTextField playername1;
private JLabel player2;
private JLabel player1;
private JButton end;
/**
* Auto-generated main method to display this JFrame
*/
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
GUI inst = new GUI();
inst.setLocationRelativeTo(null);
inst.setVisible(true);
}
});
}
public GUI() {
super();
initGUI();
}
private void initGUI() {
try {
GroupLayout thisLayout = new GroupLayout((JComponent)getContentPane());
getContentPane().setLayout(thisLayout);
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
this.setFocusTraversalPolicyProvider(true);
this.setFocusTraversalKeysEnabled(false);
this.setTitle("4 Gewinnt");
{
newgame = new JButton();
newgame.setText("Neues Spiel");
}
{
end = new JButton();
end.setText("Beenden");
end.setSize(92, 24);
}
{
jPanel1 = new JPanel();
GroupLayout jPanel1Layout = new GroupLayout((JComponent)jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1.setBorder(BorderFactory.createTitledBorder(null, "Spielernamen", TitledBorder.LEADING, TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma",1,11)));
{
playername1 = new JTextField();
}
{
playername2 = new JTextField();
}
{
player2 = new JLabel();
player2.setText("Spieler 2:");
}
{
player1 = new JLabel();
player1.setText("Spieler 1:");
}
jPanel1Layout.setVerticalGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup()
.addComponent(playername1, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(player1, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup()
.addComponent(playername2, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(player2, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)));
jPanel1Layout.setHorizontalGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup()
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(player2, GroupLayout.PREFERRED_SIZE, 51, GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(player1, GroupLayout.PREFERRED_SIZE, 51, GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup()
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(playername1, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(playername2, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE))));
}
thisLayout.setVerticalGroup(thisLayout.createSequentialGroup()
.addContainerGap()
.addGroup(thisLayout.createParallelGroup()
.addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
.addComponent(jPanel1, GroupLayout.PREFERRED_SIZE, 74, GroupLayout.PREFERRED_SIZE)
.addGap(28))
.addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
.addGap(49)
.addComponent(getTest(), GroupLayout.PREFERRED_SIZE, 53, GroupLayout.PREFERRED_SIZE)))
.addGap(81)
.addComponent(newgame, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(end, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE)
.addComponent(getStatuslabel(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(getStatus(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
.addContainerGap());
thisLayout.setHorizontalGroup(thisLayout.createSequentialGroup()
.addContainerGap(25, 25)
.addGroup(thisLayout.createParallelGroup()
.addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
.addComponent(getStatuslabel(), GroupLayout.PREFERRED_SIZE, 37, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(getStatus(), GroupLayout.PREFERRED_SIZE, 135, GroupLayout.PREFERRED_SIZE))
.addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
.addGap(31)
.addComponent(getTest(), GroupLayout.PREFERRED_SIZE, 66, GroupLayout.PREFERRED_SIZE)
.addGap(79)))
.addGap(24)
.addGroup(thisLayout.createParallelGroup()
.addGroup(thisLayout.createSequentialGroup()
.addComponent(jPanel1, GroupLayout.PREFERRED_SIZE, 149, GroupLayout.PREFERRED_SIZE))
.addGroup(thisLayout.createSequentialGroup()
.addGap(57)
.addGroup(thisLayout.createParallelGroup()
.addGroup(thisLayout.createSequentialGroup()
.addComponent(end, GroupLayout.PREFERRED_SIZE, 92, GroupLayout.PREFERRED_SIZE))
.addGroup(thisLayout.createSequentialGroup()
.addComponent(newgame, GroupLayout.PREFERRED_SIZE, 92, GroupLayout.PREFERRED_SIZE)))))
.addContainerGap(10, Short.MAX_VALUE));
pack();
setSize(400, 300);
} catch (Exception e) {
e.printStackTrace();
}
}
private ButtonGroup getButtonGroup1() {
if(buttonGroup1 == null) {
buttonGroup1 = new ButtonGroup();
}
return buttonGroup1;
}
private JLabel getStatuslabel() {
if(statuslabel == null) {
statuslabel = new JLabel();
statuslabel.setText("Status:");
}
return statuslabel;
}
private JTextField getStatus() {
if(status == null) {
status = new JTextField();
status.setEnabled(false);
}
return status;
}
private JLabel getTest() {
if(test == null) {
test = new JLabel();
ImageIcon ii = new ImageIcon(this.getClass().getResource("leer.gif"));
test.setIcon(ii);
}
return test;
}
}