Adding a "Page" effect to an Internal Frame

Hi all,
This topic is in the 2D thread but i have possibly used the wrong forum.
I am developing a gui that uses an internal frames as a user workspace.
The internal frame has a canvas on it an i was intending to add 2D objects to the canvas . EG a UML editor.
I want the canvas(Do i need a canvas or may i add 2D objects directly to the frame, or use a jpanel to keep all the components swing?) to look similar to a word/ visio application
where there is an A4/ letter /A3... Page on the internal Frame. If the user creates a 'New' project a new InternalFrame object is created with the "blank" document waiting for a creative touch ;)
and goto begining...
I have the GUI upp and running so far but can find any ideas on how to implement the "Word Doc" type internal look.
I susspect i am correct in saying that i can use scale to "Zoom" in and out of the document.
any suggestions would be most welcome.
Regards,
Graham

Here is a working sample.
Only 2 classes are left, the Destop class was useless.
See how actions are managed (I implemented the "New" function)
I leave you the imagination for the rest...
GUIMainFrame.java:
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JToolBar;
public class GUIMainFrame extends JFrame {
   public JMenuBar menuBar = new JMenuBar();
   public JToolBar toolbar = new JToolBar();
   public JDesktopPane desktop = new JDesktopPane();
   public GUIMainFrame() {
      super("UML database Design Editor");
      initComponents();
      this.setName("GUIMain");
   private JMenu createMenu(String title, int nbitems) {
      JMenu menu = new JMenu(title);
      for (int i=0; i<nbitems; i++) {
         JMenuItem item = new  JMenuItem("option "+i);
         menu.add(item);
      return menu;
   private JButton createButton(Action action) {
      JButton button = new JButton(action);
      return button;
   private void initComponents() {
      setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
      menuBar.add(createMenu("File", 5));
      menuBar.add(createMenu("Edit", 3));
      menuBar.add(createMenu("Help", 1));
      setJMenuBar(menuBar);
      toolbar.add(createButton(new DesktopAction("new")));
      toolbar.add(createButton(new DesktopAction("open")));
      toolbar.add(createButton(new DesktopAction("save")));
      this.getContentPane().add(toolbar, BorderLayout.NORTH);
      this.getContentPane().add(desktop, BorderLayout.CENTER);
      this.setSize(400,400);
      this.setVisible(true);
   public static void main(String[] args) {
      new GUIMainFrame();
   // Manages actions sent to the application
   private void doAction(String name) {
       if (name.equals("new")) {
          Project project = new Project();
          desktop.add(project);
          project.toFront();
          project.setVisible(true);
       else if (name.equals("open")) {
       else if (name.equals("save")) {
   // Class defining the actions to send to the application
   private class DesktopAction extends AbstractAction {
      public DesktopAction(String name) {
         super(name, new ImageIcon(name + "16.gif"));
      /* (non-Javadoc)
       * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
      public void actionPerformed(ActionEvent event) {
         // the action is only redispatched to the application
         doAction(event.getActionCommand());
Project.java:
import java.awt.Color;
import java.awt.Dimension;
import javax.swing.JInternalFrame;
import javax.swing.JPanel;
public class Project extends JInternalFrame {
   static int projectCount = 0, projectX = 20, projectY = 20;
   /** Creates a new instance of Project */
   public Project() {
      super("Project: " + (++projectCount), true,   //resizable
               true,   //closable
               true,   //maximizable
               true);  //iconifiable
      JPanel p = new JPanel();
      p.setOpaque(true);
      p.setBackground(Color.WHITE);    
      p.setPreferredSize(new Dimension(200, 200));
      this.setLocation(projectX, projectY);
      this.setContentPane(p);
      this.pack();
      projectX += 20;
      if (projectX >= 220) {
         projectX= 20;
         projectY += 20;
}Regards.

Similar Messages

  • How do I only allow 1 internal frame to be added?

    Could you pls show me how can I do this, I need some code to learn how this code work.
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    public class Test1a extends JFrame
         private JLabel label1;
    //     private JLabel label2;
         private JLabel label3;
         private JLabel label4;
         private JLabel label5;
         private JDesktopPane theDesktop;
         public Test1a()
              super("TESTING JLABEL");
              setLayout(new BorderLayout(5, 5));
            JMenuBar bar = new JMenuBar();
          JMenu addMenu = new JMenu( "Add" );
          JMenuItem newFrame = new JMenuItem( "Internal Frame" );
          addMenu.add( newFrame );
          bar.add( addMenu );
          setJMenuBar( bar );
           theDesktop = new JDesktopPane();
          add( theDesktop, BorderLayout.CENTER );
          newFrame.addActionListener(
             new ActionListener()
                // display new internal window
                public void actionPerformed( ActionEvent event )
                   // create internal frame
                   JInternalFrame frame = new JInternalFrame("Internal Frame", true, true, true, true);
                   MyJPanel panel = new MyJPanel();
                   frame.add( panel, BorderLayout.CENTER );
                   frame.pack(); // set internal frame to size of contents
                   theDesktop.add( frame );
                   frame.setVisible( true );
              label1= new JLabel ();
              label1.setText("Label 1");
              add(label1, BorderLayout.WEST);
         //     label2= new JLabel ("Label 2", SwingConstants.CENTER);
         //   add(label2, BorderLayout.CENTER);
              label3= new JLabel ();
              label3.setText("Label 3");
              add(label3, BorderLayout.EAST);
              label4= new JLabel ("Label 4", SwingConstants.CENTER);
              add(label4, BorderLayout.NORTH);
              label5= new JLabel ("Label 5", SwingConstants.CENTER);
              add(label5, BorderLayout.SOUTH);
    =============================================
    import java.awt.*;
    import javax.swing.*;
    // class to display an ImageIcon on a panel
    class MyJPanel extends JPanel
       private ImageIcon imageIcon;
       // load image
       public MyJPanel()
          imageIcon = new ImageIcon("yellowflowers.png");
       // display imageIcon on panel
       public void paintComponent( Graphics g )
          super.paintComponent( g );
          imageIcon.paintIcon( this, g, 0, 0 );
       public Dimension getPreferredSize()
          return new Dimension( imageIcon.getIconWidth(), imageIcon.getIconHeight() ); 
    ========================================
    import javax.swing.*;
    public class Test1b
         public static void main (String args[])
              Test1a test1a = new Test1a();
              test1a.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              test1a.setSize(800, 600);
              test1a.setVisible(true);
    }

    You where given an answer in your original posting:
    http://forum.java.sun.com/thread.jspa?threadID=5146301

  • Internal Frames problem

    Hi,
    I am writing a piece of code where I want to able to choose from a menu a screen that displays multiple graphs (using Internal frames.) I am using cardlayout to bring up the various options I choose from the menu. I have simplified my program as much as possible but I still seem to be getting the same error
    Exception in thread "main" java.lang.IllegalArgumentException: adding a window to a container .......
    I know I shouldn't be adding a window to a container but I can't see how I can change my code so it has the functionality I desire.
    Here is the code I am using
    import java.awt.*;
    import javax.swing.*;
    public class Test extends JFrame
         public Test()
             JPanel card1 = new JPanel();
             card1.add(new InternalFrameDemo());
              getContentPane().add(card1);
        public static void main(String[] args)
              Test frame = new Test();
              frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
              frame.setSize(200, 200);
              frame.setLocationRelativeTo( null );
              frame.setVisible(true);
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    public class InternalFrameDemo extends JFrame
        JDesktopPane desktop;
        static final int xOffset = 30, yOffset = 30;
        private JLabel graph1;
        private String Graph1;
        public InternalFrameDemo() {
            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);
            //Set up the GUI.
            desktop = new JDesktopPane(); //a specialized layered pane
            createFrame(); //create first "window"
            setContentPane(desktop);
            //Make dragging a little faster but perhaps uglier.
            desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
        //Create a new internal frame.
        protected void createFrame() {
            MyInternalFrame frame = new MyInternalFrame();
            frame.setVisible(true);
            desktop.add(frame);
            try {
                frame.setSelected(true);
            } catch (java.beans.PropertyVetoException e) {}
        //Quit the application.
        protected void quit() {
            System.exit(0);
       public void MyInternalFrame() {
         System.out.println("graph1");
         graph1 = new JLabel("", 
                       new ImageIcon("../images/Graph1.jpg"),
                       JLabel.CENTER);
         getContentPane().add(graph1);
         //...Then set the window size or call pack...
         setSize(500,550);
    }If anyone could point me in the right direction it would be great. Thanks in advance!

    But I actually do not understand what that card layout thing is all about. If you want to hide/show internal frames you can simply use setVisible() and setSelected() like examplified below (I did put all code in the same file for my convenince). I have put a text in the label so that you can see that it is replaced. Using aJLabel to show an image is however a little bit weird.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    class MyInternalFrame extends JInternalFrame
      private JLabel graph1;
      public MyInternalFrame(String text)
        graph1 = new JLabel(text, 
                            new ImageIcon("../images/Graph1.jpg"),
                            JLabel.CENTER);
        getContentPane().add(graph1);
        setSize(500,550);
    public class InternalFrameDemo extends JFrame
      private JDesktopPane desktop;
      private final MyInternalFrame[] frames;
      public InternalFrameDemo()
        super("InternalFrameDemo");
        frames = new MyInternalFrame[3];
        //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);
        //Set up the GUI.
        desktop = new JDesktopPane(); //a specialized layered pane
        setContentPane(desktop);
        frames[0] = createFrame("Hello world!");
        frames[1] = createFrame("Hello again, world!");
        frames[2] = createFrame("Goodbye cruel world!");
        desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
        setSize(500, 500);
        Thread animThread = new Thread()
            public void run()
              for (int i = 0; i < frames.length; ++i)
                final int frameId = i;
                SwingUtilities.invokeLater(new Runnable()
                    public void run()
                      // Hide frame that is showing.
                      if (frameId != 0)
                        frames[frameId - 1].setVisible(false);
                      System.out.println("Replacing image: " + frameId);
                      frames[frameId].setVisible(true);
                      try
                        frames[frameId].setSelected(true);
                      catch (java.beans.PropertyVetoException exc)
                        exc.printStackTrace();
                try
                  Thread.sleep(3000);
                catch (InterruptedException exc)
                  exc.printStackTrace();
        animThread.start();
      //Create a new internal frame.
      protected MyInternalFrame createFrame(String text)
        MyInternalFrame frame = new MyInternalFrame(text);
        desktop.add(frame);
        return frame;
      public static void main(String[] args)
        JFrame frame = new InternalFrameDemo();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
    }Using lazy initialization where you postpone the creation of an internal frame until it is actually shown would be an improvement.
    The setVisible/Selected() call can of course be triggered by something else in your application.
    Note that changes of swing components shall be made in the EDT.

  • Openinig internal frames by clicking menuitems

    Hi,
    I have been trying to open internal frames by clicking menu items but
    have not been able to do so because menuitems support only action listeners and not all mouse event listeners.
    Actually I wanted the event to return the frame n which the event has occured
    e.g., event,getframe(), so that I could create an internal frame in the same frame.
    But such kind of function is unavailable.
    Kindly suggest something...the code is given below (it works perfectly)..it need a text file from which the menuitems are read. This is also given below:
    import javax.swing.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.lang.*;
    import java.io.*;
    import javax.swing.plaf.metal.*;
    import javax.swing.*;
    import javax.swing.undo.*;
    class Action extends JFrame
         ActionListener FListener = new ActionListener()
               public void actionPerformed(ActionEvent event)
                  {System.out.println("Menu item " + event.getActionCommand(  ) +"  of File Menu was pressed.");}
        ActionListener EListener = new ActionListener()
               public void actionPerformed(ActionEvent event)
                  {System.out.println("Menu item " + event.getActionCommand(  ) +"  of Edit Menu was pressed.");}
        ActionListener VListener = new ActionListener()
               public void actionPerformed(ActionEvent event)
                  {System.out.println("Menu item " + event.getActionCommand(  ) +"  of View Menu was pressed.");}
        ActionListener TListener = new ActionListener()
               public void actionPerformed(ActionEvent event)
                  {System.out.println("Menu item " + event.getActionCommand(  ) +"  of Tools Menu was pressed.");}
        ActionListener HListener = new ActionListener()
               public void actionPerformed(ActionEvent event)
                  {System.out.println("Menu item " + event.getActionCommand(  ) +"  of Help Menu was pressed.");}
         /*     protected class MyUndoableEditListener  implements UndoableEditListener
                  protected UndoManager undo = new UndoManager();
                  public void undoableEditHappened(UndoableEditEvent e)
                 //Remember the edit and update the menus
                 undo.addEdit(e.getEdit());
                 undoAction.updateUndoState();
                 redoAction.updateRedoState();
          class framecreator extends JFrame
               public JFrame CreateFrame(JMenuBar m)
             JDesktopPane jdp= new JDesktopPane();
              JFrame.setDefaultLookAndFeelDecorated(true);       
            JFrame frame = new JFrame("PEA");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);         
            frame.setContentPane(jdp);
            jdp.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);          
            frame.setJMenuBar(m);       
            frame.pack();
            frame.setVisible(true);
            frame.setSize(600,600);
            frame.setLocation(100,100);
            return frame;
          class internalframecreator extends JFrame
             public JInternalFrame CreateInternalFrame(JFrame f)
              Container cp= f.getContentPane();
              JInternalFrame jif = new JInternalFrame("internal frame",true,true,true,true);
             cp.add(jif);
             jif.pack();
             jif.setVisible(true);
             jif.setSize(300,300);
             jif.setLocation(80,80);
             return jif;    
      class menucreator
         public String[] filereader()
              String[] menuitems=new String[21];
              int i=0,j=0;
              String record = null;            
                   for(int h=0;h<21;h++){ menuitems[h]=null;}
               try { 
                    FileReader fr = new FileReader("projectconfig2.txt");  
                     BufferedReader br = new BufferedReader(fr);
                         while ( (record=br.readLine()) != null )
                           StringTokenizer st = new StringTokenizer(record,"\n");
                             while (st.hasMoreTokens())
                          menuitems= st.nextToken();
         System.out.println(menuitems[i]);
    i++;
                   /* StringTokenizer st1 = new StringTokenizer(record,"\n");
         while (st1.hasMoreTokens())
         while ( (record=br.readLine()) != null )
         StringTokenizer st2 = new StringTokenizer(record,":");
         while (st2.hasMoreTokens())
         menuitems[i][j]= st2.nextToken();
         System.out.println(menuitems[i][j]);
              j++;      
         i++;
              } catch(IOException e)
         System.out.println("Error reading file");
         return (menuitems);
         public JMenuBar CreateMenu(Action a, String menuitems[])
    JMenuBar mb = new JMenuBar();
    JMenu fileB = new JMenu(menuitems[0]);
    JMenu editB = new JMenu(menuitems[8]);
    JMenu viewB = new JMenu(menuitems[11]);
    JMenu toolsB = new JMenu(menuitems[14]);
    JMenu helpB = new JMenu(menuitems[18]);
    mb.add(fileB);
    mb.add(editB);
    mb.add(viewB);
    mb.add(toolsB);
    mb.add(helpB);
    JMenuItem newpolicyB = new JMenuItem(menuitems[1]);
    newpolicyB.addActionListener(a.FListener);
    //newpolicyB.addUndoableEditListener(new MyUndoableEditListener());
    JMenuItem openB = new JMenuItem(menuitems[2]);
    openB.addActionListener(a.FListener);
    JMenuItem saveB = new JMenuItem(menuitems[3]);
    saveB.addActionListener(a.FListener);
    JMenuItem saveasB = new JMenuItem(menuitems[4]);
    saveasB.addActionListener(a.FListener);
    JMenuItem printxmlB = new JMenuItem(menuitems[5]);
    printxmlB.addActionListener(a.FListener);
    JMenuItem printreadablepolicyB = new JMenuItem(menuitems[6]);
    printreadablepolicyB.addActionListener(a.FListener);
    JMenuItem exitB = new JMenuItem(menuitems[7]);
    exitB.addActionListener(a.FListener);
    JMenuItem undoB = new JMenuItem(menuitems[9]);
    undoB.addActionListener(a.EListener);
    JMenuItem redoB = new JMenuItem(menuitems[10]);
    redoB.addActionListener(a.EListener);
    JMenuItem xmlB = new JMenuItem(menuitems[12]);
    xmlB.addActionListener(a.VListener);
    JMenuItem readablepolicyB = new JMenuItem(menuitems[13]);
    readablepolicyB.addActionListener(a.VListener);
    JMenuItem validateB = new JMenuItem(menuitems[15]);
    validateB.addActionListener(a.TListener);
    JMenuItem signandpublishB = new JMenuItem(menuitems[16]);
    signandpublishB.addActionListener(a.TListener);
    JMenuItem optionsB = new JMenuItem(menuitems[17]);
    optionsB.addActionListener(a.TListener);
    JMenuItem pemanualB = new JMenuItem(menuitems[19]);
    pemanualB.addActionListener(a.HListener);
    JMenuItem aboutB = new JMenuItem(menuitems[20]);
    aboutB.addActionListener(a.HListener);
    fileB.add(newpolicyB);
    fileB.add(openB);
    fileB.add(saveB);
    fileB.add(saveasB);
    fileB.add(printxmlB);
    fileB.add(printreadablepolicyB);
    fileB.add(exitB);
    editB.add(undoB);
    editB.add(redoB);
    viewB.add(xmlB);
    viewB.add(readablepolicyB);
    toolsB.add(validateB);
    toolsB.add(signandpublishB);
    toolsB.add(optionsB);
    helpB.add(pemanualB);
    helpB.add(aboutB);
    mb.setSize(300,200);
    mb.setVisible(true);
    return mb;
    public class project
    public static void main(String args[])
              Action a =new Action();           
              framecreator fc=new framecreator();           
         menucreator mc=new menucreator();     
         internalframecreator ifc= new internalframecreator();          
         ifc.CreateInternalFrame(fc.CreateFrame(mc.CreateMenu(a,mc.filereader())));
    The text file called projectconfig2.txt
    File
    New Policy
    Open...
    Save
    Save As...
    Print XML
    Print Readable Policy
    Exit
    Edit
    Undo
    Redo
    View
    XML
    Readable Policy
    Tools
    Validate
    Sign & Publish
    Options
    Help
    PE Manual
    About

    The problem is that you are adding the JInternalFrame to the JFrame's contentPane when it should be added to the JDesktopPane. See your code ...
    public JInternalFrame CreateInternalFrame( JFrame  f )
         Container  cp = f.getContentPane();
         JInternalFrame jif = new JInternalFrame("internal frame",true,true,true,true);
         cp.add( jif );

  • How to keep the SAME position of layout on left & right pages when adding a page?

    A little background first before I ask the question:
    I've been converting a PowerPoint document to the InDesign format, and adding pages as I go through by duplicating a page in order to keep the top description text in the same position at the top left hand side. The document is over 110 pages- more pages will be added soon, and some pages deleted. Basically the presentation will be printed as a book, and the client we are designing this presentation for sent us the master pages for the layout.
    The issue I'm now having: I had to delete an odd number of pages which caused a shift of the layout of pages throughout the document after the pages I deleted. I figured that the right hand page was not aligned the same as the right hand page, so I measured in the same distance from the left edge on both pages and made the adjustments. But then when I added a page, the alignment shifted again.
    Is this an issue with the master pages? Or is this another issue? Any idea how to fix this so that the pages are aligned the same whether I add or delete a page? I've included two screen grabs to better illustrate what is happening:
    I would be very grateful for any help you may be able to offer on this, thank you in advance.
    Vera

    Those are your margin guides, and your client evidently expects the margins to be larger on the outside of the page than at the spine. Putting the text frame that says Main Building... on the master page will not only save you having to enter it each time, but will let you put it where it should be and have it stay there when pages switch sides. Your images are going to seem to shift, too, unless they are centered on the page on the horizontal axis.
    I'm sensing you really have little or no experience using ID, and some basic training would probably help you quite a bit. I'll recommend Sandee Cohen's Visual Quickstart Guide to InDesign -- best book out there for beginners.

  • Image icon on internal frame disappearing and re-appearing

    I have just upgraded to jdk 1.4.1-b21 from 1.4.0_01-b03 and have noticed that after adding an Internal Frame to a desktop and moving the mouse over the image icon in the left hand corner the image disappears. The image re-appears again, once I presume, when the desktop and its frames are repainted.
    Is this a bug or has something changed between the two jdk's.
    Thanks.
    Steve.

    Hi,
    I attempted the Disk Utility Repair but it did not work.
    So I disabled the application 'StickyWindows' and this resolved the problem.
    Hope this helps.

  • Flicker/flash in top and bottom when adding the "Gaussian" effect to clip.

    I get a flicker/flash on the top and bottom of one of the clip where I have added the "Gaussian" effect. A "white - black - white - black" flash. This happened just to one of many clips with the same gaussian effect.
    It seems as if the flash happens on every other frame.
    Anyone know how to fix this?
    I tried taking screenshots of the clip/flash - but it did not show that well in the picture..

    Couple of ways to go this. Simple way make the clip a compound clip and apply the letterbox to the compound. Open the compound and do the straightening and rotating inside the compound.

  • Canvas on the Internal Frame overlap the Menus.!!!

    hi friends
    i have added canvas on the internal frame(contentpane).
    when internal frame appears on the screen menus are being overlapped.
    it means if i open the menu they will be hide behind canvas and can not be seen.
    plzz guide me what to do?

    This is a typical problem when mixing Swing (JFrame) components with AWT components (Canvas). Make sure you stick to only one of these GUI packages when implementing your own gui.
    Have a look at the java tutorial.
    http://java.sun.com/docs/books/tutorial/uiswing/painting/overview.html
    Manuel Amago.

  • Keynote is adding black pages when I use effcts and transitions

    When I use effects on keynote pages such as disolve and I try to play back the presentation keynote seems to be adding blank pages between slides. Can anyone help me?

    You could try to update your system to 10.4.11. That is the system requirement for iWork'09.

  • Menu hidden by internal frame

    Im using JDeveloper 3.1.1.2. After opening an internal frame, the pull down part of the menu was hidden behind the opening internal frame, so user can not select other menu options without closing the internal frame, any one know a bug fix or work round? Thanks in advance!

    I don't think you can reliably embed PDF files in a web page.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "SheriAnna" <[email protected]> wrote in
    message
    news:gi9gdk$kti$[email protected]..
    >I used "insert media activeX" to embed a pdf file on my
    webpage, which
    >worked
    > fine - but it is on top of my horizontal pull out menu.
    I used the
    > "wmode=opaque" parameter. I also tried
    "wmode=transparent". Nether worked.
    > I also tried "insert media plugin" which also worked to
    embed pdf but
    > still
    > was on top when I tried to use parameter of "wmode".
    >
    >
    > <script type="text/javascript">
    > AC_AX_RunContent(
    >
    'data','../../assets/PDF/Parts/10-Burners-witn-TOC.pdf','width','1010','height',
    > '650',
    >
    'src','../../assets/PDF/Parts/10-Burners-witn-TOC.pdf','wmode','opaque'
    > ); //end AC code
    > </script><noscript><object
    > data="../../assets/PDF/Parts/10-Burners-witn-TOC.pdf"
    width="1010"
    > height="650"
    >>
    > <param name="wmode" value="opaque" />
    > <embed
    src="../../assets/PDF/Parts/10-Burners-witn-TOC.pdf" width="1010"
    > height="650" wmode="transparent"></embed>
    > </object>
    > </noscript>
    >

  • Desktop Management for Internal Frames Survey (please take a moment)

    Internal frames under all look and feels currently exhibit state management that does not match generally accepted behavior.
    Example: maximizing -> minimizing -> restoring an internal frame does not restore the frame back to the maximized bounds, but restores it to its normal bounds. (Expected behavior can be seen by using a MDI application under Windows.)
    My question is, how many people out there are currently depending on the current implementation? If so, is this because you are currently subclassing the desktop manager or plaf code? If other reasons, please specify... Do you want this issue fixed? Any other pet peeves I'm missing? For more information you can search the bug database for bug 4424247.
    Thanks for your time.

    Yeah, I'm logged in...here is the screen:
    Sorry. We couldn't find your document.
    The document you are looking for may have been moved due to our site redesign or the URL may be invalid. To find the page, you can either use our search engine or choose from one of the index pages listed below.
    Technical Articles
    Book Excerpts
    Tech Tips
    Quizzes
    Java Wireless Developer Initiative
    If you are certain that this URL is valid, send us email about the broken link. Tell us the URL of the page that you came from (if you know it), and the broken URL. We'll make sure the right people look at the problem.
    We're sorry if this site redesign has caused you any inconvenience. We hope the reorganization will work better for you. Meanwhile take a look at the latest postings, and remember to reset your bookmarks!
    If you have any questions or feedback please contact us.
    Thank you,
    The Java Developer Connection

  • Can someone help?? Internal Frame

    This code is lifted from the program that I am making. When jButton4 is pressed, it should display an internal frame somewhere in the screen, however, nothing is happening. I don't know what to do! My project is due this coming weekend..:( Can anyone help??
    jButton4.addActionListener(
         new ActionListener() {
              public void actionPerformed (ActionEvent e)
                   System.out.println("I pressed jButton4!");
                   JInternalFrame jInternalFrame2 = new JInternalFrame();
                   jInternalFrame2.setName("More Shapes");
                   jInternalFrame2.setLocation(0,0);
                   jInternalFrame2.getContentPane().add(new JButton("abc"));
                   jInternalFrame2.pack();
                   jInternalFrame2.setVisible(true);

    <gosh - ANOTHER emergency..>
    Nowhere in that code are you adding the JInternalFrame to anything...
    Where would you expect it to appear then... I assume that you have a JDesktopPane hiding
    somewhere....?
    JInternalFrame is a LIGHTWEIGHT component....... ;)

  • Internal frame dragging perfermance problem in JDK1.4.1

    Hi there,
    When using internal frame with outline(not faster or LIVE_DRAG_MODE) property with JDK 1.4.1_01 (windows), the speed of internal frame dragging is terrible(very very slow).
    The same code runs fine with JDK1.3.X, and it's performance(dragging speed) is acceptable(not very good, so so) when using JDK 1.4.0_X.
    I've tried both motheds to set the property as follow, and got the same result:
    desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
    desktop.putClientProperty("JDesktopPane.dragMode", "outline");
    But, after I commented the line: g.setXORMode(Color.white); //line Num: 279
    in the class javax.swing.DefaultDesktopManager.java, the speed of dragging is very well(as same as when running with JDK1.3.X).
    My qestions are:
    - How can I improve the internal frame dragging performance in JDK 1.4.1_01(windows)?
    - Does my testing mean to a bug in the implementation of the abstract method Graphics.setXORMode() in the JDK 1.4.1_01 windows version ?
    TIA
    In terms of the test case, we may just use the follows:
    http://java.sun.com/docs/books/tutorial/uiswing/components/example-swing/InternalFrameDemo.java
    http://java.sun.com/docs/books/tutorial/uiswing/components/example-swing/MyInternalFrame.java

    Anyone know if this is registered as a bug? I couldn't find it.

  • Custom internal frames

    Hello,
    I have written some custom internal frames, along with their UI's, title panes, and desktop icons. Everything seems to work fine when I'm in JBuilder and I use the "run" command, but when I compile the program and run it as a batch file, my internal frames appear as gray boxes that can't be moved or resized.
    package KComponent;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    import Theme.*;
    import java.io.*;
    import javax.swing.border.*;
    public class KInternalFrame extends JInternalFrame {
      private JLabel titleLabel;
      private String title;
      public static Color titleColor = Color.white;
      public static Color titleBarColor = Theme.DARK;
      private KButton maximize, minimize, normalize;
      private static final String PATH = "pics" + File.separator;
      public KInternalFrame(String title) {
        super(title, true, false, true, true);
        this.title = title;
        this.titleColor = titleColor;
        this.titleBarColor = titleBarColor;
        //getContentPane().add(content, BorderLayout.CENTER);
        //setContentPane(content);
        //LineBorder line = new LineBorder(titleBarColor, 2);
        //setBorder(line);
        setBorder(BorderFactory.createRaisedBevelBorder());
        this.getDesktopIcon().setUI(new KDesktopIconUI(title, titleBarColor, titleColor));
        setUI(new KInternalFrameUI(this));
    package KComponent;
    import javax.swing.plaf.basic.*;
    import javax.swing.*;
    import java.awt.*;
    import Theme.*;
    public class KInternalFrameUI extends BasicInternalFrameUI {
      public KInternalFrameUI(JInternalFrame frame) {
        super(frame);
      protected void installDefaults(){
          Icon frameIcon = frame.getFrameIcon();
          frame.setFrameIcon(null);
          /* enable the content pane to inherit background color from its
             parent by setting its background color to null. Fixes bug#
             4268949. */
          JComponent contentPane = (JComponent) frame.getContentPane();
          if (contentPane != null) {
            Color bg = contentPane.getBackground();
          else {
            Color bg = null;
          //LookAndFeel.installBorder(frame, "InternalFrame.border");
      protected JComponent createNorthPane(JInternalFrame w) {
        titlePane = new KInternalFrameTitlePane(w, w.getTitle(), Theme.DARK, Color.white);
        return titlePane;
    package KComponent;
    import javax.swing.plaf.basic.*;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.File;
    import Theme.*;
    public class KInternalFrameTitlePane extends BasicInternalFrameTitlePane implements ActionListener {
      private JInternalFrame frame;
      private final String PATH = "pics" + File.separator;
      private KButton maxButton;
      private KButton minButton;
      private KButton normButton;
      private JLabel titleLabel;
      private File maxIcon = new File(PATH, "maximize.gif");
      private File maxOver = new File(PATH, "maximize_rollover.gif");
      private File minIcon = new File(PATH, "minimize.gif");
      private File minOver = new File(PATH, "minimize_rollover.gif");
      private File norIcon = new File(PATH, "normal.gif");
      private File norOver = new File(PATH, "normal_rollover.gif");
      String title;
      Color activeTitle;
      Color activeTitleText;
      Color inactiveTitle;
      Color inactiveTitleText;
      public KInternalFrameTitlePane(JInternalFrame frame, String title, Color activeTitle, Color activeTitleText) {
        super(frame);
        this.frame = frame;
        this.title = title;
        this.activeTitle = activeTitle;
        this.activeTitleText = activeTitleText;
        //this.inactiveTitle = inactiveTitle;
        //this.inactiveTitleText = inactiveTitleText;
        installTitlePane();
      public void installTitlePane() {
        titleLabel = new JLabel(" " + title + " ");
        titleLabel.setFont(new Font("verdana", Font.PLAIN, 11));
        titleLabel.setForeground(activeTitleText);
        titleLabel.setBorder(null);
        titleLabel.setOpaque(false);
        File icon = new File(PATH, "maximize.gif");
        File rollover = new File(PATH, "maximize_rollover.gif");
        maxButton = new KButton(icon, rollover, rollover, false);
        maxButton.setOpaque(false);
        maxButton.setToolTipText("Maximize window");
        maxButton.setActionCommand("maximize");
        //maxButton.addActionListener(this);
        icon = new File(PATH, "minimize.gif");
        rollover = new File(PATH, "minimize_rollover.gif");
        minButton = new KButton(icon, rollover, rollover, false);
        minButton.setOpaque(false);
        minButton.setToolTipText("Minimize window");
        minButton.setActionCommand("minimize");
        //minButton.addActionListener(this);
        icon = new File(PATH, "normal.gif");
        rollover = new File(PATH, "normal_rollover.gif");
        normButton = new KButton(icon, rollover, rollover, false);
        normButton.setOpaque(false);
        normButton.setToolTipText("Normalize window");
        normButton.setActionCommand("normal");
        //normButton.addActionListener(this);
        JPanel buttonHeader = new JPanel(new GridLayout(1, 3, 0, 0));
        buttonHeader.setOpaque(false);
        buttonHeader.add(minButton);
        buttonHeader.add(normButton);
        buttonHeader.add(maxButton);
        JPanel titlePane = new JPanel(new BorderLayout());
        titlePane.setBackground(activeTitle);
        titlePane.add(titleLabel, BorderLayout.WEST);
        titlePane.add(buttonHeader, BorderLayout.EAST);
        setBackground(activeTitle);
        setLayout(new BorderLayout());
        //add(titleLabel, BorderLayout.WEST);
        //add(buttonHeader, BorderLayout.EAST);
        add(titlePane, BorderLayout.CENTER);
        //installDefaults();
        createActions();
        enableActions();
        //createActionMap();
        assembleSystemMenu();
        createButtons();
      protected void createButtons() {
          minButton.addActionListener(iconifyAction);
          minButton.setActionCommand("minimize");
          minButton.addActionListener(this);
          maxButton.addActionListener(maximizeAction);
          maxButton.setActionCommand("maximize");
          maxButton.addActionListener(this);
          normButton.addActionListener(restoreAction);
          normButton.setActionCommand("normal");
          normButton.addActionListener(this);
          //setButtonIcons();
      public void setButtonIcons() {}
      public void actionPerformed(ActionEvent e) {
        String command = e.getActionCommand();
        if (command.equals("maximize")) {
          maxButton.setEnabled(false);
          minButton.setEnabled(true);
        else if (command.equals("minimize")) {
          //maxButton.setEnabled(true);
          //minButton.setEnabled(false);
        else if (command.equals("normal")) {
          maxButton.setEnabled(true);
          minButton.setEnabled(true);
    package KComponent;
    import javax.swing.plaf.basic.BasicDesktopIconUI;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.File;
    import javax.swing.border.*;
    public class KDesktopIconUI extends BasicDesktopIconUI {
      private final String PATH = "pics" + File.separator;
      private File norIcon = new File(PATH, "normal.gif");
      private File norOver = new File(PATH, "normal_rollover.gif");
      JComponent iconPane;
      String title;
      Color activeTitle;
      Color activeTitleText;
      KButton norButton;
      MouseInputListener mouseInputListener;
      public KDesktopIconUI(String title, Color activeTitle, Color activeTitleText) {
        this.title = title;
        this.activeTitle = activeTitle;
        this.activeTitleText = activeTitleText;
      protected void installComponents() {
          frame = desktopIcon.getInternalFrame();
          norButton = new KButton(norIcon, norOver, norOver, false);
          norButton.setOpaque(true);
          norButton.setBackground(activeTitle);
          iconPane = new JPanel(new BorderLayout());
          JLabel jlTitle = new JLabel(" " + title + " ");
          jlTitle.setFont(new Font("verdana", Font.PLAIN, 11));
          jlTitle.setForeground(activeTitleText);
          jlTitle.setBackground(activeTitle);
          jlTitle.setOpaque(true);
          iconPane.add(jlTitle, BorderLayout.CENTER);
          iconPane.add(norButton, BorderLayout.EAST);
          desktopIcon.setLayout(new BorderLayout());
          desktopIcon.add(iconPane, BorderLayout.CENTER);
          desktopIcon.setBackground(activeTitle);
          desktopIcon.setForeground(activeTitleText);
          iconPane.setBorder(BorderFactory.createRaisedBevelBorder());
          desktopIcon.setBorder(null);
      protected void installListeners() {
          mouseInputListener = createMouseInputListener();
          desktopIcon.addMouseMotionListener(mouseInputListener);
          desktopIcon.addMouseListener(mouseInputListener);
          norButton.addMouseListener(new MouseAdapter() {
            public void mousePressed(MouseEvent e) {
              deiconize();
      public Dimension getMinimumSize(JComponent c) {
          return iconPane.getMinimumSize();
      public Dimension getMaximumSize(JComponent c){
          return iconPane.getMaximumSize();
      public Dimension getPreferredSize(JComponent c) {
          JInternalFrame iframe = desktopIcon.getInternalFrame();
          Border border = iframe.getBorder();
          int w2 = 157;
          int h2 = 18;
          //if(border != null)
              //h2 += border.getBorderInsets(iframe).bottom +
                //    border.getBorderInsets(iframe).top;
          return new Dimension(w2, h2);
      protected void uninstallComponents() {
          desktopIcon.setLayout(null);
          desktopIcon.remove(iconPane);
    package KComponent;
    import javax.swing.*;
    import java.awt.*;
    import Theme.*;
    import javax.swing.plaf.metal.*;
    public class KDesktop extends JDesktopPane {
      ImageIcon icon;
      boolean isWatermark;
      JInternalFrame gb, proj, stat, cal;
      boolean gbOpen, projOpen, statOpen, calOpen;
      public KDesktop(boolean isWatermark) {
        this.isWatermark = isWatermark;
        icon = Theme.getBackground();
        setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
      public void setBackgroundImage(ImageIcon i) {
        icon = i;
      public ImageIcon getBackgroundImage() {
        return icon;
      public void paintComponent(Graphics g) {
        super.paintComponent(g);
        if (!isWatermark) {
          if (getWidth() > icon.getIconWidth() || getHeight() > icon.getIconHeight()){
            g.drawImage(icon.getImage(), 0,0, getWidth(), getHeight(), null);
          else {
            if (getProportionalHeight(getWidth()) < getHeight()) {
              g.drawImage(icon.getImage(), 0, 0,
                          getProportionalWidth(getHeight()), getHeight(), null);
            else
              g.drawImage(icon.getImage(), 0,0,
                          getWidth(), getProportionalHeight(getWidth()), null);
        else {
          int w = icon.getIconWidth();
          int h = icon.getIconHeight();
          if (w == '\u0000' || h == '\u0000') {
            super.paint(g);
          else {
            int currX = 0;
            int currY = 0;
            boolean keepPainting = true;
            while (keepPainting) {
              if (currX < (getWidth()+w/2)) {
                g.drawImage(icon.getImage(), currX, currY, null);
                currX += w;
              else if (currY < (getHeight()+h/2)) {
                currX = 0;
                currY += h;
                g.drawImage(icon.getImage(), currX, currY, null);
              else keepPainting = false;
      public int getProportionalHeight(int width) {
        double percentage = (double)width/icon.getIconWidth();
        return (int)(percentage*icon.getIconHeight());
      public int getProportionalWidth(int height) {
        double percentage = (double)height/icon.getIconHeight();
        return (int)(percentage*icon.getIconWidth());
    }Any ideas? I don't see how everything could work fine within the JBuilder environment and then screw up when I compile the code.
    Thanks for any help.

    And this is how I call up the UI from my main function:
    displayFrame.setUI(new MyInternalFrameUI(intFrame));Thanks!

  • Passing data from a Table in a Dialog to a Listbox in a Internal Frame

    Hi All,
    Currently I have 2 .java classes.
    In the first class, DisplayListBox.java, it would have listboxes in it and a textbox with a button, Find.
    Upon clicking on the "Find" button, it would create a dialog window and call the second class, TableSelection.java.
    Therefore now, the dialog window would contain a table with all the datas.
    Just in case you guys would like to know, the dialog window was created in the DisplayListBox.java class and the internal frame was being created in another cls upon clicking the menu btn.
    Upon selecting a cell in the table, i'd like to pass the value to the listbox in the internal frame, how can i go about doing it?
    I've got the coding for getting the value of a selected cells. However, i'm unsure of how i can pass the value retrieved to the listbox in the internal frame.
    Any help and advices are gladly appreciated! (:

    Thanks for your reply.
    However, I am quite new to java so is it possible for you to explain in details of how i should go about going it?
    To start off, could you tell me:
    1. Where do I create the ListSelectionListener? In the DisplayListBox.java or TableSelection.java?
    Sorry for the trouble but i just picked up java so I am pretty much unsure of all these stuff.
    Thanks for your help! (:

Maybe you are looking for

  • Label Data View in Material Master

    Dear Team, Despite of performing all below standerd steps, i am not able to view Label Data view in Material Master. pls guide steps performed. 1. Check whether the screen sequence SP exists in Customizing for the Material Master under Define Structu

  • Which carrier should I use?

    I do not know which carrier I should use when I buy the new iPhone. Previously I have bought Rogers phones, but my texts sometimes weren't sent! I need a plan both affordable and reliable, which one should I go with?

  • System Copy Methods

    Hello All,                   I need to perform system copy.I know the procedure from sapinst.But I have one doubt While doing the database Instance Installation we have 2 Methods: 1.Standard System Copy/Migration. 2. Homogenous System copy(MS Sql ser

  • N95 and connexion via Wifi

    Hi All I would like to know if the the N95 can be connectied on the web via my DSL wifi connexion in my home or office, like a PDA, I would like to by a new phone, and I'm not sure, PDA like HP or others can be connected on the web via wifi, without

  • SwingUtilities.updateComponentTreeUI()

    hello everybody, can you please have a look at this? probably I posted the problem in the wrong forum first, so here is the link: http://forum.java.sun.com/thread.jspa?threadID=753965 thanks a lot