解决方案 »
- java的基础问题
- JAVA初学者,import 的实现机制
- 写一个ftp下载,用到了enterprisedt的包,对于正在上传的文件怎么判断
- JTable如何使各列大小不能调整,即固定各列宽度
- 删除树组中的某个值
- 使用Java Communications API访问串口程序,在有些计算机上运行正常,有些抛出javax.comm.NoSuchPortException
- 一段非常简单的java程序,请各位帮忙看一下有什么问题?
- 客户机如何访问服务器?
- 为什么我把构造函数私有化之后就不能创建对象了
- URL类的难题,求大家帮帮小弟!急急急!!!
- java可以实现监听文件夹内的文件变动吗
- 关于封装类的问题
dm.maximizeFrame(iframe);
import java.awt.*;
import java.awt.event.*;public class Example {
public static void main(final String[] args) {
java.awt.EventQueue.invokeLater(new Runnable(){
public void run(){
final JFrame frame = new JFrame("Example");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final JDesktopPane desktop = new JDesktopPane(); for(int i = 0; i<10; ++i){
JInternalFrame window = new JInternalFrame("Window " + i, true,true,true,true);
window.setPreferredSize(new Dimension(600,400));
JPanel panel = new JPanel(new BorderLayout());
panel.add(new JScrollPane(new JTextArea()));
window.setContentPane(panel);
window.pack();
window.setVisible(true);
desktop.add(window);
}
Action allIcon = new AbstractAction("图标化所有窗口"){
public void actionPerformed(ActionEvent e){
for(JInternalFrame window:desktop.getAllFrames()){
desktop.getDesktopManager().iconifyFrame(window);
}
}
};
JMenuBar menubar = new JMenuBar();
JMenu windowMenu = new JMenu("Window");
windowMenu.add(allIcon);
menubar.add(windowMenu); frame.setJMenuBar(menubar);
frame.getContentPane().add(desktop);
frame.setPreferredSize(new Dimension(800,600));
frame.pack();
frame.setVisible(true); java.awt.EventQueue.invokeLater(new Runnable(){
public void run(){
for(JInternalFrame f:desktop.getAllFrames()){
desktop.getDesktopManager().maximizeFrame(f);
}
}
});
}
});
}
}