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

📄 musiceditor.java~26~

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

import javax.swing.JDialog;
import com.borland.jbcl.layout.XYLayout;
import com.borland.jbcl.layout.*;
import javax.swing.JLabel;
import javax.swing.JComboBox;
import javax.swing.JTextField;
import javax.swing.JTextArea;
import java.awt.GridBagLayout;
import java.awt.*;
import javax.swing.JButton;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.*;
import javax.swing.JOptionPane;
import java.util.ArrayList;

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

    private void jbInit() throws Exception {
        this.getContentPane().setLayout(xYLayout1);
        this.setModal(true);
        this.setResizable(false);
        this.setTitle("音乐编辑器");
        jLabel1.setText("介质");
        jLabel6.setText("发行年");
        jLabel7.setText("评价");
        jLabel8.setText("注释");
        jLabel5.setText("原唱者");
        jLabel4.setText("歌曲名");
        jLabel3.setText("等级");
        jLabel2.setText("种类");
        jButton2.setText("取消");
        jButton2.addActionListener(new MusicEditor_jButton2_actionAdapter(this));
        jButton1.setText("确定");
        jButton1.addActionListener(new MusicEditor_jButton1_actionAdapter(this));
        jComboBox1.insertItemAt("VHS", 0);
        jComboBox1.insertItemAt("DVD", 1);
        jComboBox1.insertItemAt("VCD", 2);
        jComboBox1.insertItemAt("SVCD", 3);
        jComboBox1.insertItemAt("TYPE", 4);
        jComboBox1.insertItemAt("MP3", 5);
        jComboBox1.insertItemAt("MP4", 6);

        jComboBox2.insertItemAt("1", 0);
        jComboBox2.insertItemAt("2", 1);
        jComboBox2.insertItemAt("3", 2);
        jComboBox2.insertItemAt("4", 3);
        jComboBox2.insertItemAt("5", 4);
        jLabel9.setText("所属音乐集");

        String DRIVER = "com.borland.datastore.jdbc.DataStoreDriver";
        String URL = "jdbc:borland:dslocal:";
        String FILE = "musicmgrsys.jds";

        try
        {
            Class.forName(DRIVER);
            Connection con = DriverManager.getConnection(URL + FILE, "SYSDBA", "masterkey");
            Statement stmt = con.createStatement();
            ResultSet rs = stmt.executeQuery("select NAME from MUSICSET");
            int i = 0;
            while(rs.next())
            {
                jComboBox3.insertItemAt(rs.getString("NAME"), i++);
            }
            rs.close();
            stmt.close();
            con.close();
        }
        catch(Exception e)
        {
            JOptionPane.showMessageDialog(null, e.toString());
        }

        xYLayout1.setWidth(400);
        xYLayout1.setHeight(378);
        this.getContentPane().add(jLabel9, new XYConstraints(176, 114, 63, 22));
        jButton3.setText("...");
        jLabel10.setText("路径");
        this.getContentPane().add(jTextField4,
                                  new XYConstraints(88, 115, 76, 21));
        this.getContentPane().add(jLabel6, new XYConstraints(17, 114, 38, 23));
        this.getContentPane().add(jTextField3,
                                  new XYConstraints(288, 73, 95, 22));
        this.getContentPane().add(jLabel5, new XYConstraints(220, 71, 41, 24));
        this.getContentPane().add(jTextField2,
                                  new XYConstraints(88, 72, 111, 23));
        this.getContentPane().add(jLabel4, new XYConstraints(17, 71, 42, 25));
        this.getContentPane().add(jLabel3, new XYConstraints(288, 17, 31, 22));
        this.getContentPane().add(jTextField1,
                                  new XYConstraints(211, 18, 64, -1));
        this.getContentPane().add(jLabel2, new XYConstraints(175, 17, -1, 22));
        this.getContentPane().add(jButton1, new XYConstraints(90, 338, 74, -1));
        this.getContentPane().add(jButton2, new XYConstraints(262, 339, 81, 22));
        this.getContentPane().add(jTextArea2,
                                  new XYConstraints(88, 283, 295, 28));
        this.getContentPane().add(jLabel8, new XYConstraints(17, 292, 38, 19));
        this.getContentPane().add(jTextArea1,
                                  new XYConstraints(88, 182, 295, 80));
        this.getContentPane().add(jLabel7, new XYConstraints(17, 183, 39, 21));
        this.getContentPane().add(jLabel1, new XYConstraints(17, 17, 28, 23));
        this.getContentPane().add(jComboBox3,
                                  new XYConstraints(255, 114, 128, 22));
        this.getContentPane().add(jComboBox2, new XYConstraints(319, 20, 64, 20));
        this.getContentPane().add(jTextField5,
                                  new XYConstraints(88, 149, 248, 23));
        this.getContentPane().add(jLabel10, new XYConstraints(17, 148, 38, 26));
        this.getContentPane().add(jComboBox1, new XYConstraints(59, 20, 83, 20));
        this.getContentPane().add(jButton3, new XYConstraints(344, 149, 39, 22));
    }

    JLabel jLabel1 = new JLabel();
    JComboBox jComboBox1 = new JComboBox();
    JLabel jLabel2 = new JLabel();
    JTextField jTextField1 = new JTextField();
    JLabel jLabel3 = new JLabel();
    JComboBox jComboBox2 = new JComboBox();
    JLabel jLabel4 = new JLabel();
    JTextField jTextField2 = new JTextField();
    JLabel jLabel5 = new JLabel();
    JTextField jTextField3 = new JTextField();
    JLabel jLabel6 = new JLabel();
    JTextField jTextField4 = new JTextField();
    JLabel jLabel7 = new JLabel();
    JTextArea jTextArea1 = new JTextArea();
    JLabel jLabel8 = new JLabel();
    JTextArea jTextArea2 = new JTextArea();
    JButton jButton1 = new JButton();
    JButton jButton2 = new JButton();
    JLabel jLabel9 = new JLabel();
    JComboBox jComboBox3 = new JComboBox();
    XYLayout xYLayout1 = new XYLayout();
    JLabel jLabel10 = new JLabel();
    JTextField jTextField5 = new JTextField();
    JButton jButton3 = new JButton();
    public void jButton1_actionPerformed(ActionEvent e) {
        String format = jComboBox1.getSelectedItem().toString();
        String gerue = jTextField1.getText();
        int rating = Integer.parseInt(jComboBox2.getSelectedItem().toString());
        String evaluation = jTextArea1.getText();
        String title = jTextField2.getText();
        String director = jTextField3.getText();
        int year = Integer.parseInt(jTextField4.getText());
        String comments = jTextArea2.getText();
        String name = jComboBox3.getSelectedItem().toString();
        String tabname = null;

        String DRIVER = "com.borland.datastore.jdbc.DataStoreDriver";
        String URL = "jdbc:borland:dslocal:";
        String FILE = "musicmgrsys.jds";

        try
        {
            Class.forName(DRIVER);
            Connection con = DriverManager.getConnection(URL + FILE, "SYSDBA", "masterkey");
            Statement stmt = con.createStatement();
            ResultSet rs = stmt.executeQuery("select TABNAME from MUSICSET where NAME='" + name + "'");
            while(rs.next())
            {
                tabname = rs.getString("TABNAME");
            }
            rs.close();
            stmt.close();
            con.close();
        }
        catch(Exception ex)
        {
            JOptionPane.showMessageDialog(null, ex.toString());
        }


        Music music = new Music();
        music.setFormat(format);
        music.setGerue(gerue);
        music.setRating(rating);
        music.setEvaluation(evaluation);
        music.setTitle(title);
        music.setDirector(director);
        music.setYear(year);
        music.setComments(comments);

        for(MusicModel i : mv.getList())
        {
            if(i.getTabname().equalsIgnoreCase(tabname))
            {
                i.connectDB();
                i.addMusic(music);
                i.closeDB();
            }
        }
        this.dispose();
    }

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


class MusicEditor_jButton2_actionAdapter implements ActionListener {
    private MusicEditor adaptee;
    MusicEditor_jButton2_actionAdapter(MusicEditor adaptee) {
        this.adaptee = adaptee;
    }

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


class MusicEditor_jButton1_actionAdapter implements ActionListener {
    private MusicEditor adaptee;
    MusicEditor_jButton1_actionAdapter(MusicEditor adaptee) {
        this.adaptee = adaptee;
    }

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

⌨️ 快捷键说明

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