Vote count:
0
i finished from adding the JInternalFrame
inside my JFrame
and the way frame is added is to click over the JMenuItem
icon and this is goes fine but when ever the frame is added the old component are removed and white color shows up. what i am trying to do is to set fix JInternalFrame
location with the other component with out effect other component
the code for JInternalFrame
package animeaidvlcj;
import javax.swing.JInternalFrame;
/* Used by InternalFrameDemo.java. */
public class MyInternalFrame extends JInternalFrame {
static int openFrameCount = 0;
static final int xOffset = 0, yOffset = 25;
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);
}
}
the Action code
Action newAction = new AbstractAction("New", newIcon) {
@Override
public void actionPerformed(ActionEvent e) {
desktop = new JDesktopPane();
createFrame();
setContentPane(desktop);
desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
}
};
create method
protected void createFrame() {
MyInternalFrame frame = new MyInternalFrame();
frame.setVisible(true); //necessary as of 1.3
desktop.add(frame);
try {
frame.setSelected(true);
} catch (java.beans.PropertyVetoException e) {}
}
asked 1 min ago
Aucun commentaire:
Enregistrer un commentaire