Compare commits
25 Commits
Author | SHA1 | Date |
---|---|---|
|
cbf5233cb3 | 2 years ago |
|
95e0131d57 | 2 years ago |
|
eb5fd9bab2 | 2 years ago |
|
c51e919273 | 2 years ago |
|
af54bac13c | 2 years ago |
|
81330bee02 | 2 years ago |
|
2668786a1b | 2 years ago |
|
5c2c00b06c | 2 years ago |
|
f91f51ace0 | 2 years ago |
|
fc28ef9f20 | 2 years ago |
|
c77b9f075d | 2 years ago |
|
a6ff185823 | 2 years ago |
|
b8da110ee7 | 2 years ago |
|
1899c1ebcf | 2 years ago |
|
b8f366b5e4 | 2 years ago |
|
87e3218f37 | 2 years ago |
|
7e3d31ee8f | 2 years ago |
|
75c1fbc013 | 2 years ago |
|
2e2ddbab05 | 2 years ago |
|
2c4c4ee4c6 | 2 years ago |
|
e151db0a08 | 2 years ago |
|
8b4d3783cd | 2 years ago |
|
ab634e669b | 2 years ago |
|
d61679804b | 2 years ago |
|
1f6d31bbdf | 2 years ago |
@ -0,0 +1,3 @@
|
|||||||
|
# 默认忽略的文件
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
@ -0,0 +1,6 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="AndroidLintAppCompatMethod" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
</profile>
|
||||||
|
</component>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/DGcreate.iml" filepath="$PROJECT_DIR$/DGcreate.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,124 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Palette2">
|
||||||
|
<group name="Swing">
|
||||||
|
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Button" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="RadioButton" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="CheckBox" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Label" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||||
|
<preferred-size width="-1" height="20" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
</group>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,65 @@
|
|||||||
|
package joggle;
|
||||||
|
import javax.swing.*;
|
||||||
|
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||||
|
import java.awt.Desktop;
|
||||||
|
import java.io.*;
|
||||||
|
|
||||||
|
public class joggle {
|
||||||
|
public static class JFileChooserDemo{
|
||||||
|
public static void fileFilter(JFileChooser fd, String flag){
|
||||||
|
if(flag == "maindow"){
|
||||||
|
fd.setApproveButtonText("确定");
|
||||||
|
fd.setFileFilter(new FileNameExtensionFilter("DRC(*.drc)", "drc"));
|
||||||
|
fd.setAcceptAllFileFilterUsed(false);
|
||||||
|
}
|
||||||
|
else if(flag == "resource"){
|
||||||
|
fd.setApproveButtonText("确定");
|
||||||
|
fd.setFileFilter(new FileNameExtensionFilter("image(*.jpg,*.jpeg,*.png)", "drc"));
|
||||||
|
fd.setAcceptAllFileFilterUsed(false);
|
||||||
|
}
|
||||||
|
else if(flag == "look"){
|
||||||
|
fd.setApproveButtonText("确定");
|
||||||
|
fd.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
||||||
|
fd.setAcceptAllFileFilterUsed(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static boolean open_resource(){
|
||||||
|
JFileChooser fd = new JFileChooser();
|
||||||
|
//fd.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
||||||
|
fileFilter(fd, "mindow");
|
||||||
|
int val = fd.showOpenDialog(null);
|
||||||
|
if(val == fd.APPROVE_OPTION){
|
||||||
|
fd.getSelectedFile();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void copyFile(String oldPath, String newPath) {
|
||||||
|
try {
|
||||||
|
int bytesum = 0;
|
||||||
|
int byteread = 0;
|
||||||
|
File oldfile = new File(oldPath);
|
||||||
|
if (oldfile.exists()) { // 文件存在时
|
||||||
|
InputStream inStream = new FileInputStream(oldPath); // 读入原文件
|
||||||
|
FileOutputStream fs = new FileOutputStream(newPath);
|
||||||
|
byte[] buffer = new byte[1444];
|
||||||
|
int length;
|
||||||
|
while ((byteread = inStream.read(buffer)) != -1) {
|
||||||
|
bytesum += byteread; // 字节数 文件大小
|
||||||
|
System.out.println(bytesum);
|
||||||
|
fs.write(buffer, 0, byteread);
|
||||||
|
}
|
||||||
|
inStream.close();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("复制单个文件操作出错");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,97 @@
|
|||||||
|
package menu;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import joggle.joggle;
|
||||||
|
|
||||||
|
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<File> files = (List<File>) 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(){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,122 @@
|
|||||||
|
package menu;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import joggle.joggle;
|
||||||
|
import java.io.*;
|
||||||
|
|
||||||
|
|
||||||
|
//主窗口
|
||||||
|
public class MainWindow extends menu {
|
||||||
|
private static JFrame page = new JFrame("主菜单");
|
||||||
|
private static JFrame create_page = new JFrame("创建");
|
||||||
|
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) {
|
||||||
|
page.setSize(1500,1000);
|
||||||
|
page.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||||
|
page.setResizable(false);
|
||||||
|
page.setLocationRelativeTo(null);
|
||||||
|
page.setVisible(true);
|
||||||
|
c.setLayout(null);
|
||||||
|
new_create();
|
||||||
|
open();
|
||||||
|
}
|
||||||
|
public static void setCreate_page(){
|
||||||
|
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(null);
|
||||||
|
if(flag == 0){
|
||||||
|
setFileName();
|
||||||
|
create();
|
||||||
|
cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//创建新的创作
|
||||||
|
public static void new_create() {
|
||||||
|
JButton b = new JButton("创建");
|
||||||
|
b.setBounds(625,300,250,50);
|
||||||
|
c.add(b);
|
||||||
|
b.setDefaultCapable(true);
|
||||||
|
b.setVisible(true);
|
||||||
|
//鼠标触发事件
|
||||||
|
b.addActionListener(new AbstractAction() {
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
setCreate_page();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//打开
|
||||||
|
public static void open(){
|
||||||
|
JButton b = new JButton("打开");
|
||||||
|
b.setBounds(625,400,250,50);
|
||||||
|
c.add(b);
|
||||||
|
b.setDefaultCapable(true);
|
||||||
|
b.setVisible(true);
|
||||||
|
//鼠标触发事件
|
||||||
|
b.addActionListener(new AbstractAction() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
joggle.JFileChooserDemo.open_resource();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//创建文件
|
||||||
|
public static void create(){
|
||||||
|
JButton b = new JButton("创建");
|
||||||
|
b.setBounds(260,300,250,50);
|
||||||
|
c1.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();
|
||||||
|
//获取预览地址
|
||||||
|
try {
|
||||||
|
File newfile = new File(file, fileName.getText() + ".drc");
|
||||||
|
newfile.createNewFile();
|
||||||
|
//创建文件,格式为自创drc格式
|
||||||
|
}catch (IOException e1){
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
CreateWindow.setPage();
|
||||||
|
page.setVisible(false);
|
||||||
|
create_page.setVisible(false);
|
||||||
|
//打开创作窗口
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
public static void setFileName(){
|
||||||
|
fileName.setBounds(260,200,250,50);
|
||||||
|
c1.add(fileName);
|
||||||
|
fileName.setVisible(true);
|
||||||
|
}
|
||||||
|
public static void cancel(){
|
||||||
|
JButton b = new JButton("取消");
|
||||||
|
b.setBounds(260,400,250,50);
|
||||||
|
c1.add(b);
|
||||||
|
b.setDefaultCapable(true);
|
||||||
|
b.setVisible(true);
|
||||||
|
b.addActionListener(new AbstractAction() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
create_page.setVisible(false);
|
||||||
|
flag++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package menu;
|
||||||
|
import javax.swing.*;
|
||||||
|
|
||||||
|
//公用菜单抽象类
|
||||||
|
abstract public class menu {
|
||||||
|
//主界面窗口
|
||||||
|
public static void main(String[] args){
|
||||||
|
|
||||||
|
}
|
||||||
|
//问题反馈
|
||||||
|
public void feedback(){
|
||||||
|
|
||||||
|
}
|
||||||
|
//帮助
|
||||||
|
public void help(){
|
||||||
|
|
||||||
|
}
|
||||||
|
//设置
|
||||||
|
public void settings(){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue