Charles Bell
Posts: 519
Nickname: charles
Registered: Feb, 2002
|
|
Re: Problem with Layout
|
Posted: Jul 2, 2002 12:38 PM
|
|
import java.awt.*; import javax.swing.*;
public class PanelDemo{ public PanelDemo(){ init(); } public static void main(String[]args){ new PanelDemo(); } public void init(){ JPanel panel = new JPanel(); panel.setPreferredSize(new Dimension(100,300)); JButton button = new JButton("Demo"); button.setPreferredSize(new Dimension(100,150)); panel.add(button); JFrame frame = new JFrame("Demo"); frame.getContentPane().add(panel,BorderLayout.NORTH); frame.pack(); frame.setLocationRelativeTo(null); frame.show(); } }
|
|