⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 musicseteditor.java

📁 音乐播放器 好像是用java编的 欢迎下载
💻 JAVA
字号:
package musicmgrsys;

import javax.swing.JDialog;
import com.borland.jbcl.layout.XYLayout;
import com.borland.jbcl.layout.*;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.GridBagLayout;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.*;
import javax.swing.JOptionPane;
import javax.swing.tree.DefaultMutableTreeNode;

public class MusicsetEditor extends JDialog {
    MainView mv = null;
    public MusicsetEditor(MainView mv) {
        try {
            jbInit();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        this.mv = mv;
    }

    private void jbInit() throws Exception {
        this.getContentPane().setLayout(gridBagLayout1);
        jLabel1.setText("音乐集名称");
        jButton1.setText("确定");
        jButton1.addActionListener(new MusicsetEditor_jButton1_actionAdapter(this));
        jButton2.setText("取消");
        jButton2.addActionListener(new MusicsetEditor_jButton2_actionAdapter(this));
        this.setModal(true);
        this.setResizable(false);
        this.setTitle("新添音乐集");
        jLabel2.setText("英文名(一定要有)");
        this.getContentPane().add(jLabel1,
                                  new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
                , GridBagConstraints.WEST, GridBagConstraints.NONE,
                new Insets(86, 57, 0, 0), 5, 11));
        this.getContentPane().add(jTextField1,
                                  new GridBagConstraints(1, 0, 2, 1, 1.0, 0.0
                , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
                new Insets(86, 24, 0, 59), 189, 4));
        this.getContentPane().add(jLabel2,
                                  new GridBagConstraints(0, 1, 2, 1, 0.0, 0.0
                , GridBagConstraints.WEST, GridBagConstraints.NONE,
                new Insets(42, 57, 0, 10), 2, 12));
        this.getContentPane().add(jTextField2,
                                  new GridBagConstraints(2, 1, 1, 1, 1.0, 0.0
                , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
                new Insets(42, 18, 0, 87), 112, 5));
        this.getContentPane().add(jButton1,
                                  new GridBagConstraints(0, 2, 2, 1, 0.0, 0.0
                , GridBagConstraints.CENTER, GridBagConstraints.NONE,
                new Insets(51, 97, 40, 0), 21, 3));
        this.getContentPane().add(jButton2,
                                  new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0
                , GridBagConstraints.CENTER, GridBagConstraints.NONE,
                new Insets(51, 83, 40, 65), 16, 2));
    }

    JLabel jLabel1 = new JLabel();
    JTextField jTextField1 = new JTextField();
    JLabel jLabel2 = new JLabel();
    JTextField jTextField2 = new JTextField();
    JButton jButton1 = new JButton();
    JButton jButton2 = new JButton();
    GridBagLayout gridBagLayout1 = new GridBagLayout();
    public void jButton1_actionPerformed(ActionEvent e) {
        String name = jTextField1.getText();
        String tabname = jTextField2.getText();

        MusicModel mm = new MusicModel(name, tabname);
        mm.connectDB();
        String str1 = "insert into MUSICSET values('" + name + "', '" + tabname + "')";
        String str2 = "create table " + tabname + "(FORMAT string, GERUE string, RATING int, EVALUATION string, TITLE string, DIRECTOR string, YEAR int, COMMENTS string, LOCATION string)";
        try{
            mm.getStatement().executeUpdate(str1);
            mm.getStatement().executeUpdate(str2);
        }
        catch(Exception ex)
        {
            JOptionPane.showMessageDialog(null, ex.toString());
        }
        mm.addObserver(this.mv.getMusicListView());
        mv.getMusicListView().addObject(mv.getMusicListView().getRootNode(), name);
        this.mv.getList().add(mm);
        this.dispose();
    }

    public void jButton2_actionPerformed(ActionEvent e) {
        this.dispose();
    }
}


class MusicsetEditor_jButton2_actionAdapter implements ActionListener {
    private MusicsetEditor adaptee;
    MusicsetEditor_jButton2_actionAdapter(MusicsetEditor adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.jButton2_actionPerformed(e);
    }
}


class MusicsetEditor_jButton1_actionAdapter implements ActionListener {
    private MusicsetEditor adaptee;
    MusicsetEditor_jButton1_actionAdapter(MusicsetEditor adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.jButton1_actionPerformed(e);
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -