DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2005
    Posts
    2

    embedding an applet into an applet? *child forms possible?*

    im familiar with visual basic and im trying to build an online app using java..

    the application will need multiple forms or windows to perform properly.. is there a way to do this? how can i have child forms inside a main form?

    would i somehow create frames or dialoges with application content in them?

    thanks

  2. #2
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    1,560
    There are many ways to do this; e.g. your applet could be a JTabbedPane with your forms
    as JPanels, or you could go for a BorderLayout where your forms are JPanels that you swap in the center.
    What you choose depends on the look-and-feel you are going for.

    "Child forms inside a main form", ... in Java that is LayoutManagers.
    Last edited by sjalle; 06-13-2005 at 08:17 AM.
    eschew obfuscation

  3. #3
    Join Date
    Jun 2005
    Posts
    2
    Quote Originally Posted by sjalle
    There are many ways to do this; e.g. your applet could be a JTabbedPane with your forms
    as JPanels, or you could go for a BorderLayout where your forms are JPanels that you swap in the center.
    What you choose depends on the look-and-feel you are going for.

    "Child forms inside a main form", ... in Java that is LayoutManagers.
    why thank you,

    so i import the javax.swing.* package?

    can i use anyone of the containers: jwindow, jdialog, jframe inside of the applet? how do i get it "JTabbedPaned" ? i want the windows like another applet but youre not able to move them outside of the parameter of the main applet! but i was hoping they would have functionality like closing and and miniizing

  4. #4
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    1,560
    The applet is a panel descendant, in other words, a container. You can set your
    applets layout to 1 row/1 column GridLayout. Then create and add a JTabbedPane to the applet.
    The tabbedPane is a special container that allowa adding of several other containers
    (JPanels) inside it. They appear as selectable tabs on top (thats the default) of
    the tabbedPane.
    I think you are on the wrong track if you want to acieve application "behaviour" in a
    web browser. The java applet is contained in a "sandbox" inside the browser and is
    only allowed to do what the SecurityManager allows it to do, and I don't think
    closing the browser or minimizing it are one of the allowed actions.

    Apart from the window-operations the JPanel and The JApplet are very similar to the
    JFrame, and you cannot add a frame inside another frame, unless its a JInternalFrame.

    I have coded a base setup here for a MDi type applet. That allows for
    minimizing windows inside the applet.

    If you want to check it out (and copy the html) its here:

    http://home.no.net/sjalle/MDIApplet.html

    PS: you can delete the internal frame's close-button, its useless
    Attached Files
    Last edited by sjalle; 06-13-2005 at 07:51 PM.
    eschew obfuscation

Bookmarks

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
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links