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

📄 texteditframe.java~8~

📁 java GUI用户界面程序
💻 JAVA~8~
📖 第 1 页 / 共 2 页
字号:
        int value = JOptionPane.showConfirmDialog(this, "Save changes?",
                                                  "Text Edit",
                                                  JOptionPane.
                                                  YES_NO_CANCEL_OPTION);

        switch (value)
        {
            case JOptionPane.YES_OPTION:

                // Yes, please save changes
                return saveFile();
            case JOptionPane.NO_OPTION:

                // No, abandon edits; that is, return true without saving
                return true;
            case JOptionPane.CANCEL_OPTION:
            default:

                // Cancel the dialog without saving or closing
                return false;
        }
    }

    public void jMenuItem3_actionPerformed(ActionEvent e)
    {
        saveFile();
    }

    public void jMenuItem4_actionPerformed(ActionEvent e)
    {
        saveAsFile();
    }

    public void jButton1_actionPerformed(ActionEvent e)
    {
        fileOpen();
    }

    void fileOpen()
    {
        if (!okToAbandon())
        {
            return;
        }
        // Use the OPEN version of the dialog, test return for Approve/Cancel
        if (JFileChooser.APPROVE_OPTION == jFileChooser1.showOpenDialog(this))
        {
            // Call openFile to attempt to load the text from file into TextArea
            openFile(jFileChooser1.getSelectedFile().getPath());
        }
        this.repaint();

    }

    void helpAbout()
    {
        TextEditFrame_AboutBox dlg = new TextEditFrame_AboutBox(this);
        Dimension dlgSize = dlg.getPreferredSize();
        Dimension frmSize = getSize();
        Point loc = getLocation();
        dlg.setLocation( (frmSize.width - dlgSize.width) / 2 + loc.x,
                        (frmSize.height - dlgSize.height) / 2 + loc.y);
        dlg.setModal(true);
        dlg.pack();
        dlg.show();

    }

    public void jButton3_actionPerformed(ActionEvent e)
    {
        helpAbout();
    }

    public void jButton2_actionPerformed(ActionEvent e)
    {
        saveFile();
    }

    public void document1_changedUpdate(DocumentEvent e)
    {
        dirty = true;
    }

    public void document1_insertUpdate(DocumentEvent e)
    {
        dirty = true;
    }

    public void document1_removeUpdate(DocumentEvent e)
    {
        dirty = true;
    }

    public void this_windowClosing(WindowEvent e)
    {
        if (okToAbandon())
        {
            System.exit(0);
        }
    }

}

class TextEditFrame_document1_documentAdapter
    implements DocumentListener
{
    private TextEditFrame adaptee;
    TextEditFrame_document1_documentAdapter(TextEditFrame adaptee)
    {
        this.adaptee = adaptee;
    }

    public void changedUpdate(DocumentEvent e)
    {
        adaptee.document1_changedUpdate(e);
    }

    public void insertUpdate(DocumentEvent e)
    {
        adaptee.document1_insertUpdate(e);
    }

    public void removeUpdate(DocumentEvent e)
    {
        adaptee.document1_removeUpdate(e);

    }
}

class TextEditFrame_jButton2_actionAdapter
    implements ActionListener
{
    private TextEditFrame adaptee;
    TextEditFrame_jButton2_actionAdapter(TextEditFrame adaptee)
    {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e)
    {

        adaptee.jButton2_actionPerformed(e);
    }
}

class TextEditFrame_this_windowAdapter
    extends WindowAdapter
{
    private TextEditFrame adaptee;
    TextEditFrame_this_windowAdapter(TextEditFrame adaptee)
    {
        this.adaptee = adaptee;
    }

    public void windowClosing(WindowEvent e)
    {
        adaptee.this_windowClosing(e);
    }
}

class TextEditFrame_jMenuItem2_actionAdapter
    implements ActionListener
{
    private TextEditFrame adaptee;
    TextEditFrame_jMenuItem2_actionAdapter(TextEditFrame adaptee)
    {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e)
    {
        adaptee.jMenuItem2_actionPerformed(e);
    }
}

class TextEditFrame_jButton3_actionAdapter
    implements ActionListener
{
    private TextEditFrame adaptee;
    TextEditFrame_jButton3_actionAdapter(TextEditFrame adaptee)
    {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e)
    {
        adaptee.jButton3_actionPerformed(e);
    }
}

class TextEditFrame_jMenuItem3_actionAdapter
    implements ActionListener
{
    private TextEditFrame adaptee;
    TextEditFrame_jMenuItem3_actionAdapter(TextEditFrame adaptee)
    {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e)
    {
        adaptee.jMenuItem3_actionPerformed(e);
    }
}

class TextEditFrame_jMenuItem4_actionAdapter
    implements ActionListener
{
    private TextEditFrame adaptee;
    TextEditFrame_jMenuItem4_actionAdapter(TextEditFrame adaptee)
    {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e)
    {
        adaptee.jMenuItem4_actionPerformed(e);
    }
}

class TextEditFrame_jButton1_actionAdapter
    implements ActionListener
{
    private TextEditFrame adaptee;
    TextEditFrame_jButton1_actionAdapter(TextEditFrame adaptee)
    {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e)
    {
        adaptee.jButton1_actionPerformed(e);
    }
}

class TextEditFrame_jMenuItem6_actionAdapter
    implements ActionListener
{
    private TextEditFrame adaptee;
    TextEditFrame_jMenuItem6_actionAdapter(TextEditFrame adaptee)
    {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e)
    {
        adaptee.jMenuItem6_actionPerformed(e);
    }
}

class TextEditFrame_jMenuItem5_actionAdapter
    implements ActionListener
{
    private TextEditFrame adaptee;
    TextEditFrame_jMenuItem5_actionAdapter(TextEditFrame adaptee)
    {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e)
    {
        adaptee.jMenuItem5_actionPerformed(e);
    }
}

class TextEditFrame_jMenuItem7_actionAdapter
    implements ActionListener
{
    private TextEditFrame adaptee;
    TextEditFrame_jMenuItem7_actionAdapter(TextEditFrame adaptee)
    {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e)
    {
        adaptee.jMenuItem7_actionPerformed(e);
    }
}

class TextEditFrame_jMenuItem1_actionAdapter
    implements ActionListener
{
    private TextEditFrame adaptee;
    TextEditFrame_jMenuItem1_actionAdapter(TextEditFrame adaptee)
    {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e)
    {

        adaptee.jMenuItem1_actionPerformed(e);
    }
}

class TextEditFrame_jMenuFileExit_ActionAdapter
    implements ActionListener
{
    TextEditFrame adaptee;

    TextEditFrame_jMenuFileExit_ActionAdapter(TextEditFrame adaptee)
    {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent actionEvent)
    {
        adaptee.jMenuFileExit_actionPerformed(actionEvent);
    }
}

class TextEditFrame_jMenuHelpAbout_ActionAdapter
    implements ActionListener
{
    TextEditFrame adaptee;

    TextEditFrame_jMenuHelpAbout_ActionAdapter(TextEditFrame adaptee)
    {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent actionEvent)
    {
        adaptee.jMenuHelpAbout_actionPerformed(actionEvent);
    }
}

⌨️ 快捷键说明

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