Results 1 to 5 of 5

Thread: Help me!!!

  1. #1
    sattarzapata is offline Member
    Join Date
    Mar 2010
    Posts
    2
    Rep Power
    0

    Question Help me!!!

    i created a mdi application with this method :


    protected void createFrame() {
    MyInternalFrame frame = new MyInternalFrame();
    multiWindow.add(frame);
    frame.setVisible(true);
    try {
    frame.setSelected(true);
    } catch (java.beans.PropertyVetoException e) {
    }
    }
    class MyInternalFrame extends JInternalFrame {

    static final int xPosition = 30, yPosition = 30;
    public MyInternalFrame() {
    super("Gpaint Shape #" + (++openFrameCount), false, // resizable
    true, // closable
    false, // maximizable
    false);// iconifiable
    setSize(300, 300);
    // Set the window's location.
    setLocation(xPosition * openFrameCount, yPosition
    * openFrameCount);
    }


    and now i want draw a line on active internalframe but i can't plz help me......

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,457
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by sattarzapata View Post
    and now i want draw a line on active internalframe but i can't plz help me......
    A JInternalPane has a content pane; you should add, say, a JPanel to this content pane and draw on the JPanel. Read the API documentation for the JInternal class, it explains it all.

    kind regards,

    Jos

  3. #3
    sattarzapata is offline Member
    Join Date
    Mar 2010
    Posts
    2
    Rep Power
    0

    Smile wrong

    thank you but you'r method is wrong
    i found new method

    MyJPanel panel = new MyJPanel(); // create new panel
    frame.add( panel, BorderLayout.CENTER ); // add panel
    ....
    .....
    ......
    .......
    public MyJPanel()
    { public void paintComponent( Graphics g )
    {
    super.paintComponent( g );
    g.DrawLine(0,0,20,20);
    }
    }

    **** you can't use internalframe.getcontentpane().add(); it's wrong

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,457
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by sattarzapata View Post
    thank you but you'r method is wrong
    O really? I didn't show any method at all and you obviously haven't read the API documentation for the JInternalFrame class.

    kind regards,

    Jos

  5. #5
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by sattarzapata View Post
    thank you but you'r method is wrong
    ....
    **** you can't use internalframe.getcontentpane().add(); it's wrong
    Sorry, but everything JosAH told you was correct. If there's anything wrong, it's your interpretation of things (which we are still unclear on).

Posting Permissions

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