如果2个圗形是测到抵触/相撞在一起,就会出现对话方文字("ra collide to rb")如何加入??
String message =
 String.format( "ra collide to rb"); JOptionPane.showMessageDialog( null, message );______________________________________________________________________________________________________import java.awt.Graphics;
import javax.swing.JApplet;
import javax.swing.JOptionPane;
import java.applet.Applet;
import java.awt.Graphics;public class sss3 extends Applet
{
    int number1;
    int number2;
    int number3;
    int number4;
    int number5;
    int number6;
    int number7;
    int number8;
    
    public void init()
    {
        String firstnumber;
        String secondnumber;
        String thirdnumber;
        String forthnumber;
        
        firstnumber=JOptionPane.showInputDialog("input the first number:");
        secondnumber=JOptionPane.showInputDialog("input the second number:");
        thirdnumber=JOptionPane.showInputDialog("input the third number:");
        forthnumber=JOptionPane.showInputDialog("input the forth number:");
        
        number1=Integer.parseInt(firstnumber);
        number2=Integer.parseInt(secondnumber);
        number3=Integer.parseInt(thirdnumber);
        number4=Integer.parseInt(forthnumber);
        
         init2();
    }
    
    public void init2()
    {
        String firstnumber2;
        String secondnumber2;
        String thirdnumber2;
        String forthnumber2;        firstnumber2=JOptionPane.showInputDialog("input the first2 number:");
        secondnumber2=JOptionPane.showInputDialog("input the second2 number:");
        thirdnumber2=JOptionPane.showInputDialog("input the third2 number:");
        forthnumber2=JOptionPane.showInputDialog("input the forth2 number:");
        
        number5=Integer.parseInt(firstnumber2);
        number6=Integer.parseInt(secondnumber2);
        number7=Integer.parseInt(thirdnumber2);
        number8=Integer.parseInt(forthnumber2);
    }   
    
    public void paint(Graphics g)
    {
        g.drawRect(number1,number2, number3, number4);
        
        paint2(g);
    }
  
    public void paint2(Graphics h)
    {   
        h.drawRect(number5,number6, number7, number8);
        }
  
}