title: JPane inside JFrame
body: <p>I'm trying to make simple app in Java but I have problem with inserting JPane (pasy) inside JFrame(frame). For now my output is two windows, one with resisor and second with combo boxes. Can you please explain me what am I doing wrong? I also tried <code>frame.getContentPane().add(pasy);</code> but it didn't work.</p>
  
  <pre><code>import java.awt.* ;
  import java.awt.Color;
  import java.awt.event.* ;
  import java.awt.Frame ;
  import java.awt.Graphics;
  import javax.swing.*;
  import javax.swing.JButton;
  import javax.swing.JFrame;
  import javax.swing.JOptionPane;
  import javax.swing.JPanel;
  import java.util.HashMap;
  import java.util.Scanner;
  import java.util.Map;
  
  public class rezystorGUI extends JFrame implements ActionListener {
     String kod="",kolor="",pasek1="BLACK",pasek2="WHITE",pasek3="VIOLET",pasek4="WHITE",pasek5="BLACK";
     JComboBox p1, p2, p3, p4, p5;
     JTextField wynik;
     ResistorColorCode rcc;
     WpiszWartosc wwart; 
     /** * Constructor for objects of class REZYSTORGUI */
     rezystorGUI(){   
      setTitle("Odczytywanie paskow rezystora");
      setSize(375,300); 
      setVisible(true);  
      addWindowListener(new WindowAdapter(){
          @Override
          public void windowClosing(WindowEvent e){
              e.getWindow().dispose();
          }
      });
      rcc = new ResistorColorCode();
      makeGUI() ;
     }
     /** method */
     void makeGUI() {
      JFrame frame = new JFrame();
      frame.setSize(375,300);
  
      JPanel pasy = new JPanel();
      pasy.setLayout(new GridLayout(3,3));
      pasy.setSize(200,200);
  
      String[]pasek = {"BLACK","BROWN","RED","ORANGE","YELLOW","GREEN","BLUE","VIOLET","GRAY","WHITE"};
      String[]multi = {"BLACK","BROWN","RED","ORANGE","YELLOW","GREEN","BLUE","VIOLET"};
      String[]tol = {"BROWN","RED","GREEN","BLUE","VIOLET","GRAY","GOLD","SILVER"};
  
      pasy.add(p1 = new JComboBox&lt;String&gt;(pasek));
      p1.addActionListener(this);
      pasy.add(p2 = new JComboBox&lt;String&gt;(pasek));
      p2.addActionListener(this);
      pasy.add(p3 = new JComboBox&lt;String&gt;(pasek));
      p3.addActionListener(this);
      pasy.add(p4 = new JComboBox&lt;String&gt;(multi));
      p4.addActionListener(this);
      pasy.add(p5 = new JComboBox&lt;String&gt;(tol));
      p5.addActionListener(this);
      wynik= new JTextField(30);
      pasy.add(wynik);
  
      frame.add(pasy);
      frame.pack();
      frame.setVisible(true);  
     }
  
     @Override
     public void paint(Graphics g) {
         super.paint(g);
         Map&lt;String, Color&gt; colors = new HashMap&lt;String, Color&gt;();
         colors.put("BLUE", Color.BLUE);
         colors.put("RED", Color.RED);
         colors.put("GREEN", Color.GREEN);
         colors.put("WHITE", Color.WHITE);
         colors.put("YELLOW", Color.YELLOW);
         colors.put("BLACK", Color.BLACK);
         colors.put("ORANGE", Color.ORANGE);
         colors.put("GRAY", Color.GRAY);
         colors.put("VIOLET", new Color(127,0,255));
         colors.put("BROWN", new Color(150,75,0));
         colors.put("GOLD", new Color(255,215,0));
         colors.put("SILVER", new Color(192,192,192));
         colors.put("LIGHT-BLUE", new Color(153,204,255));
  
         int x=100;
         g.setColor(colors.get("GRAY"));
         g.fillRect(40, 95, 60, 10);
         g.setColor(colors.get("GRAY"));
         g.fillRect(40, 95, 10, 50);
  
         g.setColor(colors.get("LIGHT-BLUE"));
         g.fillRect(x, 40, 20, 120);
  
         g.setColor(colors.get(pasek1));
         x=x+20;
         g.fillRect(x, 40, 10, 120);
  
         g.setColor(colors.get("LIGHT-BLUE"));
         x=x+10;
         g.fillRect(x, 40, 10, 120);
  
         g.setColor(colors.get("LIGHT-BLUE"));
         x=x+10;
         g.fillRect(x, 50, 95, 100);
  
         g.setColor(colors.get(pasek2));
         x=x+5;
         g.fillRect(x, 50, 10, 100); 
  
         g.setColor(colors.get(pasek3));
         x=x+30;
         g.fillRect(x, 50, 10, 100);
  
         g.setColor(colors.get(pasek4));
         x=x+30;
         g.fillRect(x, 50, 10, 100);
  
         g.setColor(colors.get("LIGHT-BLUE"));
         x=x+30;
         g.fillRect(x, 40, 10, 120);
  
         g.setColor(colors.get(pasek5));
         x=x+10;
         g.fillRect(x, 40, 10, 120);
  
         g.setColor(colors.get("LIGHT-BLUE"));
         x=x+10;
         g.fillRect(x, 40, 20, 120);
  
         g.setColor(colors.get("GRAY"));
         x=x+20;
         g.fillRect(x, 95, 60, 10);
         x=x+50;
         g.setColor(colors.get("GRAY"));
         g.fillRect(x, 95, 10, 50);
     }
  
     public void actionPerformed(ActionEvent e){
         Object eventSource = e.getSource();
         if (eventSource == p1){
             pasek1 = (String)p1.getSelectedItem();
             kod+=pasek1;
             repaint();
         }
         if (eventSource == p2){
             pasek2 = (String)p2.getSelectedItem();
             kod+="-";
             kod+=pasek2;
             repaint();
         }
         if (eventSource == p3){
             pasek3 = (String)p3.getSelectedItem();
             kod+="-";
             kod+=pasek3;
             repaint();
         }
         if (eventSource == p4){
             pasek4 = (String)p4.getSelectedItem();
             kod+="-";
             kod+=pasek4;
             repaint();
         }
         if (eventSource == p5){
             pasek5 = (String)p5.getSelectedItem();
             String tempkod;
             tempkod=kod;           
             kod+="-";
             kod+=pasek5;
             repaint();           
             rcc.inputColorCode(kod);
             kod=tempkod;
             wynik.setText(rcc.convertToValues()+" Ohm(s)\n"+rcc.tolerancja+" tolerancji");
         }       
     }
  
     public static void main(String[] args) 
     { 
         new rezystorGUI() ;
     }
  }
  </code></pre>