1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
import javax.swing.DesktopManager;
import javax.swing.JInternalFrame;
import javax.swing.JComponent;
public class MonDesktopManager implements DesktopManager{
public MonDesktopManager(){
}
public void openFrame(JInternalFrame f){
f.toFront();
f.requestFocus();
}
public void closeFrame(JInternalFrame f){
f.hide();
f.toFront();
f.requestFocus();
}
public void maximizeFrame(JInternalFrame f){
try{
if(f.isIcon())
f.setIcon(false);
f.setMaximum(true);
}catch(Exception e){
}
}
public void minimizeFrame(JInternalFrame f){
try{
if(f.isIcon())
f.setIcon(false);
f.setMaximum(false);
}catch(Exception e){
}
}
public void iconifyFrame(JInternalFrame f){
try{
f.setIcon(true);
}catch(Exception e){
}
}
public void deiconifyFrame(JInternalFrame f){
try{
f.setIcon(false);
}catch(Exception e){
}
}
public void activateFrame(JInternalFrame f){
f.toFront();
f.requestFocus();
}
public void deactivateFrame(JInternalFrame f){
f.toBack();
}
public void beginDraggingFrame(JComponent f){
f.setLocation(f.getLocation());
}
public void dragFrame(JComponent f, int newX, int newY){
f.setLocation(newX,newY);
}
public void endDraggingFrame(JComponent f)
{
f.setLocation(f.getLocation());
}
public void beginResizingFrame(JComponent f, int direction){
f.setSize(f.getSize());
}
public void resizeFrame(JComponent f, int newX, int newY, int newWidth, int newHeight){
f.setBounds(newX,newY,newWidth,newHeight);
}
public void endResizingFrame(JComponent f)
{
f.setSize(f.getSize());
}
public void setBoundsForFrame(JComponent f, int newX, int newY, int newWidth, int newHeight){
f.setBounds(newX,newY,newWidth,newHeight);
}
} |
Partager