Results 1 to 5 of 5
- 06-19-2008, 02:02 PM #1
- 06-19-2008, 11:39 PM #2
Check the DesktopManager interface.
- 06-20-2008, 06:52 AM #3
Hi Hardwired,
thanks for your reply.
i checked the DestopManager interface but i haven't find any method to lock the drag mode of JinternalFrame..
- 06-20-2008, 06:15 PM #4
Hi
check the following code...
it may help u out..
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.plaf.basic.*;
public class InternalFrameUnMovable extends JFrame
{
JDesktopPane desktop;
public InternalFrameUnMovable()
{
desktop = new JDesktopPane();
getContentPane().add( desktop );
desktop.add( createInternalFrame(1, Color.RED) );
desktop.add( createInternalFrame(2, Color.GREEN) );
desktop.add( createInternalFrame(3, Color.BLUE) );
}
private JInternalFrame createInternalFrame(int number, Color background)
{
JInternalFrame internal =
new JInternalFrame( "Frame" + number, true, true, true, true );
internal.setBackground( background );
internal.setVisible( true );
int location = 50 * number;
internal.setBounds(location, location, 300, 300);
return internal;
}
public static void main(String args[])
{
InternalFrameUnMovable frame = new InternalFrameUnMovable();
frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
frame.setSize(600, 600);
frame.setLocationRelativeTo( null );
frame.setVisible(true);
// Activate first internal frame
try
{
JInternalFrame[] frames = frame.desktop.getAllFrames();
frames[0].setSelected(true);
}
catch (java.beans.PropertyVetoException e) {}
// Make first internal frame unmovable
JInternalFrame[] frames = frame.desktop.getAllFrames();
JInternalFrame f = frames[0];
BasicInternalFrameUI ui = (BasicInternalFrameUI)f.getUI();
Component north = ui.getNorthPane();
MouseMotionListener[] actions =
(MouseMotionListener[])north.getListeners(MouseMotionListener.class);
for (int i = 0; i < actions.length; i++)
north.removeMouseMotionListener( actions[i] );
}
}To finish sooner, take your own time....
Nivedithaaaa
- 06-23-2008, 07:21 AM #5
Similar Threads
-
Disable Radio button
By AJG in forum New To JavaReplies: 3Last Post: 05-10-2011, 11:09 AM -
Drag and drop
By abhivenugopal in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 01-30-2008, 02:10 PM -
disable parent window
By ismailsaleh in forum AWT / SwingReplies: 1Last Post: 01-07-2008, 11:15 PM -
Disable BACK and CANCEL buttons in wizard
By consutes in forum SWT / JFaceReplies: 2Last Post: 11-12-2007, 09:37 PM -
Is it possible to disable drop in a component?
By Ada in forum AWT / SwingReplies: 3Last Post: 06-07-2007, 05:52 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks