• Post Reply Bookmark Topic Watch Topic
  • New Topic

JInternal Frame wont Iconify  RSS feed

 
Brian Mozhdehi
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have an application that uses JFrame and JInternalFrames. When I use JRE 1.5, the JINternalFrame iconify using the code I have when the icon selection is made on the window. In 1.6 it does not work and I cannot determine what has changed.

Below is a new application I wrote with condensed code that illustrates the issue

Here is the FRAME

package com.orion.client;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class MainClass extends JFrame
{
public MainClass()
{
this.addWindowListener(new WindowAdapter()
{public void windowClosing(WindowEvent e){System.exit(0);}});

try{UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());}
catch(Exception e){}

JPanel mainPanel = new JPanel();
mainPanel.setBackground(Color.white);
mainPanel.setPreferredSize(new Dimension(800, 600));
mainPanel.setBorder(BorderFactory.createEtchedBorder());

getContentPane().add(mainPanel);

pack();
setVisible(true);

getLayeredPane().add(new TestInternalFrame());
}

public static void main(String[] args)
{
new MainClass();
}
}


Here is the JINTERNALFRAME

package com.orion.client;

import javax.swing.*;
import java.awt.*;

public class TestInternalFrame extends JInternalFrame
{
public TestInternalFrame()
{
super();

setAutoscrolls(true);
setResizable(true);
setMaximizable(true);
setClosable(true);
setIconifiable(true);

JLabel aLabel = new JLabel("This is a Test Screen");
JPanel aPanel = new JPanel();
aPanel.setPreferredSize(new Dimension(200, 200));
aPanel.add(aLabel);

this.getContentPane().add(aPanel);

pack();
setVisible(true);
}
}

and attached is a screen shot of the result. I attempt to iconify the internal frame and the _ converts to two overlapped boxes and the screen doesnt iconify




Picture.JPG
[Thumbnail for Picture.JPG]
Screen Shot of Issue
 
Rob Camick
Ranch Hand
Posts: 2801
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After almost 80 postings you should know how to use the "Code" tags by now!

I don't see where you use a JDesktopPane, but I didn't pay much attention to the unformatted code. Why don't you start by reading the JInternalFrame API where you will find a link to the Swing tutorial on "How to Use Internal Frames".
 
Brian Mozhdehi
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi - sorry, I haven't asked that many questions, mostly answered them. I will pay attention to the code tags. In the meantime - I dont think this is a tutorial level issue, its really whats different between 1.5 and 1.6. So - thank you for your answer, I appreciate your time. But anyone else reading that is willing to tolerate my error on the code tags - any help would be appreciated. Thanks much.
 
Brian Mozhdehi
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
actually, you have me on to something - thanks again
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!