Problems using setEnabled()

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bartek20
    New Member
    • Jul 2008
    • 2

    Problems using setEnabled()

    Hey, Im trying to get my gui working but am having a few issues.

    I have 3 classes, main, mainWindow, and errorWindow.

    the mainWindow is instantiated from main as mainWindow m1 = new MainWindow();

    anywho my problem is this....

    inside my mainWindow i have a method that creates a new instance of errorWindow, and uses setEnabled() to disable the mainWindow.

    at the point, the error window popups saying "you have an error", the window also contains an "ok" button.

    what id like to know is how do i reference back from the errorWindow class so that i can set the mainWindow using the setEnabled() method back to true;

    Any help would be appreciated.
    Thanks
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Which classes did you use for your windows?
    You sould probably be using a modal Dialog for that error message. It takes care of all the enabling/disabling for you.

    Comment

    • JosAH
      Recognized Expert MVP
      • Mar 2007
      • 11453

      #3
      Originally posted by bartek20
      what id like to know is how do i reference back from the errorWindow class so that i can set the mainWindow using the setEnabled() method back to true;
      When you want to invoke a method on an object you need to have a reference
      to that object so you can either pass the mainWindow as a parameter to your
      errorWindow and possibly store it in your errorWindow for later use.

      An alternative is the static method Frame.getFrames (); it returns an array
      with all the existing top level frames currently in your application; your mainWindow
      is one of them. You can find it by searching for its title.

      kind regards,

      Jos

      Comment

      • bartek20
        New Member
        • Jul 2008
        • 2

        #4
        Thanks for both of the replies, got it working now.
        ill take alook at the dialog model now :)

        Comment

        Working...