在actionPerformed()中加上
b=new Frame();
b.show();
a.setVisible(false);
a=null;
a.dispose();

解决方案 »

  1.   

    //********************************************************************************
    //* UI²¿·Ö*
    //********************************************************************************
    /**
     * MyInternalFrameTitlePane
     */
    class MyInternalFrameTitlePane extends BasicInternalFrameTitlePane {
    JInter jIF = null;
    public MyInternalFrameTitlePane(JInternalFrame f) {
    super(f);
    jIF = (JInter)f;
    }
    protected void createActions() {
    maximizeAction = new MaximizeAction();
    iconifyAction = new IconifyAction();
    closeAction = new CloseAction();
    restoreAction = new RestoreAction();
    moveAction = new MoveAction();
    sizeAction = new SizeAction();
    } public class MaximizeAction extends AbstractAction {
    public MaximizeAction() {
    super(MAXIMIZE_CMD);
    } public void actionPerformed(ActionEvent se) {
    JDesktopPane desktop = jIF.getDesk();
    JInternalFrame[] it =desktop.getAllFrames();
    for (int i = 0 ; i < it.length ;i++ ){
    try{
    it[i].setMaximum(true);
    }catch(Exception e){}
    it[i].setUI(new MyInternalFrameUI(jIF));
    }
    try{
    jIF.setSelected(true);

    jIF.getJFrame().makeOperation();
    }catch(Exception ef){}
    jIF.setUI(new MyInternalFrameUI(jIF));
    }
    }  public class CloseAction extends AbstractAction {
    public CloseAction() {
    super(CLOSE_CMD);
    } public void actionPerformed(ActionEvent se) {
    if (!jIF.getJFrame().getIsSaved()){
    String[] d = new String[]{"<html><font size=3>±&pound;&acute;&aelig;</font>","<html><font size=3>&sup2;&raquo;±&pound;&acute;&aelig;</font>","<html><font size=3>&Egrave;&iexcl;&Iuml;&ucirc;</font>"};
    JLabel saveJlabel = new JLabel("±&pound;&acute;&aelig;&cedil;&Auml;±&auml;&micro;&frac12; "+jIF.getTitle() + " &pound;&iquest;");
    int result = JOptionPane.showOptionDialog(jIF.getJFrame(),
    saveJlabel,
    "EditBoy",
    JOptionPane.DEFAULT_OPTION,                 // option type 
    JOptionPane.INFORMATION_MESSAGE,            // message type 
    new ImageIcon("image/saveJOption.gif"),
    d,
    d[0]
    );
    switch(result){
    case 0:
    jIF.getJFrame().setSaveing();
    closeOperation();
    break;
    case 1:
    closeOperation();
    break;
    case 2:
    break;
    default:
    break;
    }
    }else{
    closeOperation();
    }
    }
    } public void closeOperation(){
    JPanel panel = jIF.getPanel();
    ButtonGroup bg = jIF.getButtonGroup();
    JToggleButton jtb = jIF.getToggleButton();
    JSeparator h = jIF.getJSeparator();
    try{
    jIF.setClosed(true);
    jIF.dispose();
    }catch(Exception e){} if (jIF.getJFrame().getJInternalFrame() == null){
    jIF.getJFrame().setTitle("EditBoy");
    jIF.getJFrame().setJMenuItemEdit(false);
    }else{
    String title = jIF.getJFrame().getJInternalFrame().getTitle();
    jIF.getJFrame().setTitle("EditBoy - [ " + title + " ]");
    } bg.remove(jtb);
    panel.remove(jtb);
    panel.remove(h);
    panel.validate();
    panel.repaint();
    }
    }/**
     * MyInternalFrameUI
     */
     class MyInternalFrameUI extends BasicInternalFrameUI { public MyInternalFrameUI(JInternalFrame f) {
    super(f);
    }
    protected JComponent createNorthPane(JInternalFrame jif) {
    jif.setBackground(Color.white);
    jif.setBorder(BorderFactory.createEmptyBorder()); 
    jif.setFrameIcon(new ImageIcon("image/editboy.gif"));
    return null;
    }
    }/**
     * YourInternalFrameUI
     */
     class YourInternalFrameUI extends BasicInternalFrameUI { public YourInternalFrameUI(JInternalFrame f) {
    super(f);
    }
    protected JComponent createNorthPane(JInternalFrame jif) {
    titlePane = new MyInternalFrameTitlePane(jif);
    jif.setBackground(Color.white);
    try{
    jif.setMaximum(false);
    }catch(Exception e){}
    return titlePane;
    }
    }
    我写的很乱,你可以看看,用的时候setUI(..),不用了uninstallUI或者updateUI就可以了
      

  2.   

    看错你的题目了,那就很好做了
    DefaultDesktopManager desktopManager = new DefaultDesktopManager ();
    在button的监听器中加入
    desktopManager.closeFrame(interFramea);
    interFrameb.setSelected(true);