Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

[3798] Programming with Swing

Last post 11-14-2005 3:01 PM by manojacharya. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 01-01-1999 12:00 AM

    [3798] Programming with Swing

    This thread is for discussions of Programming with Swing.

    • Post Points: 0
  • Advertisement

    • Red Gate Software

    Advertisement

    Want to boost your .NET application performance?

    Some developers always seem to write efficient and lightening-fast code. What is their secret? It’s ANTS Profiler. “We improved the performance of the application up to 10 times” Dan Ports, Intrigma.

    Try it for yourself now.

  • 08-05-2004 1:44 AM In reply to

    • jho
    • Not Ranked
    • Joined on 08-05-2004
    • New Member
    • Points 75

    JAVA MDI

    i have a JFrame named MainFrame which also uses JDesktoPane. I created 2 JInternalFrame class named ChildFrame1 and ChildFrame2. When I can click the menu on the mainframe, it shows the childframe1. I must load the Childframe2 on the desktopPane on the mainFrame by clicking a button inside the childframe1. How can I do this??? My problem is that the desktopPane becomes foreign to childFrame2 since it is another class. here is the sample prog...

    public class MainFrame extends JFrame
    {
      ChildFrame1 child1 = new ChildFrame1();
    public MainFrame()
    {
      final JDesktopPane desktop = new JDesktopPane();
      getContentPane().add(desktop);
     
      JMenuBar bar = new JMenuBar();
     JMenu show = new JMenu("Show");
     JMenuItem showchild1 = new JMenuItem("Show Child1");
     desktop.add(child1);
     child1.setVisible(true);
     
    bar.add(show);
    show.add(showchild1);


    }

    }

    i still have another JInternalFrame class named childFrame2 but it will only be visible when i click a button in childFrame1 (child1).

    how can i do this?????

    i cannot use the jDESKTOPANE "desktop" because that class does not recognize the "desktop"


    PLEASE HELP ME!!! I WILL DEFINITELY APPRECIATE YOUR HELP! THANKS A LOT!!!
    • Post Points: 0
  • 09-13-2004 4:21 AM In reply to

    • munas
    • Not Ranked
    • Joined on 09-13-2004
    • New Member
    • Points 5
    jho....

    just call your child frames as follows

    public class MainFrame extends JFrame
    {
     ChildFrame1 child1;
    public MainFrame()
    {
     final JDesktopPane desktop = new JDesktopPane();
     getContentPane().add(desktop);
     
     JMenuBar bar = new JMenuBar();
    JMenu show = new JMenu("Show");
    JMenuItem showchild1 = new JMenuItem("Show Child1");
    //**************************
    // here this represents the MainFrame which can be passes as a message to the child frame.
             child1 = new ChildFrame1(this);
    //**************************
    desktop.add(child1);
    child1.setVisible(true);
     
    bar.add(show);
    show.add(showchild1);
    }
    }


    and in ChildFrame set the constructor as

    MainFrame  mainFrame;
    ChildFrame(MainFrame  mainFrame)
    {
    this.mainFrame = mainFrame;
    }

    actionPerformed in ChildFrame1()  {
     if(button clicked) {
        ChilFrame2 childFrame2 = new ChildFrame2();
         mainFrame.desktop.add(childFrame2);
         this.dispose(); // or this.hide();
     }
    }

    hope this code helps!

    • Post Points: 0
  • 10-28-2004 7:05 AM In reply to

    • BG3000
    • Not Ranked
    • Joined on 10-28-2004
    • New Member
    • Points 5

    Java - MDI - ChildFrames

    Hi.

    I have an ChildFrame inside of an DesktopFrame. I want to insert a JButton into the ChildFrame. But this JButton turns out to be very  tiny in that child frame. If I maximize the child frame, the button does not change size.
    I used this a source for my codings:

    http://www.rz.fhtw-berlin.de/hjp3/k100230.html

    I only added a JButton into my chid frame, I used a GridBagLayout. button.setSize() does  not seem to work in  that child frame.

    Would be very thankful, if anybody could help.

    Burkhardt

    • Post Points: 0
  • 11-14-2005 3:01 PM In reply to

    Closing button on internal frame

    Hello,
     I want to add a closing button to the internal frame. I am not able to do it. Plz help.javascript:smilie('')
    confused
    • Post Points: 0
Page 1 of 1 (5 items)