I am trying to set the value of the progress bars in math1a and math2a through math1a, but only the value of the progress bar in math1a is set and the one in the math2a class didn't. I tried using set and get method for the matha2 progressbar but it doesn't seem to let me set it's value?
///////////////////////////////////////////////////////////////////////////math1 main class//////////////////////////////////////////////////////
public class math1 extends javax.swing.JFrame {
public math1() {
initComponents();
}
@SuppressWarnings("unchecked")
private void connectActionPerformed(java.awt.event.ActionEvent evt) {
math1a m1 = new math1a();
m1.setVisible(true);
m1.pbStart();
math2a m2 = new math2a();
m2.setVisible(true);
}
public static void main(String args[]) {
/* Set the Nimbus look and feel */
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new math1().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton connect;
// End of variables declaration
}
///////////////////////////////////////////////////////////////////////////math1a class//////////////////////////////////////////////////////////////
public class math1a extends javax.swing.JFrame {
public math1a() {
initComponents();
}
@SuppressWarnings("unchecked")
math2a m2 = new math2a();
public void pbStart(){
//attempt 1
pb1.setValue(100);
m2.setPB(100);
m2.pb2.setValue(m2.getPB());
//attempt 2
m2.setBar(100);
}
public static void main(String args[]) {
/* Set the Nimbus look and feel */
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new math1a().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JProgressBar pb1;
// End of variables declaration
}
///////////////////////////////////////////////////////////////////////////math2a class//////////////////////////////////////////////////////////////
public class math2a extends javax.swing.JFrame {
private int bar;
public math2a() {
initComponents();
}
@SuppressWarnings("unchecked")
//attempt 1
public void setPB(int bar){
this.bar = bar;
}
public int getPB(){
return this.bar;
}
//attemp2
public void setBar(int pb2){
this.pb2.setValue(pb2);
}
public static void main(String args[]) {
/* Set the Nimbus look and feel */
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new math2a().setVisible(true);
}
});
}
// Variables declaration - do not modify
public javax.swing.JProgressBar pb2;
// End of variables declaration
}