vendredi 13 mars 2015

how to inherit the value of the variable in my first frame to the other variable of my second frame in java GUI?




private void jButton1ActionPerformed(java.awt.event.ActionEvent evt){
if (JOptionPane.showConfirmDialog(null, "PROCEED TO NEXT LEVEL?", "AWESOME!!! CORRECT ANSWER ---",
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION)
{
String myCoin = coin.getText();
int points = Integer.parseInt(myCoin);


new hint().points2 = pointq1;
new hint().setVisible(true);
}


} This is the code of my first frame, and i have a value of my coin button in my first frame, so i am getting the value of my coin button and convert it to int and put the value in 'points' variable , hint() is my second frame and 'points2' is my variable in second frame. Now, I just want my points2 variable will be equal to he value of my coins button that is placed in variable 'points'.




Aucun commentaire:

Enregistrer un commentaire