Link to home
Start Free TrialLog in
Avatar of lskoong
lskoong

asked on

Can SOmeOne help me bout GUI???

Can someone help me to put this coding into a GUI. Just a simple GUI. The GUI will display the n, d, e value in three different JTextField by click on the generate button. Pls can someone help me

import java.math.BigInteger;
import java.security.SecureRandom;

class kop
{
  public BigInteger n, d, e;

  public kop()
  {
    SecureRandom r = new SecureRandom();
    BigInteger p = new BigInteger(20 / 2, 100, r);
    System.out.println(p);
    BigInteger q = new BigInteger(20 / 2, 100, r);
    System.out.println(q);
    n = p.multiply(q);
    BigInteger m = p.subtract(BigInteger.ONE).multiply(q.subtract(BigInteger.ONE));
    e = new BigInteger("3");
    while(m.gcd(e).intValue() > 1) e = e.add(new BigInteger("2"));
    d = e.modInverse(m);
  }
 
  public static void main(String [] args)
  {
    kop t = new kop();
    System.out.println("n = " + t.n);
    System.out.println("e = " + t.e);
    System.out.println("d = " + t.d);
  }
}
ASKER CERTIFIED SOLUTION
Avatar of Venci75
Venci75

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lskoong
lskoong

ASKER

thanx for the help