About InternalFrame in SWT

SWT Designer allows you to create the views, editors, perspectives, pref pages, composites, etc. that comprise Eclipse SWT & RCP applications and plug-ins.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

About InternalFrame in SWT

Postby shinichi0802 » Fri Mar 10, 2006 12:28 am

how can I develop a internalFrame in SWT.

I'm tried. But I have not get desired results.
This is my code:
Code: Select all
package AANDG;

package AANDG;

import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Toolkit;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import org.eclipse.swt.SWT;
import org.eclipse.swt.awt.SWT_AWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class mainapp extends JFrame {
   public static JDesktopPane desktop;

   /**
    * Launch the application
    *
    * @param args
    */
   public static void main(String[] args) {
      final Display display = Display.getDefault();
      final Shell shell = new Shell();
      shell.setSize(527, 476);
      shell.setText("SWT Application");
      //

      shell.open();

      final Composite composite = new Composite(shell, SWT.EMBEDDED);
      composite.setBounds(0, 0, 520, 445);

      final Frame frame_1 = SWT_AWT.new_Frame(composite);
      new mainapp();
      frame_1.add(desktop);
      shell.layout();
      while (!shell.isDisposed()) {
         if (!display.readAndDispatch())
            display.sleep();
      }
   }

   public mainapp() {
      super("InternalFrameDemo");

      // Make the big window be indented 50 pixels from each edge
      // of the screen.
      int inset = 50;
      Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
      setBounds(inset, inset, screenSize.width - inset * 2, screenSize.height
            - inset * 2);

      // Quit this app when the big window closes.
      addWindowListener(new WindowAdapter() {
         public void windowClosing(WindowEvent e) {
            System.exit(0);
         }
      });

      // Set up the GUI.
      desktop = new JDesktopPane(); // a specialized layered pane
      createFrame(); // Create first window
      setContentPane(desktop);

      // Make dragging faster:
      desktop.putClientProperty("JDesktopPane.dragMode", "outline");
   }

   protected void createFrame() {
      MyInternalFrame frame = new MyInternalFrame();
      frame.setVisible(true); // necessary as of 1.3; OK to use before
      desktop.add(frame);
      //main_1 main1 = new main_1();
      //main1.setVisible(true);
      //desktop.add(main1);
      try {
         frame.setSelected(true);
         //main1.setSelected(true);
      } catch (java.beans.PropertyVetoException e) {
      }
   }
}


MyInternalFrame.java

Code: Select all
package AANDG;
import javax.swing.JInternalFrame;

import java.awt.event.*;
import java.awt.*;

public class MyInternalFrame extends JInternalFrame {
    static int openFrameCount = 0;
    static final int xOffset = 30, yOffset = 30;

    public MyInternalFrame() {
        super("Document #" + (++openFrameCount),
              true, //resizable
              true, //closable
              true, //maximizable
              true);//iconifiable

        //...Create the GUI and put it in the window...

        //...Then set the window size or call pack...
        setSize(300,300);

        //Set the window's location.
        setLocation(xOffset*openFrameCount, yOffset*openFrameCount);
    }
}

and main_1.java
Code: Select all
package AANDG;

import javax.swing.JInternalFrame;

import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class main_1 extends JInternalFrame{
   static int openFrameCount = 0;
    static final int xOffset = 30, yOffset = 30;
   /**
    * Launch the application
    * @param args
    */
    public main_1()
    {
       super("Document #" + (++openFrameCount),
                 true, //resizable
                 true, //closable
                 true, //maximizable
                 true);//iconifiable
       try
       {   
          //       ...Create the GUI and put it in the window...
   
           //...Then set the window size or call pack...
           setSize(300,300);
   
           //Set the window's location.
           setLocation(xOffset*openFrameCount, yOffset*openFrameCount);
           open();
       }
       catch (Exception e)
       {
         e.printStackTrace();
      }
    }
   
   /**
    * Open the window
    */
   public void open() {
      
      final Display display = Display.getDefault();
      final Shell shell = new Shell();
      shell.setSize(500, 375);
      shell.setText("SWT Application");
      //

      shell.open();
      shell.layout();
      //while (!shell.isDisposed()) {
      //   if (!display.readAndDispatch())
      //      display.sleep();
      //}
   }

}

shinichi0802
 
Posts: 7
Joined: Sun Mar 05, 2006 6:45 pm

please help me.

Postby shinichi0802 » Sun Mar 12, 2006 7:04 pm

please help me for my applicaton.
Thanks.
shinichi0802
 
Posts: 7
Joined: Sun Mar 05, 2006 6:45 pm

Re: About InternalFrame in SWT

Postby Eric Clayberg » Tue Mar 14, 2006 1:22 pm

shinichi0802 wrote:how can I develop a internalFrame in SWT.

SWT itself does not support internal frames (e.g., MDI).

About all you can do is use SWT_AWT to embed a JDesktopPane and JInternalFrame into an SWT panel.

If you really want to create a true internal frame in SWT, I would suggest posting a question on the Eclipse SWT newsgroup.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

where ?

Postby shinichi0802 » Wed Mar 15, 2006 8:21 pm

Eric Clayberg wrote:
If you really want to create a true internal frame in SWT, I would suggest posting a question on the Eclipse SWT newsgroup.


please show me URL of "Eclipse SWT newsgroup".
shinichi0802
 
Posts: 7
Joined: Sun Mar 05, 2006 6:45 pm

Re: where ?

Postby Eric Clayberg » Thu Mar 16, 2006 4:33 am

shinichi0802 wrote:please show me URL of "Eclipse SWT newsgroup".

A list of all Eclipse newsgroups is available from the Eclipse Web site.

The Eclipse SWT newsgroup is at news://news.eclipse.org/eclipse.platform.swt
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to SWT Designer

Who is online

Users browsing this forum: No registered users and 1 guest