-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.2.0
-
x86
-
windows_nt
Name: diC59631 Date: 09/22/98
use InternalFrame in JSplitePanel right-top arear
| |
| This arear |
| |
--------------------|
--------------------|
if you maximize the internalFrame, then resize
the Splite panel. the display is wrong.
the example code in this,please resize first
when programe start.
//==============================================
//XXX: Metalworks is the only desktop-using app I looked at. This follows
//XXX: its lead. How will these desktop apps usually be arranged? Really
//XXX: a menu at the top of the main JFrame?
//XXX: You might think of using a JWindow to house the JDesktopPane, but
//XXX: JWindows behave badly. They *always* stay in front. And you can't
//XXX: miniaturize them.
import com.sun.java.swing.JInternalFrame;
import com.sun.java.swing.JDesktopPane;
import com.sun.java.swing.JMenu;
import com.sun.java.swing.JMenuItem;
import com.sun.java.swing.JMenuBar;
import com.sun.java.swing.JFrame;
import com.sun.java.swing.JSplitPane;
import com.sun.java.swing.JPanel;
import java.awt.event.*;
import java.awt.*;
public class InternalFrameDemo extends JFrame {
JDesktopPane desktop;
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);
//Quit this app when the big window closes.
addWindowListener(new WindowAdapter() {
//XXX: Notes for Kathy.
//XXX: common problem: windowClosing or other event method ignored.
//XXX: did you add it as a listener? Did you define the method right,
//XXX: E.g., is it public void, spelled right, and have the right kind
//XXX: of argument (issue for adapter subclasses).
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
//Set up the GUI.
desktop = new JDesktopPane(); //a specialized layered pane
createFrame(); //Create first window
setContentPane(new JSplitPane(JSplitPane.VERTICAL_SPLIT,new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JPanel(), desktop), new JPanel()));
setJMenuBar(createMenuBar());
}
protected JMenuBar createMenuBar() {
JMenuBar menuBar = new JMenuBar();
JMenu menu = new JMenu("Document");
JMenuItem menuItem = new JMenuItem("New");
menuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
createFrame();
}
});
menu.add(menuItem);
menuBar.add(menu);
return menuBar;
}
protected void createFrame() {
MyInternalFrame frame = new MyInternalFrame();
desktop.add(frame);
try {
frame.setSelected(true);
} catch (java.beans.PropertyVetoException e2) {}
}
public static void main(String[] args) {
InternalFrameDemo frame = new InternalFrameDemo();
frame.show();
}
}
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);
}
}
(Review ID: 39190)
======================================================================
- duplicates
-
JDK-4176733 REGRESSION: JDesktopPane setVisible(true) need before adding JInternalFrames
-
- Resolved
-