Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MainFrame extends javax.swing.JFrame{
- private Competition comp = new Competition();
- public MainFrame instance = null;
- //we set the instance to current instance of MainFrame in constructor
- public MainFrame(){
- instance = this;
- }
- public Competition getCompetition(){
- return comp;
- }
- }
- public class AddSwimmerDialog extends javax.swing.JDialog {
- .....
- private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
- //you create the object
- Swimmer s = new Swimmer();
- //now you need to store somewhere
- MainFrame.instance.getCompetition().swimmers.add(s);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement