DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2006

    Question Switching Frames (windows)

    How do you switch from 1frame to the other

    This is the problem:
    I've got 2 frames (frame1.java and frame2.java) what I want to do is switch between these frames (later on there will be more frames)

    So my question is: How do I close the current window, and activate the next one, by clicking a button.

    I did found some things with commands like: frame1.show() and frame1.hide()
    But these wont work.
    All the frames are already programmed, I only need to put the command in the Actionhandler to switch from one to another.

    Please help me.

    THNX for da Reading

  2. #2
    Join Date
    Dec 2005
    i dont really use more than one frame but you should just be able to do this:

    public void actionPerformed(ActionEvent e)
    hopefully that does something close to what you need...

  3. #3
    Join Date
    Oct 2006
    public void actionPerformed(ActionEvent e)
    I already tried this, it gives an error

    "Frame1.java": Error #: 308 : non-static method setVisible(boolean) cannot be referenced from a static context at line 129, column 8

    And I dont know what it means, I've tried importing Frame 2 , but that didnt work either.

    I can say
    Frame2 frame2 = new frame2();
    this way it does create the next frame, but I cant go back

    becouse it only works with this.setVisible() and not frame2.setVisible()

    Please what else do I need to do, to get this code working...

    THNX for da Reading

  4. #4
    Join Date
    Dec 2004
    San Bernardino County, California
    Your error message tells me that your issue has to do with the way you have structured your program (have you created an instance of your class, and are manipulating that instance's frames?), not how you are trying to implement the frame switching.

    The diagnosis of this problem would require looking at more (if not all) of your code, not just this specific issue

    [This is why it is important to pass on compiler/run time error messages when asking a question like this on a forum like this]

Similar Threads

  1. Switching between windows...
    By jobartley515 in forum VB Classic
    Replies: 3
    Last Post: 10-28-2005, 08:33 PM
  2. REAL Software Ships REALbasic 5 for WINDOWS
    By Gwen Smith in forum vb.announcements
    Replies: 0
    Last Post: 04-28-2003, 02:37 PM
  3. ?API NT Compatability?
    By Dennis in forum VB Classic
    Replies: 10
    Last Post: 02-15-2001, 03:52 AM
  4. Replies: 0
    Last Post: 11-30-2000, 11:14 AM
  5. Replies: 0
    Last Post: 11-29-2000, 05:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.