Insert JFrame in a JMEdesktop

Hello boys and girls.

I want insert in a JMEDesktop a JFrame.

I look and run the TestJMEDesktop class. It's ok. But i want insert in a Desktop a JFrame.

In the code of this class there is a sample code to create a JFrame but it's displayed out the JmeDesktop.

It's possible insert in a JmeDesktop this component???

I'have change the code but when i run the class; it stops.

Can you help meeeee??? 

JFrame frame = new JFrame();

        frame.setVisible( true );
        Toolkit.getDefaultToolkit().addAWTEventListener( new AWTEventListener() {
            public void eventDispatched( AWTEvent event ) {
       "CIao" );
        }, 0xFFFFFFFFFFFFFFl );
        JButton button = new JButton( "test" );
        button.setMnemonic( 't' );
        frame.getContentPane().add( button );
        button.addActionListener( new ActionListener() {
            public void actionPerformed( ActionEvent e ) {
       "now" );
     [color=red]   desktopPane.add(frame);[/color]
       } );

anyone can help me?

JMEDesktop is based on a JDesktopPane.  I'm fairly sure that you need to use a JInternalFrame in this case…

Poor me. I'm interested use JFrame for insert in my application a PDF file.

You have any council for me???

Thanks for your reply.

The only difference, functionally, between a JInternalFrame and a standard JFrame is the way in which they are displayed since a JFrame still needs the setVisible(true) call.  All use within the frame itself should identical

I have a simple code for load a pdf file with standard JFrame, but if i change JFrame with JInternalFrame i don't display anything.

The simple code if i use is:

package pdfpaneltest;
import com.adobe.acrobat.*;
import java.awt.*;
import com.adobe.acrobat.*;
import java.awt.*;

      public class PDFViewer {

          public PDFViewer() throws java.lang.Exception {

          public void viewPDFDocument() {

              try {
                 Frame frame = new Frame("PDF Viewer");
                 frame.setLayout(new BorderLayout());
                 Viewer viewer = new Viewer();
                 frame.add(viewer, BorderLayout.CENTER);

                 frame.add(new Label("PDF Document in Adobe Acrobat Viewer",

                          Label.CENTER), BorderLayout.NORTH);
                InputStream input = new FileInputStream(new File( "C:/m.pdf"));
                  viewer.setProperty("Default_Page_Layout", "SinglePage");
                 viewer.setProperty("Default_Zoom_Type", "FitPage");
            viewer.setProperty("Default_Magnification", "100");
                  System.out.println("Page Count: " + viewer.getPageCount());
                  System.out.println("Current Page: " + viewer.getCurrentPage());
               frame.setSize(400, 500);
               OutputStream output=new FileOutputStream(new File("C:/output.txt"));

            PrintWriter printWriter=new PrintWriter(output);



              } catch (java.lang.Exception e) {

          public static void main(String[] argv) {
              try {

                  PDFViewer pdfViewer = new PDFViewer();
              } catch (java.lang.Exception e) {




If you try to display a JInternalFrame via a main method, you won't get anything.  It's meant to be a frame inside of a frame.  BTW, you're using the AWT components there, not Swing components :wink:

What components of the AWT i must to use??

bircastri said:

What components of the AWT i must to use??

You shouldnt need to use any.. JFrame is swing, you want SWING components. (in the javax.swing package)