Panel and button are added in the frame but not appearing in the frame output.
import javax.swing.*;
import java.awt.*;
public class frameeg
{
public static void main(String s[])
{
JFrame frame = new JFrame("Frame eq");
JPanel panel = new JPanel(); //panel not working
panel.setLayout(new FlowLayout());
JLabel label = new JLabel("JFrame by example");
JButton button = new JButton();
button.setText("Button");
panel.add(label);
panel.add(button);
frame.add(panel);
frame.setLayout(null);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(200,300);
}
}