Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //swimming competition class, that you made without UI, assume there's a Swimmer class exist already
- public class Competition {
- public final List<Swimmer> swimmers = new ArrayList<Swimmer>();
- //All the swimming compeition based stuff here
- .....
- public static void main(String[] args) {
- Competition comp = new Competition();
- comp.swimmers.add(new Swimmer());
- }
- }
- //now the Main UI form which starts when your app starts
- public class MainFrame extends javax.swing.JFrame{
- ....
- }
- //another third JFrame class or a JDialog class, that has a JButton, when you press it
- // you want to create a new Swimmer object and store it in some list
- 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
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement