... and i'm not entirely sure why:
import java.awt.*;
import javax.swing.*;
import javax.swing.JTable.*;
import java.awt.event.*;
/**
*
* @author Shax
*/
public class GamePanel extends JFrame
{
JPanel currentInfo
public GamePanel(String title)
{
super(title);
addWindowListener(new WindowAdapter() {
public void windowClosing (WindowEvent e) {
System.exit(0);
}
});
// create currentInfo
currentInfo = new JPanel();
currentInfo = createCurrentInfo(currentInfo);
JPanel contPane = (JPanel) this.getContentPane();
contPane.setLayout(new GridLayout());
contPane.setSize(300, 100);
contPane.add(currentInfo);
this.pack();
this.show();
contPane.setVisible(true);
}
public static void main(String[] args)
{
GamePanel g = new GamePanel("GamePanel");
}
public JPanel createCurrentInfo(JPanel info)
{
// box to store the picture or image of character
Box pictureBox = Box.createVerticalBox();
JLabel name = new JLabel("Name"); // label for textArea
TextArea actualName = new TextArea(); // textBox containing player name
actualName.setSize(200, 50);
Box nameBox = Box.createVerticalBox();
nameBox.add(name);
// nameBox.add(Box.createRigidArea(new Dimension(20,0)));
nameBox.add(actualName);
info.add(pictureBox);
info.add(nameBox);
return info;
}
}
Any help?
Shax