Results 1 to 3 of 3
  1. #1
    collin389 is offline Senior Member
    Join Date
    Nov 2009
    Rep Power

    Default JInternalFrame Help

    I'm trying to make a java program( that can start a JInternalFrame and have its contents to be a different program( I could say
    Java Code:
    JInternalFrame frame = new JInternalFrame("Life", true, true, true, false);
    frame.setSize(800, 600);
    frame.setContentPane(new Life());
    where Life returns a JPanel. However, I don't want to hard code the name Life in because I want it to be able to run any java program I have. Right now, I store the Program I want displayed in a .txt file. Then I extract the names from each line and turn them into buttons. Before, I just ran "cmd.exe /c start java -cp \"C:\\J\" " + choices[choice-1]", But I dont want to start a new window, just an internal Frame. Is there any way to do this? Maybe some way to have the program name stored in to string choice and say choice a = new choice() where choice is any program name?

    Double post to "AWT/Swing"
    Last edited by collin389; 03-15-2010 at 12:04 AM.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power


    You could try using Reflection.
    Trail: The Reflection API (The Java™ Tutorials)

    Be aware that it has a fairly steep learning curve.


  3. #3
    collin389 is offline Senior Member
    Join Date
    Nov 2009
    Rep Power


    Thanks for the help. I got it working. Also, thank you for introducing reflections to me. I never knew java could do that. I thought when I asked if you could make a class name a var, people would just say, "not possible". Thanks again.

Similar Threads

  1. Control JInternalFrame ?
    By h9h in forum AWT / Swing
    Replies: 1
    Last Post: 10-11-2009, 03:58 AM
  2. Refeshing image in JInternalFrame
    By MasterDeveloper in forum AWT / Swing
    Replies: 7
    Last Post: 04-05-2009, 12:34 PM
  3. Repositioning An unwanted JInternalFrame
    By marco.c84 in forum AWT / Swing
    Replies: 8
    Last Post: 03-18-2009, 09:42 PM
  4. Problem with JInternalFrame
    By hameem in forum AWT / Swing
    Replies: 1
    Last Post: 12-11-2008, 04:23 PM
  5. [SOLVED] jScrool in JInternalFrame
    By gustio in forum New To Java
    Replies: 2
    Last Post: 07-22-2008, 10:05 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts