title: Why getcontentpane() is undefined?
body: <p>I have a code here and I get this error. How do I fix the error for the code below?</p>
  
  <pre><code>Container container = getContentPane();
  </code></pre>
  
  <p>Here is the running code.</p>
  
  <pre><code>import java.awt.BorderLayout;
  import java.awt.Container;
  import java.awt.event.ActionEvent;
  import java.awt.event.ActionListener;
  
  import javax.swing.JButton;
  import javax.swing.JFrame;
  import javax.swing.JPanel;
  import javax.swing.JScrollPane;
  import javax.swing.JTable;
  import javax.swing.table.DefaultTableModel;
  
  public class ModelJTable{
    private DefaultTableModel model;
  
    private JTable table;
  
    public ModelJTable() {
      super();
      model = new DefaultTableModel();
      model.addColumn("Product Name");
      model.addColumn("Price");
      model.addColumn("Quantity");
      model.addColumn("Subtotal");
  
      String[] socrates = { "Socrates", "", "469-399 B.C." };
      model.addRow(socrates);
      table = new JTable(model);
  
      JButton addButton = new JButton("Add Philosopher");
      addButton.addActionListener(new ActionListener() {
  
        public void actionPerformed(ActionEvent event) {
          String[] philosopher = { "", "", "" };
          model.addRow(philosopher);
        }
      });
  
      JButton removeButton = new JButton("Remove Selected Philosopher");
  
      removeButton.addActionListener(new ActionListener() {
  
        public void actionPerformed(ActionEvent event) {
          model.removeRow(table.getSelectedRow());
        }
      });
      JPanel inputPanel = new JPanel();
      inputPanel.add(addButton);
      inputPanel.add(removeButton);
  
      Container container = getContentPane();
      container.add(new JScrollPane(table), BorderLayout.CENTER);
      container.add(inputPanel, BorderLayout.NORTH);
  
      Global.uniFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      Global.uniFrame.setSize(800, 300);
      Global.uniFrame.setVisible(true);
    } 
    public static class Global{
        public static JFrame uniFrame = new JFrame();
    }
    private static void createGUI(){
        new ModelJTable();
    }
    public static void main(String args[]) {
        createGUI();
    }
  }
  </code></pre>
  
  <p>I change the code to this and it doesn't display the contents.</p>
  
  <pre><code>Container container = new Container();
  container.add(new JScrollPane(table), BorderLayout.CENTER);
  container.add(inputPanel, BorderLayout.NORTH);
  Global.uniFrame.getContentPane();
  Global.uniFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  Global.uniFrame.setSize(800, 300);
  Global.uniFrame.setVisible(true);
  </code></pre>