Sorry for not putting specific code in previous post. I realized I was doing something wrong, but now am having another problem. I am trying to place a JPanel at a specific place on a JFrame after clicking a button but nothing is happening, here is my code for my Actionperformed method.
public void actionPerformed(ActionEvent e)
{
JPanel pa=new JPanel();
frame.getContentPane().setLayout(null);
pa.setBackground(Color.yellow);
pa.setLocation(50,150);
pa.setSize(150,100);
pa.setBounds(50,150,150,100);
pa.setOpaque(true);
frame.add(pa);
}