关于JButton的问题 在actionPerformed()中加上b=new Frame();b.show();a.setVisible(false);a=null;a.dispose(); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 //********************************************************************************//* 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>±£´æ</font>","<html><font size=3>²»±£´æ</font>","<html><font size=3>È¡Ïû</font>"}; JLabel saveJlabel = new JLabel("±£´æ¸Ä±äµ½ "+jIF.getTitle() + " £¿"); 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就可以了 看错你的题目了,那就很好做了DefaultDesktopManager desktopManager = new DefaultDesktopManager ();在button的监听器中加入desktopManager.closeFrame(interFramea);interFrameb.setSelected(true); java中如何根据容器中的对象的某个属性重新存放在另一个容器中 一道不会的编程题 不显示删除回复显示所有回复显示星级回复显示得分回复 求计算机操作系统(修订版)(汤子瀛)的电子书 java的输出格式问题,请人帮忙回答 求java手机书籍制作工具的原代码. 急!!!帮帮我吧! 急? 同步选择 jbuilderX中发现一个Bug,大家看看怎样解决! 我对子类重载/覆盖父类方法的理解,请大家看对不对? Java编程中的鼠标问题! 请问,如何用一个存在的文件a初始化一个新建文件b,需要调用什么方法?
//* 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>±£´æ</font>","<html><font size=3>²»±£´æ</font>","<html><font size=3>È¡Ïû</font>"};
JLabel saveJlabel = new JLabel("±£´æ¸Ä±äµ½ "+jIF.getTitle() + " £¿");
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就可以了
DefaultDesktopManager desktopManager = new DefaultDesktopManager ();
在button的监听器中加入
desktopManager.closeFrame(interFramea);
interFrameb.setSelected(true);