diff --git a/DGcreate/out/production/DGcreate/menu/MainWindow$1.class b/DGcreate/out/production/DGcreate/menu/MainWindow$1.class index 2a1c2a4..7f22ad8 100644 Binary files a/DGcreate/out/production/DGcreate/menu/MainWindow$1.class and b/DGcreate/out/production/DGcreate/menu/MainWindow$1.class differ diff --git a/DGcreate/out/production/DGcreate/menu/MainWindow$2.class b/DGcreate/out/production/DGcreate/menu/MainWindow$2.class index 39542d1..5ff80b6 100644 Binary files a/DGcreate/out/production/DGcreate/menu/MainWindow$2.class and b/DGcreate/out/production/DGcreate/menu/MainWindow$2.class differ diff --git a/DGcreate/out/production/DGcreate/menu/MainWindow$3.class b/DGcreate/out/production/DGcreate/menu/MainWindow$3.class index 28ab926..d4ee9fe 100644 Binary files a/DGcreate/out/production/DGcreate/menu/MainWindow$3.class and b/DGcreate/out/production/DGcreate/menu/MainWindow$3.class differ diff --git a/DGcreate/out/production/DGcreate/menu/MainWindow$4.class b/DGcreate/out/production/DGcreate/menu/MainWindow$4.class index aa53785..a832c92 100644 Binary files a/DGcreate/out/production/DGcreate/menu/MainWindow$4.class and b/DGcreate/out/production/DGcreate/menu/MainWindow$4.class differ diff --git a/DGcreate/out/production/DGcreate/menu/MainWindow.class b/DGcreate/out/production/DGcreate/menu/MainWindow.class index 06a3475..2f4540a 100644 Binary files a/DGcreate/out/production/DGcreate/menu/MainWindow.class and b/DGcreate/out/production/DGcreate/menu/MainWindow.class differ diff --git a/DGcreate/src/menu/CreateWindow.java b/DGcreate/src/menu/CreateWindow.java index bbb57ea..be60ba0 100644 --- a/DGcreate/src/menu/CreateWindow.java +++ b/DGcreate/src/menu/CreateWindow.java @@ -3,13 +3,95 @@ package menu; import javax.swing.*; import joggle.joggle; -public class CreateWindow { - public static JFrame page = new JFrame("创作窗口"); +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.io.File; +import java.util.List; + +public class CreateWindow { + private static JFrame page = new JFrame("创作窗口"); + private static JPanel resource_panel = new JPanel(); + //创作资源面板 + private static JPanel main_panel = new JPanel(); + //主播放面板 + private static JPanel assembly_panel = new JPanel(); + //组件面板 + private static JPanel edit_panel = new JPanel(); + //编辑面板 public static void setPage(){ page.setSize(1500,1000); page.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); page.setResizable(false); page.setLocationRelativeTo(null); page.setVisible(true); + resource_panel.setSize(750,500); + main_panel.setSize(750,500); + assembly_panel.setSize(750,500); + edit_panel.setSize(750,500); + } + public static class Set_resource_panel{ + public static void choose_file(){ + JFrame frame = new JFrame("File Drag and Drop"); + JLabel label = new JLabel("Drag and drop a file here."); + + label.setTransferHandler(new TransferHandler() { + @Override + public boolean canImport(TransferSupport support) { + // 检查是否支持拖放文件 + return support.isDataFlavorSupported(DataFlavor.javaFileListFlavor); + } + + @SuppressWarnings("unchecked") + @Override + public boolean importData(TransferSupport support) { + // 处理拖放操作 + if (!canImport(support)) { + return false; + } + Transferable transferable = support.getTransferable(); + try { + List files = (List) transferable.getTransferData(DataFlavor.javaFileListFlavor); + for (File file : files) { + System.out.println(file.getAbsolutePath()); + // 在此处处理文件 + // ... + } + } catch (Exception e) { + e.printStackTrace(); + return false; + } + return true; + } + }); + + label.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + JComponent c = (JComponent) e.getSource(); + TransferHandler handler = c.getTransferHandler(); + handler.exportAsDrag(c, e, TransferHandler.COPY); + } + }); + + frame.getContentPane().add(label); + frame.setSize(400, 300); + frame.setLocationRelativeTo(null); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setVisible(true); + + } + public static void remove_file(){ + + } + } + public static class Set_main_panel{ + public static void play(){ + + } + public static void suspend(){ + + } } } diff --git a/DGcreate/src/menu/MainWindow.java b/DGcreate/src/menu/MainWindow.java index e1fd8e3..dcf7470 100644 --- a/DGcreate/src/menu/MainWindow.java +++ b/DGcreate/src/menu/MainWindow.java @@ -11,9 +11,9 @@ import java.io.*; public class MainWindow extends menu { private static JFrame page = new JFrame("主菜单"); private static JFrame create_page = new JFrame("创建"); - private static Container c = new Container(); - private static Container c1 = new Container(); private static JTextField fileName = new JTextField(); + private static Container c = page.getContentPane(); + private static Container c1 = create_page.getContentPane(); private static int flag = 0; //创建主窗口 public static void main(String[] args) { @@ -22,29 +22,27 @@ public class MainWindow extends menu { page.setResizable(false); page.setLocationRelativeTo(null); page.setVisible(true); - c.setLayout(new GridLayout(2,1,50,0)); - page.add(c); + c.setLayout(null); new_create(); open(); } public static void setCreate_page(){ - create_page.setSize(400,200); + create_page.setSize(800,600); create_page.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); create_page.setResizable(false); create_page.setLocationRelativeTo(null); create_page.setVisible(true); - c1.setLayout(new GridLayout(3,1,20,20)); - create_page.add(c1); + c1.setLayout(null); if(flag == 0){ setFileName(); create(); - cancle(); + cancel(); } } //创建新的创作 public static void new_create() { JButton b = new JButton("创建"); - b.setBounds(625, 300, 250, 50); + b.setBounds(625,300,250,50); c.add(b); b.setDefaultCapable(true); b.setVisible(true); @@ -73,7 +71,7 @@ public class MainWindow extends menu { //创建文件 public static void create(){ JButton b = new JButton("创建"); - b.setSize(50,10); + b.setBounds(260,300,250,50); c1.add(b); b.setDefaultCapable(true); b.setVisible(true); @@ -103,13 +101,13 @@ public class MainWindow extends menu { }); } public static void setFileName(){ - fileName.setSize(10,10); + fileName.setBounds(260,200,250,50); c1.add(fileName); fileName.setVisible(true); } - public static void cancle(){ + public static void cancel(){ JButton b = new JButton("取消"); - b.setSize(50,10); + b.setBounds(260,400,250,50); c1.add(b); b.setDefaultCapable(true); b.setVisible(true);