its a basic calculator that sums number and i want to make a GUI for it but i dont know where i messed up please help

import java.util.Scanner;
import javax.swing.*;
public class Sum {
	public static void main (String args []){
		Scanner result = new Scanner(;
		int num1;
		int num2;
		int sum;
		System.out.println("Write the first number");
		num1 = result.nextInt();
		System.out.println("Write the second number");
		System.out.print("the result:" + sum);
		String ask1 = JOptionPane.showInputDialog(sum);
		String message = String.format("the result is:", sum);
	} }

Edit: Nevermind that.

You use the JOptionPane for each of the numbers, not the sum.