Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

My TextArea doesn't resize ...

843807Feb 3 2009 — edited Feb 3 2009
... 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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 3 2009
Added on Feb 3 2009
1 comment
226 views