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

📄 hkjc2view.java

📁 java写的读取香港马术比赛数据,分析并导入到EXCEL的源码,可供研究用。
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* * HKJC2View.java */package hkjc2;import hkjc2.logic.GetRaceDate;import hkjc2.logic.GetResults;import hkjc2.logic.GetStarters;import hkjc2.logic.HttpUtil;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.util.List;import java.util.logging.Level;import java.util.logging.Logger;import javax.swing.Timer;import javax.swing.Icon;import javax.swing.JDialog;import javax.swing.JFileChooser;import javax.swing.JFrame;import javax.swing.JOptionPane;/** * The application's main frame. */public class HKJC2View extends FrameView {       public HKJC2View(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 = HKJC2App.getApplication().getMainFrame();            aboutBox = new HKJC2AboutBox(mainFrame);            aboutBox.setLocationRelativeTo(mainFrame);        }        HKJC2App.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();        jPanel1 = new javax.swing.JPanel();        jCheckBox1 = new javax.swing.JCheckBox();        jLabel1 = new javax.swing.JLabel();        jLabel2 = new javax.swing.JLabel();        jTextField1 = new javax.swing.JTextField();        jTextField2 = new javax.swing.JTextField();        jPanel2 = new javax.swing.JPanel();        jButton1 = new javax.swing.JButton();        jPanel3 = new javax.swing.JPanel();        jComboBox1 = new javax.swing.JComboBox();        jButton2 = new javax.swing.JButton();        jButton3 = 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();        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();        mainPanel.setName("mainPanel"); // NOI18N        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(hkjc2.HKJC2App.class).getContext().getResourceMap(HKJC2View.class);        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel1.border.title"))); // NOI18N        jPanel1.setName("jPanel1"); // NOI18N        jCheckBox1.setText(resourceMap.getString("jCheckBox1.text")); // NOI18N        jCheckBox1.setName("jCheckBox1"); // NOI18N        jCheckBox1.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jCheckBox1ActionPerformed(evt);            }        });        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N        jLabel1.setEnabled(false);        jLabel1.setName("jLabel1"); // NOI18N        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N        jLabel2.setEnabled(false);        jLabel2.setName("jLabel2"); // NOI18N        jTextField1.setText(resourceMap.getString("jTextField1.text")); // NOI18N        jTextField1.setEnabled(false);        jTextField1.setName("jTextField1"); // NOI18N        jTextField2.setText(resourceMap.getString("jTextField2.text")); // NOI18N        jTextField2.setEnabled(false);        jTextField2.setName("jTextField2"); // NOI18N        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);        jPanel1.setLayout(jPanel1Layout);        jPanel1Layout.setHorizontalGroup(            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGroup(jPanel1Layout.createSequentialGroup()                .addContainerGap()                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)                    .addGroup(jPanel1Layout.createSequentialGroup()                        .addComponent(jLabel1)                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)                        .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)                        .addGap(18, 18, 18)                        .addComponent(jLabel2)                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)                        .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE))                    .addComponent(jCheckBox1))                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))        );        jPanel1Layout.setVerticalGroup(            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGroup(jPanel1Layout.createSequentialGroup()                .addContainerGap()                .addComponent(jCheckBox1)                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)                    .addComponent(jLabel1)                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)                    .addComponent(jLabel2)                    .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))        );        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel2.border.title"))); // NOI18N        jPanel2.setName("jPanel2"); // NOI18N        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);            }        });        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);        jPanel2.setLayout(jPanel2Layout);        jPanel2Layout.setHorizontalGroup(            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGroup(jPanel2Layout.createSequentialGroup()                .addContainerGap()                .addComponent(jButton1)                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))        );        jPanel2Layout.setVerticalGroup(            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()                .addContainerGap(50, Short.MAX_VALUE)                .addComponent(jButton1)                .addContainerGap())        );        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel3.border.title"))); // NOI18N        jPanel3.setName("jPanel3"); // NOI18N        jComboBox1.setName("jComboBox1"); // NOI18N

⌨️ 快捷键说明

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