Problem regarding internal frame.
Hi,
I am having some problem regarding internal frame.
1) In our application internal frame is shown when menu item is clicked.
My problem is that i want to disable menu when i click on menu item and
show internal frame.When internal frame disposes menu should enabled
again.
2)I want to fix position of internal frame to screen center.Internal frame should
not be movable.
Please reply soon.
Thanks.
1) You need to use InternalFrameListener - the best way to do this would be to use a manager object or to replace your ActionListener with an Action which is also a listener; or a combination of the two.
2) There are various ways to do this - the best is probably to override the createBorderListener() method in BasicInternalFrameUI by extending whatever frame UI you're using; the other is by hammering some sort of MouseListerner or ComponentListener onto the frame to steamroller the resizing. I'd have to question, though, whether a JInternalFrame is really the right component to use for a component that can't be moved... there's probably a better way of doing what it is you're trying to do, so take a step back and think about it.
You can set up a ComponentListener for componentMoved just setLocation or something like that. Works for me.
public class blah extends JInternalFrame implements ComponentListener {
...
public void componentMoved(ComponentEvent arg0) {
setLocation(<insert old Demension>);
}
...
Sorry it took me a while I just found this when trying to find a solution myself.
The latest 3.1dev drop of Substance look-and-feel allows you to set the SubstanceLookAndFeel.PERMANENTLY_PINNED client property on the JInternalFrame. If you set it to Boolean.TRUE, the relevant frame would be "pinned" - you can't move it or resize it.