how to show variable's value in pop up dialog with java swing


I am a beginner in programming. I was messing around with java
swing and tried to make a silly app. This is my code. It's not showing
any errors, but it's not working. When the dialog pops up, the
variable's value doesn't show on the dialog. The logic i used is
right, because when i run it in the compiler without the GUI stuff, it
works perfectly. If anyone could tell what am i doing wrong in here,
it would be really helpful.



this is my code for the calculations.



import java.awt.FlowLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JTextField;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JButton;
import javax.swing.JOptionPane;

public class swingApp extends JFrame{
JLabel label;
JButton button;
public JLabel label2;
JTextField textField = new JTextField("enter you nicknamae");
String username=textField.getText();
public int geniusMeter;
public int sum=0;
public String sumAsString;
public void swingAppLogic(String name){
char[] letters = username.toCharArray();
char []
alphabet={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
int []
measure={7,3,1,13,8,26,15,18,2,5,22,20,16,9,5,11,23,12,25,6,4,21,24,14,17,10};

for(int count=0;count<letters.length;count++){
for (int count1=0;count1<alphabet.length;count1++){
if (letters[count]==alphabet[count1]){
geniusMeter=measure[count1];
sum=sum+geniusMeter;
break;
}
}
}
sumAsString = Integer.toString(sum);

}

public swingApp(){
super("Genius Calculator");
setLayout(new FlowLayout());
label = new JLabel("Wanna know how genius you are?");
label2 = new JLabel(" ");
button = new JButton("press enter and then click me to know
the results");
handlerClass handler = new handlerClass();
button.addActionListener(handler);
add(label);
add(label2);
add(button);
add(textField);
}
public class handlerClass implements ActionListener{
public void actionPerformed(ActionEvent event){
JOptionPane.showMessageDialog (null, sumAsString, "Title",
JOptionPane.INFORMATION_MESSAGE);

}
}
}


and this is my main method



import javax.swing.JFrame;

public class swingAppTester{
public static void main (String [] args){
swingApp object=new swingApp();

object.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
object.setSize(500,400);
object.setVisible(true);
}
}

- Technology - Languages
+ Webmasters
+ Development
+ Development Tools
+ Internet
+ Mobile Programming
+ Linux
+ Unix
+ Apple
+ Ubuntu
+ Mobile & Tablets
+ Databases
+ Android
+ Network & Servers
+ Operating Systems
+ Coding
+ Design Software
+ Web Development
+ Game Development
+ Access
+ Excel
+ Web Design
+ Web Hosting
+ Web Site Reviews
+ Domain Name
+ Information Security
+ Software
+ Computers
+ Electronics
+ Hardware
+ Windows
+ PHP
+ ASP/ASP.Net
+ C/C++/C#
+ VB/VB.Net
+ JAVA
+ Javascript
+ Programming
Privacy Policy - Copyrights Notice - Feedback - Report Violation 2018 © BigHow