java怎么把窗体最小化?类似toBack,tofront的方法
2个回答
2013-11-06
展开全部
// 顺便给出代码
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
public class Test extends JFrame {
private JButton button1 = null;
public Test()
{
super("Frame");
button1 = new JButton("Minimize");
button1.addActionListener( new ActionListener(){
public void actionPerformed(ActionEvent e)
{
setState( Frame.ICONIFIED ); // Minimize main frame.
}
});
this.getContentPane().add(button1);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setSize(120, 60);
this.setVisible(true);
}
public static void main(String[] args) { new Test(); }
}
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
public class Test extends JFrame {
private JButton button1 = null;
public Test()
{
super("Frame");
button1 = new JButton("Minimize");
button1.addActionListener( new ActionListener(){
public void actionPerformed(ActionEvent e)
{
setState( Frame.ICONIFIED ); // Minimize main frame.
}
});
this.getContentPane().add(button1);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setSize(120, 60);
this.setVisible(true);
}
public static void main(String[] args) { new Test(); }
}
2013-11-06
展开全部
最小化的话 setState( Frame.ICONIFIED ); 不就行了吗?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询