title: Things dont show after I click my button swing Java
body: <p>(Watch out SoMania got me!)So my title isnt very good because its hard to explain my problem. So my problem is afer I click my button on my app and i remove button and clear my screen it needs to show some text area for some calculation. But when i click button and everything removes i need to maximize or resize my window for TextArea and label to appear. Can anyone help me?</p>
  
  <p>This is my code:</p>
  
  <pre><code>package igrica;
  import javax.swing.*;
  import java.awt.*;
  import java.awt.event.*;
  public class Cijena{
      JButton button;
      JFrame frame;
     JTextField field;
      JPanel panel;
     JLabel label;
     JLabel label2;
     JTextField field2;
     JButton button2;
     JLabel rjesenje2;
  
  public static void main(String [] args) {
      Cijena gui = new Cijena();
      gui.go();
  } 
  
  public void go() {
      try {
          UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
      }catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {}
      panel = new JPanel();
      rjesenje2 = new JLabel();
      label = new JLabel("Upisite cijenu bez popusta: ");
      label2 = new JLabel("Upisite cijenu s popustom: ");
      field2 = new JTextField(20);
      panel.setBackground(Color.white);
      button2 = new JButton("Izracunaj");
      //panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
      frame = new JFrame("Matematicki programi za apartmane");
      button = new JButton("Razlika u cijeni");
      button.addActionListener(new CijenaListener());
      button2.addActionListener(new ButtonListener());
      field = new JTextField(20);
      field.addActionListener(new TextListener());
  
      frame.getContentPane().add(BorderLayout.NORTH, button);
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setSize(300, 300);
      frame.setVisible(true);
      frame.setLayout(new BorderLayout());
  }
  
  class CijenaListener implements ActionListener {
      public void actionPerformed(ActionEvent event) {
          frame.repaint();
          frame.getContentPane().remove(button);
          frame.getContentPane().add(field);
          frame.getContentPane().add(panel);
          //frame.getContentPane().add(label);
          //frame.getContentPane().add(label2);
          //frame.getContentPane().add(field2);
          //TestPane pane = new TestPane();
          //pane.TestPane();
          panel.add(label);
          panel.add(field);
          panel.add(label2);
          panel.add(field2);
          panel.add(button2);
      }
  }
  class TextListener implements ActionListener {
      public void actionPerformed(ActionEvent event) {
          String text = field.getText();
          field.setText("");
      }
  }
  class ButtonListener implements ActionListener {
      public void actionPerformed(ActionEvent ev) {
          String input1 = field.getText();
          String input2 = field2.getText();
          field.setText("");
          field2.setText("");
          int number1 = Integer.parseInt(input1);
          int number2 = Integer.parseInt(input2);
  
          double rjesenje = (double)number2 / number1;
          rjesenje *= 100;
          int r = 100 - (int)rjesenje;
          //System.out.println(number1 + " " + number2);
          String solution = Integer.toString(r);
          rjesenje2.setText(solution + "%");
          panel.add(rjesenje2);
      }
  }
  
  class MyDrawPanel extends JPanel {
      public void paintComponent(Graphics g) {
          g.fillRect(0, 0, getWidth(), getHeight());
      }
  }
  
  }
  </code></pre>