Search:

Type: Posts; User: aussiemcgr

Page 1 of 2 1 2

Search: Search took 0.18 seconds.

  1. Replies
    79
    Views
    4,741

    Re: Multiple instances of a class

    DateFormat is a the parent class of SimpleDateFormat. If you are using SimpleDateFormat, you should not need a DateFormat object as well (at least not for your purposes).

    You are receiving the...
  2. Replies
    79
    Views
    4,741

    Re: Multiple instances of a class

    Your scroll panel has a fixed size, as does your member panel. Your member panel is inside your scroll panel. The scroll bars will only show up if the member panel's size exceeds the scroll panel's...
  3. Replies
    79
    Views
    4,741

    Re: Multiple instances of a class

    Like with the custom ActionListener. In the MembersActionListener (the last one I posted), we passed a Members object in the constructor, which we used to set a variable in the class instance.
    ...
  4. Replies
    79
    Views
    4,741

    Re: Multiple instances of a class

    The easiest way would be to add a variable in your membersActionListener class like this:

    public MainFrame mainFrame;

    And then set the variable (either by passing the value in constructor like...
  5. Replies
    79
    Views
    4,741

    Re: Multiple instances of a class

    In the abstract action listener, you do not need to return anything from the method. You just declare it with the abstract keyword: protected abstract Members getMembers();

    Also, I realized a...
  6. Replies
    79
    Views
    4,741

    Re: Multiple instances of a class

    It is entirely up to you. I think the way I suggested would remove the need for the you to figure out which button goes with which user (since that would be set when you add the action listener to...
  7. Replies
    79
    Views
    4,741

    Re: Multiple instances of a class

    I don't understand. Are the buttons not responding?
    The more I look at this, the more I think this is not the "best" way of going about it. Considering your needs, perhaps you should not be trying...
  8. Replies
    79
    Views
    4,741

    Re: Multiple instances of a class

    Did you try revalidating the entire panel?
  9. Replies
    79
    Views
    4,741

    Re: Multiple instances of a class

    I assume the JLabel's text are set after the frame has been created? If so, that is because the text of JLabels is not dynamic. You can change it, but you need to include a call to...
  10. Replies
    79
    Views
    4,741

    Re: Multiple instances of a class

    I'm a little surprised the compiler lets you do this, but you have a typo:

    int index = membersList.lastIndexOf(membersList);

    If an object cannot be found in a list, it returns -1 as the index...
  11. Replies
    79
    Views
    4,741

    Re: Multiple instances of a class

    Ok. Well first of all, we need to change this:

    JFrame frame = new JFrame();
    JDialog dialog1 = new JDialog();
    JDialog dialog2 = new JDialog();

    Back to this:

    JFrame frame = null;
    ...
  12. Replies
    79
    Views
    4,741

    Re: Multiple instances of a class

    When is that call made?
  13. Replies
    79
    Views
    4,741

    Re: Multiple instances of a class

    Wait. You never call createGUI(), do you?
    That would be why dialog and frame were null many posts ago. You never initialized them.
  14. Replies
    79
    Views
    4,741

    Re: Multiple instances of a class

    You can ignore the warning.
    Those lines do not print? Neither of them? That would mean that the dialog's .dispose() method is not being called.

    Go back to this code and try something:

    int...
  15. Replies
    79
    Views
    4,741

    Re: Multiple instances of a class

    Ok, we are going to get drastic.
    We need to figure out what is happening. We want to see:
    1. If the dispose method is called
    2. If the dispose method ends
    You could use a debugger if you know...
  16. Replies
    79
    Views
    4,741

    Re: Multiple instances of a class

    That is not how the while loop would operate. In reality, it locks up the thread it is running on, since it runs forever and never moves on. An infinite loop is really only arguably needed if you are...
  17. Replies
    79
    Views
    4,741

    Re: Multiple instances of a class

    Why are you doing this in a while loop?

    while(true)
    {
    if(this.done == true)
    {
    return this.newMember;
    ...
  18. Replies
    79
    Views
    4,741

    Re: Multiple instances of a class

    If the null pointer was resolved by using the default constructors instead of the other constructors, this is probably not a good sign.
    Are you able to post the entire code for that class?
  19. Replies
    79
    Views
    4,741

    Re: Multiple instances of a class

    I thought you said you were getting a null pointer exception (back at post #38).
    Put a print statement inside the if statement for those calls. Perhaps the if statement is never being entered in the...
  20. Replies
    79
    Views
    4,741

    Re: Multiple instances of a class

    If you are receiving null pointer exceptions after initializing them, you'll need to post the full stack-trace of the error message.
    Perhaps check does not equal 0.
  21. Replies
    79
    Views
    4,741

    Re: Multiple instances of a class

    That's not odd. Static methods do not require an initialized instance of an object in order to work.
    In case you do not know what "static" does, making a class variable static makes the variable...
  22. Replies
    79
    Views
    4,741

    Re: Multiple instances of a class

    Ok, so in the constructor of your MainFrame class, initialize it with the constructor of the memberFrame class. If you have not created a constructor in the memberFrame class, you can just use the...
  23. Replies
    79
    Views
    4,741

    Re: Multiple instances of a class

    Why do you have the second MemberFrame variable? And do you ever actually initialize your memberFrame object (call it's constructor)?
  24. Replies
    79
    Views
    4,741

    Re: Multiple instances of a class

    I don't exactly understand what you did. Can you post your MainFrame class? If it is too large, just post the sections were you mention MemberFrame.
  25. Replies
    79
    Views
    4,741

    Re: Multiple instances of a class

    createGUI() does not need to be static. You need to invoke the createGUI() method on a MemberFrame object.

    For example, I assume somewhere in your MainFrame class, you created a MemberFrame object...
Results 1 to 25 of 36
Page 1 of 2 1 2