PageRenderTime 119ms CodeModel.GetById 111ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/jEdit/tags/jedit-4-0-pre5/org/gjt/sp/jedit/gui/BeanShellErrorDialog.java

#
Java | 101 lines | 58 code | 15 blank | 28 comment | 0 complexity | 8ded2289a6af319d02aa7321e1020484 MD5 | raw file
  1/*
  2 * BeanShellErrorDialog.java - BeanShell execution error dialog box
  3 * :tabSize=8:indentSize=8:noTabs=false:
  4 * :folding=explicit:collapseFolds=1:
  5 *
  6 * Copyright (C) 2001 Slava Pestov
  7 *
  8 * This program is free software; you can redistribute it and/or
  9 * modify it under the terms of the GNU General Public License
 10 * as published by the Free Software Foundation; either version 2
 11 * of the License, or any later version.
 12 *
 13 * This program is distributed in the hope that it will be useful,
 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 16 * GNU General Public License for more details.
 17 *
 18 * You should have received a copy of the GNU General Public License
 19 * along with this program; if not, write to the Free Software
 20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 21 */
 22
 23package org.gjt.sp.jedit.gui;
 24
 25//{{{ Imports
 26import javax.swing.*;
 27import javax.swing.border.*;
 28import java.awt.*;
 29import java.awt.event.*;
 30import org.gjt.sp.jedit.*;
 31//}}}
 32
 33public class BeanShellErrorDialog extends EnhancedDialog
 34{
 35	//{{{ BeanShellErrorDialog constructor
 36	public BeanShellErrorDialog(View view, String message)
 37	{
 38		super(view,jEdit.getProperty("beanshell-error.title"),true);
 39
 40		JPanel content = new JPanel(new BorderLayout(12,12));
 41		content.setBorder(new EmptyBorder(12,12,12,12));
 42		setContentPane(content);
 43
 44		Box iconBox = new Box(BoxLayout.Y_AXIS);
 45		iconBox.add(new JLabel(UIManager.getIcon("OptionPane.errorIcon")));
 46		iconBox.add(Box.createGlue());
 47		content.add(BorderLayout.WEST,iconBox);
 48
 49		JPanel centerPanel = new JPanel(new BorderLayout());
 50
 51		JPanel caption = new JPanel(new GridLayout(2,1,3,3));
 52		caption.setBorder(new EmptyBorder(0,0,6,0));
 53		caption.add(new JLabel(jEdit.getProperty("beanshell-error.message.1")));
 54		caption.add(new JLabel(jEdit.getProperty("beanshell-error.message.2")));
 55		centerPanel.add(BorderLayout.NORTH,caption);
 56
 57		JTextArea textArea = new JTextArea(10,60);
 58		textArea.setText(message);
 59		textArea.setLineWrap(true);
 60		textArea.setWrapStyleWord(true);
 61		centerPanel.add(BorderLayout.CENTER,new JScrollPane(textArea));
 62
 63		content.add(BorderLayout.CENTER,centerPanel);
 64
 65		Box buttons = new Box(BoxLayout.X_AXIS);
 66		buttons.add(Box.createGlue());
 67		JButton ok = new JButton(jEdit.getProperty("common.ok"));
 68		ok.addActionListener(new ActionHandler());
 69		buttons.add(ok);
 70		buttons.add(Box.createGlue());
 71		content.add(BorderLayout.SOUTH,buttons);
 72
 73		getRootPane().setDefaultButton(ok);
 74
 75		pack();
 76		setLocationRelativeTo(view);
 77		show();
 78	} //}}}
 79
 80	//{{{ ok() method
 81	public void ok()
 82	{
 83		dispose();
 84	} //}}}
 85
 86	//{{{ cancel() method
 87	public void cancel()
 88	{
 89		dispose();
 90	} //}}}
 91
 92	//{{{ ActionHandler class
 93	class ActionHandler implements ActionListener
 94	{
 95		//{{{ actionPerformed() method
 96		public void actionPerformed(ActionEvent evt)
 97		{
 98			dispose();
 99		} //}}}
100	} //}}}
101}