logo       

RE: Making a ULCinternalFrame Unmovable: msg#00150

java.ulc.devel

Subject: RE: Making a ULCinternalFrame Unmovable

Hi Eugene,

You will need to extend ULCInternalFrame as shown in the snippet below.

You have been quite active on the ULC developer list and we have provided
extensive free support to you.

May we request you to buy ULC support?

Thanks and regards,

Janak

-----Original Message-----
From: ulc-developer-admin@xxxxxxxxxxxxxxx
[mailto:ulc-developer-admin@xxxxxxxxxxxxxxx]On Behalf Of Eugene Coelho
Sent: Saturday, July 22, 2006 8:48 AM
To: UlC Devleoper list
Subject: [ULC-developer] Making a ULCinternalFrame Unmovable


Hi,

I have a requirement which requires one internal frame which should be
immovable and a small frame that can be placed any where over this
frame.
For some reasons i dont want dialogs but use only internal Frames.

I found a solution for swing that says remove all the mouse listeners
over the internal frame so that it canoot be moved, Can this be
achieved with ULC.


Thanks,
Eugene
--------------------------


import com.ulcjava.base.application.AbstractApplication;
import com.ulcjava.base.application.ULCDesktopPane;
import com.ulcjava.base.application.ULCFrame;
import com.ulcjava.base.application.ULCInternalFrame;
import com.ulcjava.base.client.UIInternalFrame;
import com.ulcjava.base.development.DevelopmentRunner;

import javax.swing.plaf.basic.BasicInternalFrameUI;

import java.awt.Component;
import java.awt.event.MouseMotionListener;

public class ULCInternalFrameNoMoveSnippet extends AbstractApplication {

public void start() {
ULCDesktopPane deskTop = new ULCDesktopPane();

ULCNonMovableInternalFrame intFrame = new
ULCNonMovableInternalFrame();
intFrame.setBounds(20, 20, 250, 250);

intFrame.setVisible(true);

deskTop.add(intFrame);

// show window
ULCFrame window = new ULCFrame("ULCInternalFrameNoMoveSnippet");
window.setContentPane(deskTop);
window.setSize(350, 350);
window.setLocation(200, 200);
window.setDefaultCloseOperation(ULCFrame.DISPOSE_ON_CLOSE);
window.setVisible(true);

}

public static void main(String[] args) {
DevelopmentRunner.setApplicationClass(ULCInternalFrameNoMoveSnippet.
class);
DevelopmentRunner.run();
}

public static class ULCNonMovableInternalFrame extends ULCInternalFrame
{
protected String typeString() {
return UINonMovableInternalFrame.class.getName();
}

}

public static class UINonMovableInternalFrame extends UIInternalFrame {
protected void postInitializeState() {
super.postInitializeState();
BasicInternalFrameUI ui =
(BasicInternalFrameUI)getBasicInternalFrame().getUI();

Component north = ui.getNorthPane();
MouseMotionListener[] actions =
(MouseMotionListener[])north.getListeners(MouseMotionListener.class);

for (int i = 0; i < actions.length; i++) {
north.removeMouseMotionListener(actions[i]);
}
}
}
}


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise