Multiple JInternalFrames

I am using several JInternalFrames within a single JFrame. As of now each JInternalFrame is an inner class within the JFrame class. I want to seperate each JInternalFrame into its own class. If I do this how do I get the button in one JInternalFrame to set another JInternalFrame to visable seeing how we have no global variable in Java. I want to create all JInteranlFrame at once inside the Main JFrame. I do not want to be recreating the JInternalFrames each time I want to display them.
This is not the exact code but I hope it gives you an idea.
class MainJFrame extends JFrame {
JDesktopPane d1;
JButton b1;
InternalFrame_A a1 = new InternalFrame_A();
InternalFrame_A b1 = new InternalFrame_A();
d1.add(b1);
b1 Action = setVisable(a1);
class InternalFrame_A extends JInternalFrame {
JButton A1;
A1 Action = setVisable(b1);
class InternalFrame_B extends JInternalFrame {
JButton B1;
B1 Action = setVisable(a1);
}

Sorry, let me try to clarify. This is an application with a main menu (MainFrame). You submit an action on this main menu (A button). This brings up a form (JInternalFram_A). After filling out this form and hitting the submit button (a1), another form or menu open (JInternalFrame_B). After doing something and hitting submit or cancel the main menu come back up. I meant setting focu not visability. When main menu (MainFrame) has focus all other JInternalFrames are hiden behind it. And likewise for other JInternalFrames. Basically you can only see 1 JInternalFrame at a time.
Hopefully this helps.

Similar Messages

  • How do I add multiple JInternalFrames to 1 main JFrame

    It may seem like a silly question but I'd really appreciate any help offered. Sample code might be of assistance.
    Thanks people :-)

    It's very simple. Create a JFrame,
    then create separate classes for each JInternalFrame (here: TFrame, SFrame, GFrame)
    Here's some code:
    public class GWorkBench extends JFrame {
    public GWorkBench() {
    //Set up the GUI.
    desktop = new JDesktopPane(); //a specialized layered pane
    setContentPane(desktop);
    setJMenuBar(createMenuBar());
    protected JMenuBar createMenuBar() {
    JMenuBar menuBar = new JMenuBar();
    JMenu menu = new JMenu("Modules");
    menu.setMnemonic(KeyEvent.VK_D);
    JMenuItem menuItem1 = new JMenuItem("Data Entry");
    JMenuItem menuItem2 = new JMenuItem("Search Module");
    JMenuItem menuItem3 = new JMenuItem("Generation Module");
    menuItem1.setMnemonic(KeyEvent.VK_E);
    menuItem2.setMnemonic(KeyEvent.VK_S);
    menuItem3.setMnemonic(KeyEvent.VK_G);
    menuItem1.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    createTFrame();
    menuItem2.addActionListener(new ActionListener() {
         public void actionPerformed(ActionEvent e) {
              createSFrame();
    menuItem2.addActionListener(new ActionListener() {
         public void actionPerformed(ActionEvent e) {
              createGFrame();
    menu.add(menuItem1);
    menu.add(menuItem2);
    menu.add(menuItem3);
    menuBar.add(menu);
    return menuBar;

  • Moving multiple JInternalFrames

    Hi,
    here's what I would like to do:
    1. Selecting a group of JInternalFrames (in a JDesktopPane) by Control-Click or by drawing a rectangle around them.
    2. Moving the selected JInternalFrames at the same time to a new position (new Position is where the mouse is released.)
    Is there an existing concept or do you have any suggestions how to do that?
    Thanks
    Hagen

    This is a sample of drawing a rectangle on the desktop using the mouse.
    When the mouse is released you have to calculate the new location of the frames and use setLocation to move them.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class DTs1 extends JFrame
         JDesktopPane   desktop = new NwDesktopPane();
         JPanel         ptv     = new JPanel();
         JInternalFrame if1     = new JInternalFrame("Ptv",true,false,true,true);;
         JPanel         ptg     = new JPanel();
         JInternalFrame if2     = new JInternalFrame("Ptg",true,false,true,true);;
    public DTs1() 
         super("");
         setBounds(5,5,720,510);
         setBackground(Color.lightGray);
         addWindowListener(new WindowAdapter()
        {     public void windowClosing(WindowEvent ev)
              {     dispose();
                   System.exit(0);
         setContentPane(desktop);
         desktop.setBackground(Color.white);
         desktop.setLayout(null);
         addPtv();
         setVisible(true);
    private void addPtv()
         if1.setBounds(89,66,150,110);
         if1.setVisible(true); 
         desktop.add(if1);
         if2.setBounds(210,210,200,170);
         if2.setVisible(true); 
         desktop.add(if2);
    public class NwDesktopPane extends JDesktopPane implements MouseListener,  MouseMotionListener
         int fx=-1,fy,tx,ty;
    public NwDesktopPane()
         addMouseListener(this);
         addMouseMotionListener(this);
    public void paintComponent(Graphics g)
         super.paintComponent(g);
         if (fx > 0)     g.drawRect(fx,fy,tx-fx,ty-fy);
    public void mouseClicked(MouseEvent m){}
    public void mouseEntered(MouseEvent m){}
    public void mouseExited(MouseEvent m) {}
    public void mousePressed(MouseEvent m)
         fx = m.getX();
         fy = m.getY();
         tx = m.getX();
         ty = m.getY();
    public void mouseReleased(MouseEvent m)
         fx = -1;
         repaint();
    public void mouseMoved(MouseEvent m){}
    public void mouseDragged(MouseEvent m)
         repaint(fx,fy,tx+1,ty+1);
         tx = m.getX();
         ty = m.getY();
         repaint(fx,fy,tx+1,ty+1);
    public static void main (String[] args) 
         new DTs1();
    }     

  • JInternalFrame drawing problem.

    Hi gurus
    Please could you help with a java problem that I cant find an answer to over the net:
    I have a JDesktop which contains multiple JInternalFrames. On one JInternalFrame i have attached a JPanel on which to draw on. I have multiple threads (simple ball shapes) that need to be drawn onto the JPanel and have left it up to the indivual threads to draw themselves (as opposed to using paintComponent in the JPanel class). The drawing on the JInternalFrame works perfectly fine.
    The problem arises when the other JInternalFrames are placed on top of each other - the balls are drawn over the top most JInternalFrame. What am i doing wrong? I have attached snippets of the code:
    public class Desktop extends JFrame implements ActionListener
              public Desktop()
                        setTitle("Agent's world");
                        setSize(w,h);
                        setDefaultCloseOperation(EXIT_ON_CLOSE);
                        JDesktopPane desktop = new JDesktopPane();
                        setContentPane(desktop);
                        /************* Agent *************/
                        JInternalFrame agents = new JInternalFrame("Agents War", true, false, true, false);                    
                        agents.reshape(0,0,(int)((w/3)*2),h);
                        Container contentPane = agents.getContentPane();
                        canvas = new AgentPanel(agents);
                        contentPane.add(canvas);
                        /************* Button *************/
                        JPanel buttonPanel = new JPanel();
                        ButtonGroup buttonGroup = new ButtonGroup();
                        JButton start = new JButton("START");
                        start.addActionListener(this);
                        buttonPanel.add(start);
                        contentPane.add(buttonPanel, "North");
                        agents.setVisible(true);
                        desktop.add(agents);
                        //sets focus to other frames within the desktop
                        try
                                  agents.setSelected(true);
                        catch(PropertyVetoException e)
                                  //attempt to refocus was vetoed by a frame
              /** Method to listen for event actions, i.e. button clicks **/
         public void actionPerformed(ActionEvent event)
                   //passes through 'this' to allow access to the getList method
                   Agents agent = new Agents(canvas, this);
                   agent.start();
    public class Agents extends Thread
              public Agents(AgentPanel panel, Desktop desktop)
                        panel =_panel;
                        desktop = _desktop;
                        setDaemon(true);
    /** Moves the agent from a spefic position to a new position **/
              public void move()
                        Graphics g = panel.getGraphics();
                        Graphics2D g2 = (Graphics2D)g;
                        try
                                  //set XOR mode
                                  g.setXORMode(panel.getBackground());
                                  //draw over old
                                  Ellipse2D.Double ballOld = new Ellipse2D.Double(i , j, length, length);
                                  g2.fill(ballOld);     
                                  i++;
                                  j++;
                                  if(flag == true)
                                            //draw new
                                            Ellipse2D.Double ballNew = new Ellipse2D.Double(i , j, length, length);
                                            g2.fill(ballNew);
                                            g2.setPaintMode();
                        finally
                                  g.dispose();
              /** Activates the Thread **/
              public void run()
                   int i = 0;
                   while(!interrupted() && i<100)
                        try
                                       for(i = 0 ; i <100 ; i++)
                                                 //draw ball in old position                                             move();          
                                                 sleep(100);                              
                             catch(InterruptedException e)
    public class AgentPanel extends JPanel
              /** local copy of internal frame */
              private JInternalFrame frame;
              public AgentPanel(JInternalFrame _frame)
                        frame = _frame;
                        setSize(frame.getWidth(), frame.getHeight());
                        setBackground(Color.white);          
              public void paintComponent(Graphics g)
                        super.paintComponent(g);
    Thank you in advance.
    Ravs

    I have the same problem. Seems to be a bug. See:
    http://forum.java.sun.com/thread.jsp?forum=57&thread=231037
    Bummer.

  • Shortcut Key in JInternalFrame

    Hi,
    I have an application that has multiple JInternalFrames displayed within split panes. I am trying to set shortcut keys to cycle through the visible JInternalFrame. I have a Menu Item oCycleWindows, on which I called setAccelerator() with Ctrl+Shift+M. In th emenu handler for this item, I have defined a function that checks the current focussed internal frame, and accordingly picks the next one to get the focus.
    My problem is as follows: on clicking Ctrl+Shift+M, I am able to see that the next window has focus (the title bar color changes), but when I use the up/down keys to navigate within the newly focussed window, actually the navigation happens in the previous window....
    I have a tree view at the left, and two views at the right, and going from the tree view to any of the right views sometimes works correctly, sometimes doesn't (in fact i believe this happens every alternate time I shift to the non-tree view). Here, I have tables in the right views, and I try to select different rows using up/down keys once the right view has the focus, but the navigation occurs in the Tree view, with previous/next node getting selected instead!
    The funniest part is, the problem isn't there if the shortcut defined is 'F6', but for any other shortcut (F12, F11, Ctrl+M, Ctrl+Shift+M, Ctrl+K, CTrl+Shift+K etc.) this problem is seen.
    Does anyone have ANY idea why this happens? I tried to look up the bugs DB, but couldn't find anything specific to this...
    Sample Code:
    JMenuItem oCycWin = new JMenuItem("Cycle Windows");
    oCycWin.setMnemonic('C');
    oCycWin.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, ActionEvent.CTRL_MASK | ActionEvent.SHIFT_MASK, true));
    //oCycWin.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F6, 0, true));
    oCycWin.addActionListener(new ActionListener()
       public void actionPerformed(ActionEvent e)
          /* oCurWin is a JInternalFrame object (extended class) that tracks the
             current focussed window
          if(oCurWin.ID == 1)
            oCurWin.ID = 2;
          else if(oCurWin.ID == 2)
            oCurWin.ID = 3;
          else
            oCurWin.ID = 1;
          oCurWin.setVisible(true);
          try
         oCurWin.setSelected(true);
          catch(java.beans.PropertyVetoException e)
         System.out.println("Can select oCurWin");
    });This code works fine for accelerator set as F6, and when we shift to the tree view. But sometimes on shifting focus to any of the right views, with accelerator not F6, although the right view appears to be focussed due to change in title bar color, the navigation continues in the tree view.
    Thanks...
    Shefali

    Hi,
    have you tried requesting the focus on your newly selected internal frame ?

  • JInternalFrame - print cut off

    Hi there,
    I have tried to print out the JInternalFrame's content by overriding the print() mentod.
    However, it seems only those that shown on screen was printed out, i.e., if I resize the frame to a smaller size, I print out fewer things.
    On top of that, even if I maximize the frame, only half the page is print out (i.e., I got half a blank page which I need to fill).
    Here is my code for printing the frame
    public class JPInternalFrame extends JInternalFrame implements Printable {
       public JPInternalFrame() { }
       public int print(Graphics g, PageFormat pf, int pi) throws PrinterException {
       if (pi >= 1) {
           return Printable.PAGE_EXISTS;
       Graphics2D newG = (Graphics2D) g;
       newG.setClip(0,0,650,850); // reset to a new clip cooedinate
       newG.scale(0.6,0.6);
       Font  f = new Font("Arial",Font.PLAIN,10);
       newG.setFont(f);
       RepaintManager currentManager = RepaintManager.currentManager(this);
       currentManager.setDoubleBufferingEnabled(false);
       super.paintAll(newG);
       currentManager.setDoubleBufferingEnabled(true);
       return Printable.PAGE_EXISTS;
    .and
    public void actionPerformed(ActionEvent e) {
          PrinterJob printJob = PrinterJob.getPrinterJob();\
          printJob.setPrintable(one);
          if (printJob.printDialog())
          try { printJob.print(); } catch (Exception PrintException) { }
    }Thanks for your time.
    Sam

    Hi there,
    I just found out that my JInternal Frame can now print a full page. But this only happens when I open multiple JInternalFrame.
    - If I only open 1 frame, it only print half a page (cut off at the middle);
    - If I open multiple, print any one of them would be a full page;
    - If I open multiple 1st, close them down to 1 frame, it would still print a full page;
    - If I close them all, open 1 frame and print, it would back to half-page-cut-off...
    Would anyone able to give me some direction please?
    Much appericate for any help!
    Cheers
    Sam

  • Multiple JDesktopPane Weirdness

    Sorry if this has already been brought up, but the advanced search features didn't work and I didn't see anything like this in the first couple hundred results that came up for "JInternalFrame".
    Here's what I've got:
    I'm working on an app (Using J2SE 1.4.2_01) that uses a JTabbedPane with two tabs. Each tab contains a JDesktopPane, and each JDesktopPane can have multiple JInternalFrames. I also have a menu that holds an item that gets associated with each JInternalFrame so that the user can select any given jrame quickly. (I use a Hashtable to track these associations). So in the ActionPerformed method - when one of these menuItems is selected it determines which JInternalFrame they want and then calls methods like setIcon(false), and setSelected(true). This is where the weirdness comes in. If I try to select a JInternalFrame that is in the current Desktop (the current Tab) it works fine. But if it first has to switch Tabs (which it does by getting the desktop for the target frame and passing this to the setSelectedComponent() of the JTabbedPane) the JInternalFrame does not get selected. I've done some testing and verified that the program is correctly figuring out which JInternalFrame to select, which Desktop to switch to (which it does), and is calling setSelected() on the right JInternalFrame. But, from watching what happens with a JInternalFrame Event Listener it looks like the frame never gets the message.
    So, any ideas why selecting a JInternalFrame when it's desktop is not showing doesn't work?
    -mekane

    When the JIF is in a non-active JTabbedPane, what you should do in your action listener is to activate the tab, then make the tabbed pane's listener trigger a selection (not too sure if you need to do anything like giving focus to the JDesktopPane because I don't have any idea what you do). Essentially, you must activate a component at a time in the proper sequence.
    ;o)
    V.V.

  • What is a good GUI code

    Hi,
    at time i writing a gui client for my application.
    the problem is that i don't realy know what code for guicode will be better:
    all code (everey button, label, bar etc.) inside one "open" method.
    with this solution i can change the autput (such as text etc.) of Labels and buttons at runtime.
    a another solution is
    that every button label etc gets it own create method.
    with this solution i have small simple methods, but i have to call them in the right order at the open method. I also have to create the buttons labels etc as fields so they can be changed during runtime.
    (with runtime i mean changes of label texts etc. during userinteraction)
    which solution will be better, for a OO Design/Model.
    or is there a better solution you prefer?
    thanks.
    your sincerely Gideon

    Since you are interested in good OO design, I would highly recommend some reading like "Design Patterns Explained" by Alan Shalloway. Some might push you into the GoF (Gang of Four) book but start easy.
    One tenant of good OO is to encapsulate. So, in your GUI, I would recommend the getters and setters for each widget. Yes, this means a field for each widget on your panel. This is also great for maintenance. Nothing worse than scrolling through a huge method trying to figure out what is going on. So start off with getters/setters for each widget. Then have an initialize method (or something like that) that will add everything on your panel. Try to group like behavior/actions together.
    Now, in my applications, I'm using a MDI application. That means my JFrame has JInternalFrames. My JInternalFrames in turn instantiate JPanels. In a couple of cases, I have multiple JInternalFrames calling the same JPanel. And because I like to have standardized behavior, I use mediators to handle enabling/disabling/clearing of fields, etc. But start off small and work your way into some design patterns.
    I hope this helps.

  • Multithreading - Can someone explain this ...

    Hi Java Gurus:
    Can someone explain this to me why my multithreading worked in once case and not in the other.
    First a little background:
    My application lets the user create multiple JInternalFrames. Each frame has an OK button. When the user presses the OK button, the frame goes about it's business in a new thread, thus returning control to the use, so he/she can press the OK button on the second frame .. and so on.
    Following is the event handler for the OK button that creates the new thread:
    case1 - doesn't work:
          btnTranslate.addActionListener(
             new ActionListener() {
                public void actionPerformed( ActionEvent e ) {
                             txtOutput.setText("");
                             txtBadParts.setText("");
                   Translation trans = new Translation(inst);
                   trans.run();
          );case2 - works:
          btnTranslate.addActionListener(
             new ActionListener() {
                public void actionPerformed( ActionEvent e ) {
                             txtOutput.setText("");
                             txtBadParts.setText("");
                       new Translation(inst).start();
          );Thanks,
    Kamran

    Calling the run method makes the run method run in the current thread. You need to call the start method to get the thread to start its own thread.

  • Memory gone CRAZY PLEASE help

    All,
    This another question regarding my app, which has a main frame that contains Tabbedpane and have desktopPane attached inside. Within desktopPane I have multiple JInternalFrame. In each internalframe a textarea is attached for taking user input and displaying server feedback (the textarea has private classes that telnet to the server to do the input and output stuff).
    I was testing my app last night and found out following problems:
    1.) Memory just gone crazy! I opened several internal frames and did "cat *" on each of them just to test it out. I noticed the memory just gone crazy and the app become really slow responding. after I close the internal frames speed start getting better but memory is still not being released.
    2.) I use InputStream.read() to read single byte from input stream. the return is an "int", I first convert it to a "char" and then cast it to a "string" then use the JTextArea.append("string") to append it to the textarea but it displays a little square after I press enter each time.
    I appreciate your time and advise, thank you.

    You can allocate extra memory to a Java program by putting something like
    java -Xmx256m Myclass
    That should tell you if running out of memory is really your problem.
    Memory from abandoned items isn't recovered until the JVM decides to do a "garbage collection" which it doesn't usually bother with until it finds memory a bit tight.
    You shouldn't cast byte input to char. In Java a character is a 16 bit UNICODE code value, and it's relationship with bytes depends on the "character encoding", by default the one native to your operating system.
    If you want to read character input from a file etc. then use a Reader not an InputStream. If necessary you can "wrap" an input stream in an InputStreamReader object.
    If you want to read it from the user in a Swing program then use an input field of some sort.

  • Optimizing Java for speed ...

    I have created a GUI program, that relies heavily on Swing components. I use a JDesktop with multiple JInternalFrames with JToolBars in both the desktop and the frames. Everything is working fine...
    however, loading the application (creating a new instance) takes 35 secs!!
    It's getting quite big (27 classes), but besides loading a couple of images of a (local) webserver, I don't see how it should take this amount of time to set up.
    Any hints on general optimalization techniques? (links? articles?)
    Beforehand thanks to anyone answering!!

    OK, here's some optimization tricks.
    1. Build your dialog boxes (or at least the dialog boxes that you use most often) ahead of time during the splash screen.
    2. Instead of killing your dialog boxes when you close them just use setVisible(false). This keeps them in memory so the next time you want to view that dialog box just do setVisible(true).
    3. Using a Singleton design pattern will help you with both of the above issues.
    public class MyDialog extends JDialog {
       private static MyDialog theOnlyOne = null;
       // The constructor is private.  Build your Dialog box's GUI
       // here.  Because it's private nothing outside this class can call it.
       private MyDialog(){
       public static MyDialog getInstance() {
          if(theOnlyOne == null) {
             theOnlyOne = new MyDialog();
          return theOnlyOne;
    }By looking at this code you can see that instead of creating an instance of MyDialog you instead use the static method getInstance() The first time getInstance is called it will construct the dialog box. The 2nd and all subsequent times getInstance is called it will return the already constructed instance of MyDialog. This will allow you to simply use setVisible with true or false to turn the dialog box on or off. This means you spend the time to construct the dialog box only once.
    Also never mix AWT components (Button, Checkbox, Frame) with Swing components (JButton, JCheckbox, JFrame) Always use Swing. They're "lighter weight" and the look better.
    Another technique is to call the garbage collection explicitly. One of the great things about Java is that it does automatic garbage collection (gc) . The bad thing about that is that the gc runs whenever the JVM decides it needs more memory. If this happens while you're using your app then you get a "hiccup" of slowness.
    So, if you're in a part of the code where you know that immediate reaction isn't important at that moment then you can call the garbage collection manually with System.gc();
    For example, let's say your program just ran a big database query and returned all that data in a JTable. Let's say that you KNOW that when the user runs that process they always take at least a few seconds to look at the data they just retrieved. That may be a good time to run System.gc(); That way, you make the garbage collector run when it doesn't effect the user.
    If you were writing a game then you could run System.gc(); when you load a new level. Essentially, just run it when you know that the user experience won't be effected.
    Once Gui components are constructed I've found that they work pretty darn fast. I use Jext, a programming editor written in Java every single day and the only slowness I've found when using it is when the garbage collector kicks in.
    Hope it helps.
    Greg

  • Program Crashes while multi-threading

    Hi Gurus:
    I am working on a program where I am running multiple JInternalFrames inside a JFrame. Each JInternalFrame starts a new thread (when the OK button is pressed). The thread calls a native (C++) method, which interfaces with another API (CAD).
    Problem is that when I run two frames together, my program crashes. If I wait for one frame to complete the process and then start the second one, everything works fine. I am not sharing any data between the threads. I even put a synchronized access modifier in front of the method that is causing the crash, to no avail. Don't know what else to try. I also ran the program in two different processes with only invoking one frame in each process, and it worked fine.
    The program either crashes with no error message, or sometimes it gives this error:
    -------------- Start of error --------------------------
    Another exception has been detected while we were handling last error.
    Dumping information about last error:
    ERROR REPORT FILE = (N/A)
    PC = 0x22ABDFFD
    SIGNAL = -1073741819
    FUNCTION NAME = (N/A)
    LIBRARY NAME = (N/A)
    Please check ERROR REPORT FILE for further information, if there is any.
    Good bye.
    ----------- End of error -------------------------------
    Any help would be appreciated.
    Regards,
    Kamran

    I also got that error - sometimes.
    Now I get something like this :
    An unexpected exception has been detected in native code outside the VM.
    Unexpected Signal : 11 occurred at PC=0x403bce8e
    Function name=__libc_free
    Library=/lib/libc.so.6
    Dynamic libraries:
    08048000-0804c000 r-xp 00000000 08:01 17180 /usr/java/jdk1.3.1_01/bin/i386/native_threads/java
    0804c000-0804d000 rw-p 00003000 08:01 17180 /usr/java/jdk1.3.1_01/bin/i386/native_threads/java
    40000000-40016000 r-xp 00000000 08:01 446282 /lib/ld-2.2.2.so
    40016000-40017000 rw-p 00015000 08:01 446282 /lib/ld-2.2.2.so
    and so on.
    I got an application which starts 50 threads (sometimes I start 60 or 30, just testing right now).
    Do you've got RedHat? And Kernel 2.4.2-2smp?
    I don't know how I got rid of your error, but now I got that one...
    Anybody who has experiences with that?
    THX,
    Peter

  • Glasspane event handling problem when window is deactivated - activated

    Hello everyone!
    I have a strange problem concerning glasspane used to block user input. The situation is the following:
    I use a JDesktopPane inside a JFrame. In the desktop pane there are placed multiple JInternalFrames. I use a JPanel as glasspane with dummy listeners to block the controls in one of the internal frames. This all works without problems.
    Now if the JFrame becomes inactive (for example the user switches to a browser window) and the I go back to the java application (frame becoming active again), the blocking no longer works. This also happens if a JDialog pops up - so in general this happens if the DesktopPanes host window becomes inactive and active again.
    The glass pane is still there (see it as it is translucent coloured), gets the events (I can see this from debug output in the dummy listeners) but also the controls underneath the glass panes do react now to user input.
    I already tried to watch the JFrame with a WindowListener and reinstall (a new) glass pane when it becomes active again - no effect. Now I am really helpless - maybe there is something very obvious I am doing wrong?
    I appreciate any hint :-) Thank you in advance!

    New problem :-) Also this worked to block the user input, I now get these:
    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
         at javax.swing.plaf.basic.BasicInternalFrameUI$Handler.forwardMouseEvent(BasicInternalFrameUI.java:1375)
         at javax.swing.plaf.basic.BasicInternalFrameUI$Handler.mouseEntered(BasicInternalFrameUI.java:1327)
         at java.awt.Component.processMouseEvent(Component.java:5497)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
         at java.awt.Component.processEvent(Component.java:5253)
         at java.awt.Container.processEvent(Container.java:1966)
         at java.awt.Component.dispatchEventImpl(Component.java:3955)
         at java.awt.Container.dispatchEventImpl(Container.java:2024)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
         at java.awt.LightweightDispatcher.trackMouseEnterExit(Container.java:4017)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3874)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
         at java.awt.Container.dispatchEventImpl(Container.java:2010)
         at java.awt.Window.dispatchEventImpl(Window.java:1774)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    Exceptions when I open another JInternalFrame afterwards and then move the mouse into the first internal frame (whose input was blocked by twith the button on glasspane) area.
    Any ideas?

  • Multiple Order Panels as JInternalFrames in one Form as a JDesktopPane

    I have a JClient application which consists of a form(JFrame) which opens a JDesktopPane. Within this desktop pane the user may open different panels(as JInternalFrames), one of them being a panel to create a new order. I want to have the ability for a user to create multiple order panels for different orders within the same desktop pane/form. The order panel consists of mainly 2 lookup views for customer and item information and 2 editable views for the order header and order details. While I can open multiple order panels, each with a unique binding container (ie. a uniquely named UIModel), within the desktop pane all of the open panels edit the same order. How can I modify my code to allow a user to create/edit multiple order instances using this order panel?

    Hi,
    did you have a look at
    http://www.oracle.com/technology/products/jdev/howtos/10g/jcmultiform/index.html
    the section "Data Binding in a Concurrent-Forms Use Case" describes what you are trying to achieve
    Frank

  • How to add multiple images in jinternalframe

    Hi all,
    how to add multiple images to the jinternalframe, at specified location of the pane and resizing the images with specified height and width.
    code examples are highly appreciated.
    Thanks & Regards,
    Abel

    Thanks, it works perfectly. It's a really smart way of fixing the problem too :)
    I also found your toggle button icon classes which is something I've also had a problem with.
    Thanks.

Maybe you are looking for