|
|
@ -11,6 +11,9 @@ import java.io.*;
|
|
|
|
public class MainWindow extends menu {
|
|
|
|
public class MainWindow extends menu {
|
|
|
|
public static JFrame page = new JFrame("主菜单");
|
|
|
|
public static JFrame page = new JFrame("主菜单");
|
|
|
|
public static JFrame create_page = new JFrame("创建");
|
|
|
|
public static JFrame create_page = new JFrame("创建");
|
|
|
|
|
|
|
|
private static Container c = new Container();
|
|
|
|
|
|
|
|
private static Container c1 = new Container();
|
|
|
|
|
|
|
|
private static int flag = 0;
|
|
|
|
//创建主窗口
|
|
|
|
//创建主窗口
|
|
|
|
public static void main(String[] args) {
|
|
|
|
public static void main(String[] args) {
|
|
|
|
page.setSize(1500,1000);
|
|
|
|
page.setSize(1500,1000);
|
|
|
@ -18,25 +21,29 @@ public class MainWindow extends menu {
|
|
|
|
page.setResizable(false);
|
|
|
|
page.setResizable(false);
|
|
|
|
page.setLocationRelativeTo(null);
|
|
|
|
page.setLocationRelativeTo(null);
|
|
|
|
page.setVisible(true);
|
|
|
|
page.setVisible(true);
|
|
|
|
|
|
|
|
c.setLayout(new GridLayout(2,1,50,0));
|
|
|
|
|
|
|
|
page.add(c);
|
|
|
|
new_create();
|
|
|
|
new_create();
|
|
|
|
open();
|
|
|
|
open();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public static void setCreate_page(){
|
|
|
|
public static void setCreate_page(){
|
|
|
|
create_page.setSize(1500,1000);
|
|
|
|
create_page.setSize(400,200);
|
|
|
|
create_page.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
|
|
|
create_page.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
|
|
|
create_page.setResizable(false);
|
|
|
|
create_page.setResizable(false);
|
|
|
|
create_page.setLocationRelativeTo(null);
|
|
|
|
create_page.setLocationRelativeTo(null);
|
|
|
|
create_page.setVisible(true);
|
|
|
|
create_page.setVisible(true);
|
|
|
|
setFileName();
|
|
|
|
c1.setLayout(new GridLayout(3,1,20,20));
|
|
|
|
create();
|
|
|
|
create_page.add(c1);
|
|
|
|
cancle();
|
|
|
|
if(flag == 0){
|
|
|
|
|
|
|
|
setFileName();
|
|
|
|
|
|
|
|
create();
|
|
|
|
|
|
|
|
cancle();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//创建新的创作
|
|
|
|
//创建新的创作
|
|
|
|
public static void new_create() {
|
|
|
|
public static void new_create() {
|
|
|
|
JButton b = new JButton("创建");
|
|
|
|
JButton b = new JButton("创建");
|
|
|
|
b.setBounds(625, 300, 250, 50);
|
|
|
|
b.setBounds(625, 300, 250, 50);
|
|
|
|
Container c = page.getContentPane();
|
|
|
|
|
|
|
|
c.setLayout(new FlowLayout());
|
|
|
|
|
|
|
|
c.add(b);
|
|
|
|
c.add(b);
|
|
|
|
b.setDefaultCapable(true);
|
|
|
|
b.setDefaultCapable(true);
|
|
|
|
b.setVisible(true);
|
|
|
|
b.setVisible(true);
|
|
|
@ -51,8 +58,6 @@ public class MainWindow extends menu {
|
|
|
|
public static void open(){
|
|
|
|
public static void open(){
|
|
|
|
JButton b = new JButton("打开");
|
|
|
|
JButton b = new JButton("打开");
|
|
|
|
b.setBounds(625,400,250,50);
|
|
|
|
b.setBounds(625,400,250,50);
|
|
|
|
Container c = page.getContentPane();
|
|
|
|
|
|
|
|
c.setLayout(new FlowLayout());
|
|
|
|
|
|
|
|
c.add(b);
|
|
|
|
c.add(b);
|
|
|
|
b.setDefaultCapable(true);
|
|
|
|
b.setDefaultCapable(true);
|
|
|
|
b.setVisible(true);
|
|
|
|
b.setVisible(true);
|
|
|
@ -66,10 +71,8 @@ public class MainWindow extends menu {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public static void create(){
|
|
|
|
public static void create(){
|
|
|
|
JButton b = new JButton("创建");
|
|
|
|
JButton b = new JButton("创建");
|
|
|
|
b.setBounds(625,300,250,50);
|
|
|
|
b.setSize(50,10);
|
|
|
|
Container c = create_page.getContentPane();
|
|
|
|
c1.add(b);
|
|
|
|
c.setLayout(new FlowLayout());
|
|
|
|
|
|
|
|
c.add(b);
|
|
|
|
|
|
|
|
b.setDefaultCapable(true);
|
|
|
|
b.setDefaultCapable(true);
|
|
|
|
b.setVisible(true);
|
|
|
|
b.setVisible(true);
|
|
|
|
b.addActionListener(new AbstractAction() {
|
|
|
|
b.addActionListener(new AbstractAction() {
|
|
|
@ -89,25 +92,21 @@ public class MainWindow extends menu {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public static void setFileName(){
|
|
|
|
public static void setFileName(){
|
|
|
|
JTextField fileName = new JTextField();
|
|
|
|
JTextField fileName = new JTextField();
|
|
|
|
fileName.setBounds(625,200,250,50);
|
|
|
|
fileName.setSize(10,10);
|
|
|
|
Container c = create_page.getContentPane();
|
|
|
|
c1.add(fileName);
|
|
|
|
c.setLayout(new FlowLayout());
|
|
|
|
|
|
|
|
c.add(fileName);
|
|
|
|
|
|
|
|
fileName.setVisible(true);
|
|
|
|
fileName.setVisible(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public static void cancle(){
|
|
|
|
public static void cancle(){
|
|
|
|
JButton b = new JButton("取消");
|
|
|
|
JButton b = new JButton("取消");
|
|
|
|
b.setBounds(625, 400, 250, 50);
|
|
|
|
b.setSize(50,10);
|
|
|
|
Container c = create_page.getContentPane();
|
|
|
|
c1.add(b);
|
|
|
|
c.setLayout(new FlowLayout());
|
|
|
|
|
|
|
|
c.add(b);
|
|
|
|
|
|
|
|
b.setDefaultCapable(true);
|
|
|
|
b.setDefaultCapable(true);
|
|
|
|
b.setVisible(true);
|
|
|
|
b.setVisible(true);
|
|
|
|
b.addActionListener(new AbstractAction() {
|
|
|
|
b.addActionListener(new AbstractAction() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
create_page.removeAll();
|
|
|
|
|
|
|
|
create_page.setVisible(false);
|
|
|
|
create_page.setVisible(false);
|
|
|
|
|
|
|
|
flag++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|