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

📄 database_gui_openfileview.java

📁 JAVA 資料庫讀寫測試 簡單的對 MYSQL資料庫讀寫測試
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* * Database_gui_openfileView.java */package database_gui_openfile;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 javax.swing.Timer;import javax.swing.Icon;import javax.swing.JDialog;import javax.swing.JFrame;import   java.util.*;import java.sql.*;                                /** * The application's main frame. */public class Database_gui_openfileView extends FrameView {                public Database_gui_openfileView(SingleFrameApplication app) {        super(app);        initComponents();                        // status bar initialization - message timeout, idle icon and busy animation, etc        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 = Database_gui_openfileApp.getApplication().getMainFrame();            aboutBox = new Database_gui_openfileAboutBox(mainFrame);            aboutBox.setLocationRelativeTo(mainFrame);        }        Database_gui_openfileApp.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.     */    @SuppressWarnings("unchecked")    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents    private void initComponents() {        mainPanel = new javax.swing.JPanel();        jLabel1 = new javax.swing.JLabel();        jButton2 = new javax.swing.JButton();        jButton3 = new javax.swing.JButton();        jTextField1 = new javax.swing.JTextField();        jLabel2 = new javax.swing.JLabel();        jButton5 = new javax.swing.JButton();        jTextField2 = new javax.swing.JTextField();        jTextField3 = new javax.swing.JTextField();        jTextField4 = new javax.swing.JTextField();        jTextField5 = new javax.swing.JTextField();        jLabel3 = new javax.swing.JLabel();        jLabel4 = new javax.swing.JLabel();        jLabel5 = new javax.swing.JLabel();        jLabel6 = new javax.swing.JLabel();        jButton4 = new javax.swing.JButton();        jScrollPane1 = new javax.swing.JScrollPane();        jList1 = new javax.swing.JList();        jScrollPane2 = new javax.swing.JScrollPane();        jList2 = new javax.swing.JList();        jLabel7 = new javax.swing.JLabel();        jLabel8 = new javax.swing.JLabel();        jButton1 = new javax.swing.JButton();        menuBar = new javax.swing.JMenuBar();        javax.swing.JMenu fileMenu = new javax.swing.JMenu();        javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();        jMenuItem1 = new javax.swing.JMenuItem();        javax.swing.JMenu helpMenu = new javax.swing.JMenu();        javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem();        statusPanel = new javax.swing.JPanel();        javax.swing.JSeparator statusPanelSeparator = new javax.swing.JSeparator();        statusMessageLabel = new javax.swing.JLabel();        statusAnimationLabel = new javax.swing.JLabel();        progressBar = new javax.swing.JProgressBar();        jSeparator1 = new javax.swing.JSeparator();        mainPanel.setName("mainPanel"); // NOI18N        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(database_gui_openfile.Database_gui_openfileApp.class).getContext().getResourceMap(Database_gui_openfileView.class);        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N        jLabel1.setName("jLabel1"); // NOI18N        jButton2.setName("jButton2"); // NOI18N        jButton3.setName("jButton3"); // NOI18N        jButton3.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jButton3ActionPerformed(evt);            }        });        jTextField1.setText(resourceMap.getString("jTextField1.text")); // NOI18N        jTextField1.setName("jTextField1"); // NOI18N        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N        jLabel2.setName("jLabel2"); // NOI18N        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(database_gui_openfile.Database_gui_openfileApp.class).getContext().getActionMap(Database_gui_openfileView.class, this);        jButton5.setAction(actionMap.get("search")); // NOI18N        jButton5.setText(resourceMap.getString("jButton5.text")); // NOI18N        jButton5.setName("jButton5"); // NOI18N        jTextField2.setText(resourceMap.getString("jTextField2.text")); // NOI18N        jTextField2.setName("jTextField2"); // NOI18N        jTextField3.setText(resourceMap.getString("jTextField3.text")); // NOI18N        jTextField3.setName("jTextField3"); // NOI18N        jTextField4.setText(resourceMap.getString("jTextField4.text")); // NOI18N        jTextField4.setName("jTextField4"); // NOI18N        jTextField5.setText(resourceMap.getString("jTextField5.text")); // NOI18N        jTextField5.setName("jTextField5"); // NOI18N        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N        jLabel3.setName("jLabel3"); // NOI18N        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N        jLabel4.setName("jLabel4"); // NOI18N        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N        jLabel5.setName("jLabel5"); // NOI18N        jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N        jLabel6.setName("jLabel6"); // NOI18N        jButton4.setAction(actionMap.get("delete")); // NOI18N        jButton4.setText(resourceMap.getString("jButton4.text")); // NOI18N        jButton4.setName("jButton4"); // NOI18N        jScrollPane1.setName("jScrollPane1"); // NOI18N        jList1.setModel(new javax.swing.AbstractListModel() {            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };            public int getSize() { return strings.length; }            public Object getElementAt(int i) { return strings[i]; }        });        jList1.setName("jList1"); // NOI18N        jList1.addKeyListener(new java.awt.event.KeyAdapter() {            public void keyPressed(java.awt.event.KeyEvent evt) {                select_item(evt);            }        });        jScrollPane1.setViewportView(jList1);        jScrollPane2.setName("jScrollPane2"); // NOI18N        jList2.setModel(new javax.swing.AbstractListModel() {            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };            public int getSize() { return strings.length; }            public Object getElementAt(int i) { return strings[i]; }        });        jList2.setName("jList2"); // NOI18N        jScrollPane2.setViewportView(jList2);        jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N        jLabel7.setName("jLabel7"); // NOI18N        jLabel8.setText(resourceMap.getString("jLabel8.text")); // NOI18N        jLabel8.setName("jLabel8"); // NOI18N        jButton1.setText(resourceMap.getString("jButton1.text")); // NOI18N        jButton1.setName("jButton1"); // NOI18N        javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);        mainPanel.setLayout(mainPanelLayout);        mainPanelLayout.setHorizontalGroup(            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGroup(mainPanelLayout.createSequentialGroup()                .addContainerGap()                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)                    .addGroup(mainPanelLayout.createSequentialGroup()                        .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 88, Short.MAX_VALUE)                        .addGap(181, 181, 181)                        .addComponent(jLabel2)                        .addGap(241, 241, 241))                    .addGroup(mainPanelLayout.createSequentialGroup()                        .addComponent(jLabel3)                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)                        .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)                        .addComponent(jLabel4)                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)                        .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)                        .addComponent(jLabel5)                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)                        .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)                        .addComponent(jLabel6)                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)                        .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))                    .addGroup(mainPanelLayout.createSequentialGroup()                        .addComponent(jLabel7)                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)                        .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE))                    .addGroup(mainPanelLayout.createSequentialGroup()                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)                        .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)                        .addComponent(jButton3)                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)                        .addComponent(jButton1)                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)                        .addComponent(jButton4)                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)                        .addComponent(jButton5)                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)                        .addComponent(jButton2))                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 558, Short.MAX_VALUE)                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 558, Short.MAX_VALUE))                .addContainerGap())        );        mainPanelLayout.setVerticalGroup(            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGroup(mainPanelLayout.createSequentialGroup()                .addGap(10, 10, 10)                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

⌨️ 快捷键说明

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