import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.table.AbstractTableModel;
public class JPanelSample implements ActionListener //extends JFrame
{
private static final int FRAME_WIDTH = 600;
private static final int FRAME_HEIGHT = 600;
private static final int FRAME_X_ORIGIN = 150;
private static final int FRAME_Y_ORIGIN = 250;
private static final int BUTTON_WIDTH = 80;
private static final int BUTTON_HEIGHT = 30;
private JFrame f;
private JPanel p;
private JButton b1;
private JLabel l1;
public JPanelSample()
{
f = new JFrame();
f.setTitle ("JPanel Sample");
f.setSize (FRAME_WIDTH, FRAME_HEIGHT);
f.setLocation (FRAME_X_ORIGIN, FRAME_Y_ORIGIN);
f.setResizable(false);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
p = new JPanel();
p.setBackground(Color.YELLOW);
b1 = new JButton("Ok");
l1 = new JLabel("Chose an option");
l1.setBounds(200, 125, 50, 20);
p.add(b1);
f.add(l1);
// f.add(p); // fills up the whole frame
f.add(p, BorderLayout.SOUTH); // only uses the lower part (south) of the frame
f.setVisible(true);
}
public void actionPerformed(ActionEvent event)
{
}
public static void main(String[] args)
{
JPanelSample jps = new JPanelSample();
}
}