jinternal frame
hola, he estado buscando en la api de java haber si existe algun metodo para que un jinternalframe no se pueda mover pinchando con el raton sobre el y no encontre nada, alguien me podria decir si existe algun metodo que lo haga, gracias.
Quieres hacer un jinternalframe que no se mueva? no es mas facil un jpanel?
Hola, aqui tienes un codigo con un internal frame que no se mueve
import javax.swing.*;
import javax.swing.plaf.metal.*;
public class noMoveJinternalframe {
public static void main(String[] args) {
JFrame f = new JFrame("No move internal frame -- by T55555");
JInternalFrame ff = new JInternalFrame("No move", true, true, true, true);//
ff.setSize(200, 100);
ff.setLocation(50, 50);
ff.setVisible(true);
ff.setUI(new MetalInternalFrameUI(ff) {
private JComponent titlePane;
protected JComponent createNorthPane(JInternalFrame f) {
titlePane = super.createNorthPane(f);
return titlePane;
}
public void installUI(JComponent c) {
super.installUI(c);
titlePane.removeMouseMotionListener(titlePane.getMouseMotionListeners()[0]);
}
});
JDesktopPane pane = new JDesktopPane();
pane.add(ff);
f.setContentPane(pane);
f.setSize(300, 250);
f.setLocationRelativeTo(null);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
}
}
la clave esta en
ff.setUI(new MetalInternalFrameUI(ff)
Saludos!!
corporative solitions.
import javax.swing.*;
import javax.swing.plaf.metal.*;
public class noMoveJinternalframe {
public static void main(String[] args) {
JFrame f = new JFrame("No move internal frame -- by T55555");
JInternalFrame ff = new JInternalFrame("No move", true, true, true, true);//
ff.setSize(200, 100);
ff.setLocation(50, 50);
ff.setVisible(true);
ff.setUI(new MetalInternalFrameUI(ff) {
private JComponent titlePane;
protected JComponent createNorthPane(JInternalFrame f) {
titlePane = super.createNorthPane(f);
return titlePane;
}
public void installUI(JComponent c) {
super.installUI(c);
titlePane.removeMouseMotionListener(titlePane.getMouseMotionListeners()[0]);
}
});
JDesktopPane pane = new JDesktopPane();
pane.add(ff);
f.setContentPane(pane);
f.setSize(300, 250);
f.setLocationRelativeTo(null);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
}
}
la clave esta en
ff.setUI(new MetalInternalFrameUI(ff)
Saludos!!
corporative solitions.
