|
|
|
@ -27,77 +27,88 @@ public class MainWindow extends menu {
|
|
|
|
|
create_page.setResizable(false);
|
|
|
|
|
create_page.setLocationRelativeTo(null);
|
|
|
|
|
create_page.setVisible(true);
|
|
|
|
|
JTextField fileName = new JTextField();
|
|
|
|
|
fileName.setSize(100,50);
|
|
|
|
|
Container c = create_page.getContentPane();
|
|
|
|
|
c.setLayout(new FlowLayout());
|
|
|
|
|
c.add(fileName);
|
|
|
|
|
setFileName();
|
|
|
|
|
create();
|
|
|
|
|
cancle();
|
|
|
|
|
}
|
|
|
|
|
//创建新的创作
|
|
|
|
|
public static void new_create() {
|
|
|
|
|
JButton b = new JButton("创建");
|
|
|
|
|
b.setBounds(625, 300, 250, 50);
|
|
|
|
|
Container c = page.getContentPane();
|
|
|
|
|
c.setLayout(new FlowLayout());
|
|
|
|
|
c.add(b);
|
|
|
|
|
b.setDefaultCapable(true);
|
|
|
|
|
b.setVisible(true);
|
|
|
|
|
//鼠标触发事件
|
|
|
|
|
b.addActionListener(new AbstractAction() {
|
|
|
|
|
@Override
|
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
|
JFileChooser fd = new JFileChooser();
|
|
|
|
|
joggle.JFileChooserDemo.fileFilter(fd,"look");
|
|
|
|
|
int val = fd.showOpenDialog(null);
|
|
|
|
|
if(val == fd.APPROVE_OPTION){
|
|
|
|
|
File file = fd.getSelectedFile();
|
|
|
|
|
file.getPath();
|
|
|
|
|
File newfile = new File(file,"");
|
|
|
|
|
newfile.mkdirs();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setCreate_page();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
JButton b1 = new JButton("取消");
|
|
|
|
|
b1.setBounds(625, 400, 250, 50);
|
|
|
|
|
}
|
|
|
|
|
//打开
|
|
|
|
|
public static void open(){
|
|
|
|
|
JButton b = new JButton("打开");
|
|
|
|
|
b.setBounds(625,400,250,50);
|
|
|
|
|
Container c = page.getContentPane();
|
|
|
|
|
c.setLayout(new FlowLayout());
|
|
|
|
|
c.add(b1);
|
|
|
|
|
b1.setDefaultCapable(true);
|
|
|
|
|
b1.addActionListener(new AbstractAction() {
|
|
|
|
|
c.add(b);
|
|
|
|
|
b.setDefaultCapable(true);
|
|
|
|
|
b.setVisible(true);
|
|
|
|
|
//鼠标触发事件
|
|
|
|
|
b.addActionListener(new AbstractAction() {
|
|
|
|
|
@Override
|
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
|
create_page.removeAll();
|
|
|
|
|
create_page.setVisible(false);
|
|
|
|
|
joggle.JFileChooserDemo.open_resource();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
c.setVisible(true);
|
|
|
|
|
}
|
|
|
|
|
//创建新的创作
|
|
|
|
|
public static void new_create() {
|
|
|
|
|
public static void create(){
|
|
|
|
|
JButton b = new JButton("创建");
|
|
|
|
|
b.setBounds(625, 300, 250, 50);
|
|
|
|
|
Container c = page.getContentPane();
|
|
|
|
|
b.setBounds(625,300,250,50);
|
|
|
|
|
Container c = create_page.getContentPane();
|
|
|
|
|
c.setLayout(new FlowLayout());
|
|
|
|
|
c.add(b);
|
|
|
|
|
b.setDefaultCapable(true);
|
|
|
|
|
b.setVisible(true);
|
|
|
|
|
//鼠标触发事件
|
|
|
|
|
b.addActionListener(new AbstractAction() {
|
|
|
|
|
@Override
|
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
|
setCreate_page();
|
|
|
|
|
JFileChooser fd = new JFileChooser();
|
|
|
|
|
joggle.JFileChooserDemo.fileFilter(fd,"look");
|
|
|
|
|
int val = fd.showOpenDialog(null);
|
|
|
|
|
if(val == fd.APPROVE_OPTION){
|
|
|
|
|
File file = fd.getSelectedFile();
|
|
|
|
|
file.getPath();
|
|
|
|
|
File newfile = new File(file,"");
|
|
|
|
|
newfile.mkdirs();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//打开
|
|
|
|
|
public static void open(){
|
|
|
|
|
JButton b = new JButton("打开");
|
|
|
|
|
b.setBounds(625,400,250,50);
|
|
|
|
|
Container c = page.getContentPane();
|
|
|
|
|
public static void setFileName(){
|
|
|
|
|
JTextField fileName = new JTextField();
|
|
|
|
|
fileName.setBounds(625,200,250,50);
|
|
|
|
|
Container c = create_page.getContentPane();
|
|
|
|
|
c.setLayout(new FlowLayout());
|
|
|
|
|
c.add(fileName);
|
|
|
|
|
fileName.setVisible(true);
|
|
|
|
|
}
|
|
|
|
|
public static void cancle(){
|
|
|
|
|
JButton b = new JButton("取消");
|
|
|
|
|
b.setBounds(625, 400, 250, 50);
|
|
|
|
|
Container c = create_page.getContentPane();
|
|
|
|
|
c.setLayout(new FlowLayout());
|
|
|
|
|
c.add(b);
|
|
|
|
|
b.setDefaultCapable(true);
|
|
|
|
|
b.setVisible(true);
|
|
|
|
|
//鼠标触发事件
|
|
|
|
|
b.addActionListener(new AbstractAction() {
|
|
|
|
|
@Override
|
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
|
joggle.JFileChooserDemo.open_resource();
|
|
|
|
|
create_page.removeAll();
|
|
|
|
|
create_page.setVisible(false);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|