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

📄 myjframe.java

📁 简单的实现学生信息管理
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. *//* * MyJFrame.java * * Created on 2009-4-16, 20:26:31 */package exam6;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.io.File;import java.sql.*;import java.text.DateFormat;import java.text.SimpleDateFormat;import java.util.Calendar;import javax.swing.ImageIcon;import javax.swing.JFileChooser;import javax.swing.JOptionPane;import javax.swing.filechooser.FileNameExtensionFilter;/** * * @author Administrator */public class MyJFrame extends javax.swing.JFrame {    public MyJFrame() {        initComponents();        this.setLocationRelativeTo(this);        int delay = 1000; //milliseconds        javax.swing.Timer timer = new javax.swing.Timer(delay, new ActionListener() {            int i = 0;            public void actionPerformed(ActionEvent e) {                java.text.DateFormat format1 = new java.text.SimpleDateFormat("yyyy-MM-dd hh:mm:ss");                String ss = format1.format(new java.util.Date());                jLabel12.setText(ss);            }        });        timer.start();    }    /** 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() {        buttonGroup1 = new javax.swing.ButtonGroup();        buttonGroup2 = new javax.swing.ButtonGroup();        jFrame1 = new javax.swing.JFrame();        jDialog1 = new javax.swing.JDialog();        jPanel1 = new javax.swing.JPanel();        jLabel1 = new javax.swing.JLabel();        jLabel2 = new javax.swing.JLabel();        jLabel12 = new javax.swing.JLabel();        jPanel2 = new javax.swing.JPanel();        jLabel3 = new javax.swing.JLabel();        jTextField2 = new javax.swing.JTextField();        jLabel4 = new javax.swing.JLabel();        jTextField3 = new javax.swing.JTextField();        jRadioButton1 = new javax.swing.JRadioButton();        jRadioButton2 = new javax.swing.JRadioButton();        jSpinner1 = new javax.swing.JSpinner();        jLabel5 = new javax.swing.JLabel();        jRadioButton3 = new javax.swing.JRadioButton();        jRadioButton4 = new javax.swing.JRadioButton();        jLabel6 = new javax.swing.JLabel();        jComboBox1 = new javax.swing.JComboBox();        jLabel7 = new javax.swing.JLabel();        jButton1 = new javax.swing.JButton();        jButton2 = new javax.swing.JButton();        jLabel8 = new javax.swing.JLabel();        jScrollPane1 = new javax.swing.JScrollPane();        jTextArea1 = new javax.swing.JTextArea();        jLabel9 = new javax.swing.JLabel();        jLabel10 = new javax.swing.JLabel();        jButton3 = new javax.swing.JButton();        jTextField1 = new javax.swing.JTextField();        jButton4 = new javax.swing.JButton();        jButton5 = new javax.swing.JButton();        jMenuBar1 = new javax.swing.JMenuBar();        jMenu1 = new javax.swing.JMenu();        jMenuItem1 = new javax.swing.JMenuItem();        jMenu2 = new javax.swing.JMenu();        javax.swing.GroupLayout jFrame1Layout = new javax.swing.GroupLayout(jFrame1.getContentPane());        jFrame1.getContentPane().setLayout(jFrame1Layout);        jFrame1Layout.setHorizontalGroup(            jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGap(0, 400, Short.MAX_VALUE)        );        jFrame1Layout.setVerticalGroup(            jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGap(0, 300, Short.MAX_VALUE)        );        javax.swing.GroupLayout jDialog1Layout = new javax.swing.GroupLayout(jDialog1.getContentPane());        jDialog1.getContentPane().setLayout(jDialog1Layout);        jDialog1Layout.setHorizontalGroup(            jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGap(0, 400, Short.MAX_VALUE)        );        jDialog1Layout.setVerticalGroup(            jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGap(0, 300, Short.MAX_VALUE)        );        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);        jLabel1.setText("作者:刘建样");        jLabel2.setText("日期:");        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()                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 211, Short.MAX_VALUE)                .addComponent(jLabel2)                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)                .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE)                .addContainerGap())        );        jPanel1Layout.setVerticalGroup(            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGroup(jPanel1Layout.createSequentialGroup()                .addGap(14, 14, 14)                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)                    .addComponent(jLabel1)                    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)))            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)                .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE))        );        jLabel3.setText("学号");        jLabel4.setText("姓名");        buttonGroup1.add(jRadioButton1);        jRadioButton1.setSelected(true);        jRadioButton1.setText("男");        jRadioButton1.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jRadioButton1ActionPerformed(evt);            }        });        buttonGroup1.add(jRadioButton2);        jRadioButton2.setText("女");        jRadioButton2.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jRadioButton2ActionPerformed(evt);            }        });        jSpinner1.setValue(20);        jLabel5.setText("年龄");        buttonGroup2.add(jRadioButton3);        jRadioButton3.setSelected(true);        jRadioButton3.setText("是");        buttonGroup2.add(jRadioButton4);        jRadioButton4.setText("否");        jLabel6.setText("党否");        jComboBox1.setEditable(true);        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "计算机科学与工程学院", "机械学院", "化工", "外语" }));        jLabel7.setText("学院");        jButton1.setText("保存");        jButton1.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jButton1ActionPerformed(evt);            }        });        jButton2.setText("取消");        jLabel8.setText("性别");        jTextArea1.setColumns(20);        jTextArea1.setRows(5);        jScrollPane1.setViewportView(jTextArea1);        jLabel9.setText("简历:");        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()                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)                    .addGroup(jPanel2Layout.createSequentialGroup()                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)                            .addGroup(jPanel2Layout.createSequentialGroup()                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)                                    .addComponent(jLabel3)                                    .addComponent(jLabel4)                                    .addComponent(jLabel7)                                    .addComponent(jLabel5))                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)                                    .addGroup(jPanel2Layout.createSequentialGroup()                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 16, Short.MAX_VALUE)                                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)                                            .addComponent(jSpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)                                            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)                                                .addComponent(jTextField3, javax.swing.GroupLayout.Alignment.LEADING)                                                .addComponent(jTextField2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 202, Short.MAX_VALUE)                                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()                                                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)                                                        .addComponent(jRadioButton3)                                                        .addComponent(jRadioButton1))                                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)                                                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)                                                        .addComponent(jRadioButton4)                                                        .addComponent(jRadioButton2))))))                                    .addGroup(jPanel2Layout.createSequentialGroup()                                        .addGap(18, 18, 18)                                        .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))                            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)                                .addComponent(jLabel8, javax.swing.GroupLayout.Alignment.LEADING)                                .addGroup(jPanel2Layout.createSequentialGroup()                                    .addComponent(jLabel6)                                    .addGap(60, 60, 60))))                        .addGap(79, 79, 79))                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()                        .addComponent(jButton1)                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)                        .addComponent(jButton2)                        .addGap(22, 22, 22))                    .addGroup(jPanel2Layout.createSequentialGroup()                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 261, javax.swing.GroupLayout.PREFERRED_SIZE)                        .addContainerGap(60, Short.MAX_VALUE))                    .addGroup(jPanel2Layout.createSequentialGroup()                        .addComponent(jLabel9)                        .addContainerGap(285, Short.MAX_VALUE))))        );        jPanel2Layout.setVerticalGroup(            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGroup(jPanel2Layout.createSequentialGroup()                .addContainerGap()                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)                    .addComponent(jLabel3)                    .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)                    .addComponent(jLabel4)                    .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

⌨️ 快捷键说明

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