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

📄 mymp3view.java

📁 是一个java写的 可以输入要下的歌名
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
/* * MYmp3View.java */package mymp3;import java.awt.Color;import org.jdesktop.application.Action;import org.jdesktop.application.ResourceMap;import org.jdesktop.application.SingleFrameApplication;import org.jdesktop.application.FrameView;import org.jdesktop.application.TaskMonitor;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.io.File;import java.net.URLEncoder;import java.util.ArrayList;import java.util.List;import javax.swing.Timer;import javax.swing.Icon;import javax.swing.JDialog;import javax.swing.JFileChooser;import javax.swing.JFrame;import javax.swing.SwingUtilities;import javax.swing.table.TableColumn;import javax.swing.table.TableColumnModel;import javax.swing.table.TableModel;import mymp3.downloader.Manager;import mymp3.downloader.TaskModel;import mymp3.downloader.TaskTableModel;import mymp3.pp.DirFileFilter;import mymp3.pp.MoveMouseListener;import mymp3.pp.MyTableCellRenderer;import mymp3.pp.ProgressBarRenderer;/** * The application's main frame. */public class MYmp3View extends FrameView {    public MYmp3View(SingleFrameApplication app) {        super(app);        initComponents();        JFrame frame = getFrame();        //frame.setUndecorated(true);        MoveMouseListener mml = new MoveMouseListener(frame);        frame.addMouseListener(mml);        frame.addMouseMotionListener(mml);        ResourceMap resourceMap = getResourceMap();        int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");        messageTimer = new Timer(messageTimeout, new ActionListener() {            public void actionPerformed(ActionEvent e) {                //statusMessageLabel.setText("");            }        });        messageTimer.setRepeats(false);        int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");        for (int i = 0; i < busyIcons.length; i++) {            busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");        }        busyIconTimer = new Timer(busyAnimationRate, new ActionListener() {            public void actionPerformed(ActionEvent e) {                busyIconIndex = (busyIconIndex + 1) % busyIcons.length;                //statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);            }        });        idleIcon = resourceMap.getIcon("StatusBar.idleIcon");        //statusAnimationLabel.setIcon(idleIcon);        progressBar.setVisible(false);        // connecting action tasks to status bar via TaskMonitor        TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());        taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() {            public void propertyChange(java.beans.PropertyChangeEvent evt) {                String propertyName = evt.getPropertyName();                if ("started".equals(propertyName)) {                    if (!busyIconTimer.isRunning()) {                        //statusAnimationLabel.setIcon(busyIcons[0]);                        busyIconIndex = 0;                        busyIconTimer.start();                    }                    progressBar.setVisible(true);                    progressBar.setIndeterminate(true);                } else if ("done".equals(propertyName)) {                    busyIconTimer.stop();                    //statusAnimationLabel.setIcon(idleIcon);                    progressBar.setVisible(false);                    progressBar.setValue(0);                } else if ("message".equals(propertyName)) {                    String text = (String)(evt.getNewValue());                    //statusMessageLabel.setText((text == null) ? "" : text);                    messageTimer.restart();                } else if ("progress".equals(propertyName)) {                    int value = (Integer)(evt.getNewValue());                    progressBar.setVisible(true);                    progressBar.setIndeterminate(false);                    progressBar.setValue(value);                }            }        });    }    @Action    public void showAboutBox() {        if (aboutBox == null) {            JFrame mainFrame = MYmp3App.getApplication().getMainFrame();            aboutBox = new MYmp3AboutBox(mainFrame);            aboutBox.setLocationRelativeTo(mainFrame);        }        MYmp3App.getApplication().show(aboutBox);    }    /** This method is called from within the constructor to     * initialize the form.     * WARNING: Do NOT modify this code. The content of this method is     * always regenerated by the Form Editor.     */    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents    private void initComponents() {        mainPanel = new javax.swing.JPanel();        jLabel1 = new javax.swing.JLabel();        jtf1 = new javax.swing.JTextField();        jButton1 = new javax.swing.JButton();        jScrollPane2 = new javax.swing.JScrollPane();        jTable1 = new javax.swing.JTable();        jButton2 = new javax.swing.JButton();        jScrollPane1 = new javax.swing.JScrollPane();        jTable2 = new javax.swing.JTable();        jButton3 = new javax.swing.JButton();        jButton4 = new javax.swing.JButton();        jButton5 = new javax.swing.JButton();        jButton6 = new javax.swing.JButton();        jLabel3 = new javax.swing.JLabel();        jLabel_savePath = new javax.swing.JLabel();        progressBar = new javax.swing.JProgressBar();        jButton7 = new javax.swing.JButton();        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(mymp3.MYmp3App.class).getContext().getResourceMap(MYmp3View.class);        mainPanel.setBackground(resourceMap.getColor("mainPanel.background")); // NOI18N        mainPanel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));        mainPanel.setName("mainPanel"); // NOI18N        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N        jLabel1.setName("jLabel1"); // NOI18N        jtf1.setText(resourceMap.getString("jtf1.text")); // NOI18N        jtf1.setName("jtf1"); // NOI18N        jtf1.addKeyListener(new java.awt.event.KeyAdapter() {            public void keyPressed(java.awt.event.KeyEvent evt) {                jtf1KeyPressed(evt);            }        });        jButton1.setText(resourceMap.getString("jButton1.text")); // NOI18N        jButton1.setName("jButton1"); // NOI18N        jButton1.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jButton1ActionPerformed(evt);            }        });        jScrollPane2.setBackground(resourceMap.getColor("jScrollPane2.background")); // NOI18N        jScrollPane2.setName("jScrollPane2"); // NOI18N        jTable1.setBackground(resourceMap.getColor("jTable1.background")); // NOI18N        jTable1.setModel(new Mp3TableModel());        jTable1.setColumnSelectionAllowed(true);        jTable1.setFocusable(false);        jTable1.setGridColor(resourceMap.getColor("jTable1.gridColor")); // NOI18N        jTable1.setSelectionBackground(resourceMap.getColor("jTable1.selectionBackground")); // NOI18N        jTable1.setSelectionForeground(resourceMap.getColor("jTable1.selectionForeground")); // NOI18N        jTable1.setShowHorizontalLines(false);        jTable1.setShowVerticalLines(false);        jTable1.getTableHeader().setReorderingAllowed(false);        jScrollPane2.setViewportView(jTable1);        jTable1.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);        resetTable();        jButton2.setText(resourceMap.getString("jButton2.text")); // NOI18N        jButton2.setName("jButton2"); // NOI18N        jButton2.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jButton2ActionPerformed(evt);            }        });        jScrollPane1.setBackground(new java.awt.Color(255,255,255));        jScrollPane1.setName("jScrollPane1"); // NOI18N        jTable2.setModel(new TaskTableModel());        jTable2.setColumnSelectionAllowed(true);        jTable2.setFocusable(false);        jTable2.setGridColor(resourceMap.getColor("jTable2.gridColor")); // NOI18N        jTable2.setName("jTable2"); // NOI18N        jTable2.setSelectionBackground(resourceMap.getColor("jTable2.selectionBackground")); // NOI18N        jTable2.setSelectionForeground(resourceMap.getColor("jTable2.selectionForeground")); // NOI18N        jTable2.getTableHeader().setReorderingAllowed(false);        jScrollPane1.setViewportView(jTable2);        jTable2.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);        jTable2.setRowSelectionAllowed(true);        jTable2.setColumnSelectionAllowed(false);        jTable2.setRowHeight(22);        TableColumnModel tcm_jTable2 = jTable2.getColumnModel();        int cc = tcm_jTable2.getColumnCount();        for (int i = 0; i < cc; i++) {            tcm_jTable2.getColumn(i).setCellRenderer(new MyTableCellRenderer());        }        jButton3.setText(resourceMap.getString("jButton3.text")); // NOI18N        jButton3.setName("jButton3"); // NOI18N        jButton3.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jButton3ActionPerformed(evt);            }        });        jButton4.setText(resourceMap.getString("jButton4.text")); // NOI18N        jButton4.setName("jButton4"); // NOI18N        jButton4.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jButton4ActionPerformed(evt);            }        });        jButton5.setText(resourceMap.getString("jButton5.text")); // NOI18N        jButton5.setName("jButton5"); // NOI18N        jButton5.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jButton5ActionPerformed(evt);

⌨️ 快捷键说明

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