/** SummaryDialog.java** Created on June 9, 1999, 10:56 PM** Modification Log:* 1.00 09th Jun 1999 Tanmay Original version.* 2.00 16th Dec 2001 Tanmay Moved over to Java Swing.*-----------------------------------------------------------------------------------------* 10th Sep 2003 Tanmay Moved to SourceForge (http://classeditor.sourceforge.net)*-----------------------------------------------------------------------------------------*/package gui;import guihelper.JavaFileFilter;import java.io.*;/*** Dialog to show summary of class files.* <br><br>** @author Tanmay K. Mohapatra* @version 2.00, 16th December, 2001*/public class SummaryDialog extends javax.swing.JDialog {/** Creates new form SummaryDialog */public SummaryDialog(java.awt.Frame parent, boolean modal) {super(parent, modal);initComponents();setClassFileSummary("Working... Please wait.");}public void setClassFileSummary(String sText) {txtSumary.setText(sText);}/** 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.*/private void initComponents() {//GEN-BEGIN:initComponentsjava.awt.GridBagConstraints gridBagConstraints;jScrollPane1 = new javax.swing.JScrollPane();txtSumary = new javax.swing.JTextArea();btnSaveAs = new javax.swing.JButton();btnClose = new javax.swing.JButton();getContentPane().setLayout(new java.awt.GridBagLayout());addWindowListener(new java.awt.event.WindowAdapter() {public void windowClosing(java.awt.event.WindowEvent evt) {closeDialog(evt);}});txtSumary.setWrapStyleWord(true);txtSumary.setEditable(false);txtSumary.setColumns(40);txtSumary.setTabSize(2);txtSumary.setRows(20);jScrollPane1.setViewportView(txtSumary);gridBagConstraints = new java.awt.GridBagConstraints();gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;gridBagConstraints.weightx = 1.0;gridBagConstraints.weighty = 1.0;getContentPane().add(jScrollPane1, gridBagConstraints);btnSaveAs.setText("Save As");btnSaveAs.addActionListener(new java.awt.event.ActionListener() {public void actionPerformed(java.awt.event.ActionEvent evt) {btnSaveAsActionPerformed(evt);}});gridBagConstraints = new java.awt.GridBagConstraints();gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;getContentPane().add(btnSaveAs, gridBagConstraints);btnClose.setText("Close");btnClose.addActionListener(new java.awt.event.ActionListener() {public void actionPerformed(java.awt.event.ActionEvent evt) {btnCloseActionPerformed(evt);}});gridBagConstraints = new java.awt.GridBagConstraints();gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;getContentPane().add(btnClose, gridBagConstraints);pack();}//GEN-END:initComponentsprivate void btnSaveAsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveAsActionPerformedString sFileName;FileWriter fileWriter;javax.swing.JFileChooser newFileChooser = new javax.swing.JFileChooser();newFileChooser.addChoosableFileFilter(new JavaFileFilter("html", "HTML Files"));newFileChooser.addChoosableFileFilter(new JavaFileFilter("doc", "Document Files"));newFileChooser.addChoosableFileFilter(new JavaFileFilter("txt", "Text Files"));int returnVal = newFileChooser.showSaveDialog(this);if(returnVal != javax.swing.JFileChooser.APPROVE_OPTION) {return;}sFileName = newFileChooser.getSelectedFile().getAbsolutePath();try {fileWriter = new FileWriter(sFileName, false);fileWriter.write(txtSumary.getText());fileWriter.close();}catch (FileNotFoundException fnfe) {fnfe.printStackTrace();return;}catch (IOException ioe) {ioe.printStackTrace();return;}}//GEN-LAST:event_btnSaveAsActionPerformedprivate void btnCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCloseActionPerformed// Add your handling code here:closeDialog(null);}//GEN-LAST:event_btnCloseActionPerformed/** Closes the dialog */private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialogsetVisible(false);dispose();}//GEN-LAST:event_closeDialog// Variables declaration - do not modify//GEN-BEGIN:variablesprivate javax.swing.JButton btnClose;private javax.swing.JButton btnSaveAs;private javax.swing.JScrollPane jScrollPane1;private javax.swing.JTextArea txtSumary;// End of variables declaration//GEN-END:variables}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。