Hjælp til block statements - kode genereret af GUI builder
Hej eksperterJeg har hentet Jigloo gui builder plugin til eclipse. Jeg har lidt svært ved at forstå koden der bliver genereret - håber I kan hjælpe.
Det er de mange "block statements" jeg ikke kender til. Hvilken betydning har de?! Det er i initGUI metoden det går amok:
import java.awt.BorderLayout;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.ButtonGroup;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JEditorPane;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.ListModel;
import javax.swing.WindowConstants;
import javax.swing.border.BevelBorder;
import javax.swing.border.LineBorder;
import javax.swing.border.SoftBevelBorder;
/**
* 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 www.cloudgarden.com 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 NewJFrame extends javax.swing.JFrame {
{
//Set Look & Feel
try {
javax.swing.UIManager.setLookAndFeel("com.jgoodies.plaf.plastic.Plastic3DLookAndFeel");
} catch(Exception e) {
e.printStackTrace();
}
}
private JPanel gamePanel;
private JPanel chatCenterPanel;
private JList gameList;
private JTextField loginTextField;
private JButton logoutButton;
private JButton loginButton;
private JTextArea outputTextArea;
private JButton joinButton;
private JRadioButton tvelweCardButton;
private JTextArea chatTextArea;
private JRadioButton twentyEightCardButton;
private JRadioButton twentyCardButton;
private ButtonGroup gameButtonGroup;
private JLabel gameLabel;
private JButton jButton1;
private JButton sendButton;
private JList onlineUsersList;
/**
* Auto-generated main method to display this JFrame
*/
public static void main(String[] args) {
NewJFrame inst = new NewJFrame();
inst.setVisible(true);
}
public NewJFrame() {
//super();
initGUI();
}
private void initGUI(){
try {
getContentPane().setLayout(null);
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); // C# , andreas se på dette
getContentPane().setBackground(new java.awt.Color(49,50,91));
{
{
gameButtonGroup = new ButtonGroup();
}
{
}
{
}
gamePanel = new JPanel();
gamePanel.setLayout(null);
getContentPane().add(gamePanel);
gamePanel.setBounds(399, 14, 224, 266);
gamePanel.setVerifyInputWhenFocusTarget(false);
gamePanel.setBorder(BorderFactory.createTitledBorder(""));
gamePanel.setBackground(new java.awt.Color(179,185,227));
{
ListModel gameListModel = new DefaultComboBoxModel(
new String[] { "Item One", "Item Two" });
gameList = new JList();
gamePanel.add(gameList);
gameList.setModel(gameListModel);
gameList.setBounds(7, 7, 210, 161);
gameList.setBackground(new java.awt.Color(239,241,250));
gameList.setBorder(new LineBorder(new java.awt.Color(0,0,0), 1, false));
}
{
jButton1 = new JButton();
gamePanel.add(jButton1);
jButton1.setText("create game");
jButton1.setMargin(new java.awt.Insets(2, 2, 1, 2));
jButton1.setBounds(7, 175, 84, 14);
jButton1.setFont(new java.awt.Font("Tahoma",0,10));
}
{
joinButton = new JButton();
gamePanel.add(joinButton);
joinButton.setText("join game");
joinButton.setBounds(105, 175, 77, 14);
joinButton.setMargin(new java.awt.Insets(2, 4, 1, 4));
joinButton.setFont(new java.awt.Font("Tahoma",0,10));
}
{
gameLabel = new JLabel();
gamePanel.add(gameLabel);
gameLabel.setText("select game size:");
gameLabel.setBounds(7, 217, 112, 14);
}
{
tvelweCardButton = new JRadioButton();
gamePanel.add(tvelweCardButton);
tvelweCardButton.setText("12 cards");
tvelweCardButton.setBounds(7, 238, 70, 21);
tvelweCardButton.setFont(new java.awt.Font("Tahoma",0,10));
tvelweCardButton.setBackground(new java.awt.Color(179,185,227));
tvelweCardButton.setMargin(new java.awt.Insets(0, 0, 0, 0));
}
{
twentyCardButton = new JRadioButton();
gamePanel.add(twentyCardButton);
twentyCardButton.setText("20 cards");
twentyCardButton.setBounds(77, 238, 77, 21);
twentyCardButton.setBackground(new java.awt.Color(179,185,227));
twentyCardButton.setMargin(new java.awt.Insets(0, 0, 0, 0));
twentyCardButton.setFont(new java.awt.Font("Tahoma",0,10));
}
{
twentyEightCardButton = new JRadioButton();
gamePanel.add(twentyEightCardButton);
twentyEightCardButton.setText("28 cards");
twentyEightCardButton.setBounds(154, 238, 77, 21);
twentyEightCardButton.setBackground(new java.awt.Color(179,185,227));
twentyEightCardButton.setMargin(new java.awt.Insets(0, 0, 0, 0));
twentyEightCardButton.setFont(new java.awt.Font("Tahoma",0,10));
}
}
{
chatCenterPanel = new JPanel();
chatCenterPanel.setLayout(null);
getContentPane().add(chatCenterPanel);
chatCenterPanel.setBounds(105, 14, 287, 266);
chatCenterPanel.setBorder(BorderFactory.createTitledBorder(""));
chatCenterPanel.setBackground(new java.awt.Color(179,185,227));
{
outputTextArea = new JTextArea();
chatCenterPanel.add(outputTextArea);
outputTextArea.setBounds(7, 56, 273, 133);
outputTextArea.setBorder(new LineBorder(new java.awt.Color(0,0,0), 1, false));
outputTextArea.setBackground(new java.awt.Color(239,241,250));
outputTextArea.setFont(new java.awt.Font("Tahoma",0,10));
}
{
logoutButton = new JButton();
chatCenterPanel.add(logoutButton);
logoutButton.setText("logout");
logoutButton.setBounds(91, 35, 77, 14);
logoutButton.setFont(new java.awt.Font("Tahoma",0,10));
}
{
loginButton = new JButton();
chatCenterPanel.add(loginButton);
loginButton.setText("login");
loginButton.setBounds(7, 35, 77, 14);
loginButton.setFont(new java.awt.Font("Tahoma",0,10));
}
{
loginTextField = new JTextField();
chatCenterPanel.add(loginTextField);
loginTextField.setText("enter username....");
loginTextField.setBounds(7, 7, 161, 21);
loginTextField.setFont(new java.awt.Font("Tahoma",0,10));
loginTextField.setBackground(new java.awt.Color(239,241,250));
}
{
sendButton = new JButton();
chatCenterPanel.add(sendButton);
sendButton.setText("send");
sendButton.setBounds(210, 217, 70, 14);
sendButton.setMnemonic(java.awt.event.KeyEvent.VK_X);
sendButton.setFont(new java.awt.Font("Tahoma",0,10));
}
{
chatTextArea = new JTextArea();
chatCenterPanel.add(chatTextArea);
chatTextArea.setText("enter chat text here...");
chatTextArea.setBounds(7, 203, 196, 56);
chatTextArea.setFont(new java.awt.Font("Tahoma",0,10));
chatTextArea.setBackground(new java.awt.Color(239,241,250));
chatTextArea.setBorder(new SoftBevelBorder(BevelBorder.LOWERED, null, null, null, null));
}
}
{
ListModel onlineUsersListModel = new DefaultComboBoxModel(
new String[] { "Item One", "Item Two" });
onlineUsersList = new JList();
getContentPane().add(onlineUsersList);
onlineUsersList.setModel(onlineUsersListModel);
onlineUsersList.setBounds(7, 14, 91, 266);
onlineUsersList.setBorder(new LineBorder(new java.awt.Color(0,0,0), 1, false));
onlineUsersList.setBackground(new java.awt.Color(239,241,250));
}
pack();
this.setSize(638, 321);
} catch (Exception e) {
e.printStackTrace();
}
}
}