【Java开源代码栏目提醒】:网学会员为广大网友收集整理了,TextEditFrame.java,希望对大家有所帮助!
/**
* Copyright (c) 1996-2004 Borland Software Corporation. All Rights Reserved.
*
* This SOURCE CODE FILE, which has been provided by Borland Software as part
* of a Borland Software product for use ONLY by licensed users of the product,
* includes CONFIDENTIAL and PROPRIETARY information of Borland Software.
*
* USE OF THIS SOFTWARE IS GOVERNED BY THE TERMS AND CONDITIONS
* OF THE LICENSE STATEMENT AND LIMITED WARRANTY FURNISHED WITH
* THE PRODUCT.
*
* IN PARTICULAR, YOU WILL INDEMNIFY AND HOLD BORLAND SOFTWARE, ITS
* RELATED COMPANIES AND ITS SUPPLIERS, HARMLESS FROM AND AGAINST ANY
* CLAIMS OR LIABILITIES ARISING OUT OF THE USE, REPRODUCTION, OR
* DISTRIBUTION OF YOUR PROGRAMS, INCLUDING ANY CLAIMS OR LIABILITIES
* ARISING OUT OF OR RESULTING FROM THE USE, MODIFICATION, OR
* DISTRIBUTION OF PROGRAMS OR FILES CREATED FROM, BASED ON, AND/OR
* DERIVED FROM THIS SOURCE CODE FILE.
*/
//------------------------------------------------------------------------------
// Copyright (c) 1996-2004 Borland Software Corporation. All Rights Reserved.
//------------------------------------------------------------------------------
package com.borland.samples.texteditor;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.borland.dbswing.*;
import java.io.*;
import javax.swing.text.*;
import javax.swing.event.*;
public class TextEditFrame extends JFrame {
IntlSwingSupport intlSwingSupport1 = new IntlSwingSupport();
JPanel contentPane;
JMenuBar menuBar1 = new JMenuBar();
JMenu menuFile = new JMenu();
JMenuItem menuFileExit = new JMenuItem();
JMenu menuHelp = new JMenu();
JMenuItem menuHelpAbout = new JMenuItem();
JToolBar toolBar = new JToolBar();
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
JButton jButton3 = new JButton();
ImageIcon image1;
ImageIcon image2;
ImageIcon image3;
JLabel statusBar = new JLabel();
BorderLayout borderLayout1 = new BorderLayout();
JScrollPane jScrollPane1 = new JScrollPane();
JTextArea jTextArea1 = new JTextArea();
JMenuItem jMenuItem1 = new JMenuItem();
JMenuItem jMenuItem2 = new JMenuItem();
JMenuItem jMenuItem3 = new JMenuItem();
JMenuItem jMenuItem4 = new JMenuItem();
FontChooser fontChooser1 = new FontChooser();
JMenu jMenu1 = new JMenu();
JMenuItem jMenuItem5 = new JMenuItem();
JMenuItem jMenuItem6 = new JMenuItem();
JMenuItem jMenuItem7 = new JMenuItem();
JFileChooser jFileChooser1 = new JFileChooser();
String currFileName = null; // Full path with filename. null means new/untitled.
boolean dirty = false;
Document document1;
DBTextDataBinder dBTextDataBinder1 = new DBTextDataBinder(); // True means modified text.
/**
* Construct the frame
*/
public TextEditFrame() {
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try {
jbInit();
updateCaption();
}
catch(Exception e) {
e.printStackTrace();
}
}
/**
* Component initialization
*
* @throws Exception exception
*/
private void jbInit() throws Exception {
image1 = new ImageIcon(TextEditFrame.class.getResource("openFile.gif"));
image2 = new ImageIcon(TextEditFrame.class.getResource("closeFile.gif"));
image3 = new ImageIcon(TextEditFrame.class.getResource("help.gif"));
contentPane = (JPanel) this.getContentPane();
document1 = jTextArea1.getDocument();
contentPane.setLayout(borderLayout1);
this.setSize(new Dimension(400, 300));
this.setTitle("Text Editor");
statusBar.setText(" ");
menuFile.setText("File");
menuFileExit.setText("Exit");
menuFileExit.addActionListener(new TextEditFrame_menuFileExit_ActionAdapter(this));
menuHelp.setText("Help");
menuHelpAbout.setText("About");
menuHelpAbout.addActionListener(new TextEditFrame_menuHelpAbout