📄 verysimpleerror.java
字号:
/* * VerySimpleError * * Created: Thu Apr 12 13:07:13 2001 * $Revision$ * Modified: $Date$ * * Author: Jun Inamori * E-mail: j-office@osa.att.ne.jp * * Copyright (c) 1998-2000 Jun Inamori * 2-24-7 Shinsenri-Kitamachi, Toyonaka , * Osaka 560-0081 , Japan. * All rights reserved. * */package com.oopreserch.example;import java.awt.*;import java.awt.event.*;import javax.swing.*;import com.oopreserch.xml.util.XMLDialog_1_0;/** * @author Jun Inamori * * This class represents the dialog, which will appear * when the user tries to exit the program without saving * the modified text. This dialog will also appear when * the error happens. * Because we have already prepared the GUI in XML, * this class should extend XMLDialog_1_0. */public class VerySimpleError extends XMLDialog_1_0{ private static JTextArea text=null; public VerySimpleError() { // true means the modal dialog. super(true); // Based on the Locale of the runtime environment, // this method reads the property resource file. // It may be VerySimpleError.properties, // VerySimpleError_ja.properties, // VerySimpleError_fr.properties or others. // Each property resource file points the XML file // for this GUI, i.e. the localized XML for the locale // can be prepared. // Parse the XML file pointed by the "xml_url" property // and place the Components on the JDialog. readXML(); // After the XML file is parsed, all the Components // on GUI are accessible from "gui" dictionary. // To add the required ActionListener to each // Component, we should define "iniParts()" method. iniParts(); } public void iniParts(){ // To display the various messages, we need the // reference to JTextArea. // It is available in "gui" dictionary. text=(JTextArea)(gui.getGUI("message")); // To add the ActionListener on JButton below // JTextArea, we get it from "gui" dictionary. JButton close_b=(JButton)(gui.getGUI("diag_close")); close_b.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ hide(); } }); } public void showMessage(String title,String mess){ setTitle(title); text.setText(mess); // The method of XMLDialog_1_0. // Open this dialog. openDiag(); }} //End of : VerySimpleError
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -