title: Get variable from another method
body: <p>I'have a question about this script for a <code>Dice</code>. I wrote a method using <code>Math.random</code> and now I want to get result <code>String</code> in my program.</p>
  
  <p>The button has to roll the dice.</p>
  
  <p>So my method gooien is rolling the dice and gives me a number between 1 and 6.
  The JButton is recalling this method to reroll the dice.</p>
  
  <p>Now i want number that is being rerolled into a string.</p>
  
  <pre><code>// paneel met 3 tekstvakken
  class dobbelsteentjes1 extends JPanel {
      private JButton gooien;
  
  public dobbelsteentjes1(){
  
      gooien=new JButton ("Gooien");
      gooien.addActionListener(new gooienHandler());
  
      add(gooien);
  }
  //inwendige klasse
  class gooienHandler implements ActionListener{
  
  public void actionPerformed (ActionEvent e){
      gooien();
  }
  
  }
      public void gooien(){
      double gooi1, gooi2,worp1;
      gooi1= Math.random();
      gooi2=Math.random();
      worp1=gooi1*6+1;
  }
  
  public void paintComponent ( Graphics g ) {
      super.paintComponent( g );
      g.drawString( "U heeft gegooid:" + worp1, 50, 30);
  }}    
  </code></pre>
  
  <p>Any ideas?</p>