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

📄 mainjframe.java

📁 一个包含简单查询的JAVA记事本 内容简单 初学者适用
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* * MainJFrame.java * * Created on 2007年9月7日, 下午3:41 */package note;import java.awt.Rectangle;import java.io.File;import javax.swing.ButtonGroup;import javax.swing.filechooser.FileFilter;import java.io.FileNotFoundException;import java.io.PrintWriter;import java.util.Scanner;import javax.swing.JFileChooser;/** * * @author  soft01 */public class MainJFrame extends javax.swing.JFrame {    private int start = 0;//文件    private int end = 0;//文件    private ButtonGroup buttonGroup;//互斥组    private boolean upOrDown;//向上向下    /** Creates new form MainJFrame */    public MainJFrame () {        initComponents ();        this.setSize (400,500);        this.setMaximizedBounds (new Rectangle(50, 50, 1024, 768));                buttonGroup = new ButtonGroup();        buttonGroup.add (jRadioButton1);        buttonGroup.add (jRadioButton2);    }        /** 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=" 生成的代码 ">//GEN-BEGIN:initComponents    private void initComponents() {        jDialog1 = new javax.swing.JDialog();        jLabel1 = new javax.swing.JLabel();        jTextField1 = new javax.swing.JTextField();        jCheckBox1 = new javax.swing.JCheckBox();        jCheckBox2 = new javax.swing.JCheckBox();        jRadioButton1 = new javax.swing.JRadioButton();        jRadioButton2 = new javax.swing.JRadioButton();        jButton1 = new javax.swing.JButton();        jButton2 = new javax.swing.JButton();        jScrollPane1 = new javax.swing.JScrollPane();        jEditorPane1 = new javax.swing.JEditorPane();        jMenuBar1 = new javax.swing.JMenuBar();        jMenu1 = new javax.swing.JMenu();        jMenuItem1 = new javax.swing.JMenuItem();        jMenuItem2 = new javax.swing.JMenuItem();        jMenuItem3 = new javax.swing.JMenuItem();        jMenu2 = new javax.swing.JMenu();        jMenuItem4 = new javax.swing.JMenuItem();        jDialog1.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);        jDialog1.setAlwaysOnTop(true);        jDialog1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));        jDialog1.getAccessibleContext().setAccessibleParent(this);        jLabel1.setText("\u641c\u7d22");        jTextField1.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jTextField1ActionPerformed(evt);            }        });        jTextField1.getAccessibleContext().setAccessibleParent(this);        jCheckBox1.setText("\u4e0d\u533a\u5206\u5927\u5c0f\u5199");        jCheckBox1.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));        jCheckBox1.setMargin(new java.awt.Insets(0, 0, 0, 0));        jCheckBox2.setText("\u5339\u914d\u6574\u4e2a\u5355\u8bcd");        jCheckBox2.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));        jCheckBox2.setMargin(new java.awt.Insets(0, 0, 0, 0));        jRadioButton1.setText("\u5411\u4e0a\u641c\u7d22");        jRadioButton1.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));        jRadioButton1.setMargin(new java.awt.Insets(0, 0, 0, 0));        jRadioButton1.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jRadioButton1ActionPerformed(evt);            }        });        jRadioButton2.setSelected(true);        jRadioButton2.setText("\u5411\u4e0b\u641c\u7d22");        jRadioButton2.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));        jRadioButton2.setMargin(new java.awt.Insets(0, 0, 0, 0));        jRadioButton2.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jRadioButton2ActionPerformed(evt);            }        });        jButton1.setText("\u786e\u5b9a");        jButton1.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jButton1ActionPerformed(evt);            }        });        jButton2.setText("\u5173\u95ed");        jButton2.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jButton2ActionPerformed(evt);            }        });        org.jdesktop.layout.GroupLayout jDialog1Layout = new org.jdesktop.layout.GroupLayout(jDialog1.getContentPane());        jDialog1.getContentPane().setLayout(jDialog1Layout);        jDialog1Layout.setHorizontalGroup(            jDialog1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)            .add(jDialog1Layout.createSequentialGroup()                .add(jDialog1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)                    .add(jDialog1Layout.createSequentialGroup()                        .add(30, 30, 30)                        .add(jLabel1)                        .add(14, 14, 14)                        .add(jDialog1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)                            .add(jCheckBox2)                            .add(jDialog1Layout.createSequentialGroup()                                .add(jCheckBox1)                                .add(62, 62, 62)                                .add(jDialog1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)                                    .add(jRadioButton1)                                    .add(jRadioButton2)))                            .add(jTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 290, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))                    .add(jDialog1Layout.createSequentialGroup()                        .add(84, 84, 84)                        .add(jButton1)                        .add(67, 67, 67)                        .add(jButton2)))                .addContainerGap(24, Short.MAX_VALUE))        );        jDialog1Layout.setVerticalGroup(            jDialog1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)            .add(jDialog1Layout.createSequentialGroup()                .addContainerGap()                .add(jDialog1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)                    .add(jLabel1)                    .add(jTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))                .add(21, 21, 21)                .add(jDialog1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)                    .add(jDialog1Layout.createSequentialGroup()                        .add(jCheckBox2)                        .add(11, 11, 11)                        .add(jCheckBox1))                    .add(jDialog1Layout.createSequentialGroup()                        .add(jRadioButton1)                        .add(5, 5, 5)                        .add(jRadioButton2)))                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 25, Short.MAX_VALUE)                .add(jDialog1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)                    .add(jButton1)                    .add(jButton2))                .addContainerGap())        );        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);        setMaximizedBounds(new java.awt.Rectangle(0, 0, 400, 500));        jEditorPane1.addCaretListener(new javax.swing.event.CaretListener() {            public void caretUpdate(javax.swing.event.CaretEvent evt) {                jEditorPane1CaretUpdate(evt);            }        });        jScrollPane1.setViewportView(jEditorPane1);        getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER);

⌨️ 快捷键说明

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