importjava.awt.*;importjavax.swing.*;@SuppressWarnings("serial")publicclassIFTHENextendsJFrame{publicIFTHEN(){JPanelp1=newJPanel();p1.setLayout(newGridLayout(1,3));//菜单...
import java.awt.*;
import javax.swing.*;
@SuppressWarnings("serial")
public class IFTHEN extends JFrame{
public IFTHEN(){
JPanel p1=new JPanel();
p1.setLayout(new GridLayout(1,3));//菜单栏,一行三列;
p1.add(new JButton("Task"));
p1.add(new JButton("Control"));
p1.add(new JButton("Help"));
/*
*
*
*p1为菜单栏;
*p2为菜单栏下面的内容;
*/
JPanel p2=new JPanel(new BorderLayout());
p2.add(new JTextField("选择需要进行的任务:"),BorderLayout.WEST);
p2.add(new JTextField("IFTTT单机版"),BorderLayout.NORTH);
p2.add(new JTextField("---->"),BorderLayout.CENTER);
JPanel p3=new JPanel();
p3.setLayout(new GridLayout(1,2));//菜单栏,一行二列;
p3.add(new JButton("Task1"));
p3.add(new JButton("Task2"));
p2.add(p3,BorderLayout.EAST);
JPanel p4=new JPanel(new BorderLayout());
p4.add(new JTextField("正在进行的任务描述:"),BorderLayout.NORTH);
p4.add(new JTextField("当前任务的详细描述... ..."),BorderLayout.CENTER);
p2.add(p4,BorderLayout.SOUTH);
JPanel p5=new JPanel(new BorderLayout());
p5.add(new JTextField("输出信息:"),BorderLayout.WEST);
p5.add(new JTextField(10),BorderLayout.SOUTH);
JPanel p6=new JPanel(new BorderLayout());
p6.add(new JTextField("使用说明:新建任务->点击控制键开始任务->查看任务描述!"),BorderLayout.EAST);
p6.add(p1,BorderLayout.NORTH);
p6.add(p2,BorderLayout.WEST);
p6.add(p5,BorderLayout.SOUTH);
p6.add(new JTextField("!!"),BorderLayout.CENTER);
}
public static void main(String[] args){
IFTHEN frame=new IFTHEN();
frame.setTitle("java lab2");
frame.setSize(800,600);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
展开