PageRenderTime 29ms CodeModel.GetById 1ms RepoModel.GetById 0ms 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
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
  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. package org.gjt.sp.jedit.gui;
  23. //{{{ Imports
  24. import javax.swing.*;
  25. import javax.swing.border.*;
  26. import java.awt.*;
  27. import java.awt.event.*;
  28. import org.gjt.sp.jedit.*;
  29. //}}}
  30. public class BeanShellErrorDialog extends EnhancedDialog
  31. {
  32. //{{{ BeanShellErrorDialog constructor
  33. public BeanShellErrorDialog(View view, String message)
  34. {
  35. super(view,jEdit.getProperty("beanshell-error.title"),true);
  36. JPanel content = new JPanel(new BorderLayout(12,12));
  37. content.setBorder(new EmptyBorder(12,12,12,12));
  38. setContentPane(content);
  39. Box iconBox = new Box(BoxLayout.Y_AXIS);
  40. iconBox.add(new JLabel(UIManager.getIcon("OptionPane.errorIcon")));
  41. iconBox.add(Box.createGlue());
  42. content.add(BorderLayout.WEST,iconBox);
  43. JPanel centerPanel = new JPanel(new BorderLayout());
  44. JPanel caption = new JPanel(new GridLayout(2,1,3,3));
  45. caption.setBorder(new EmptyBorder(0,0,6,0));
  46. caption.add(new JLabel(jEdit.getProperty("beanshell-error.message.1")));
  47. caption.add(new JLabel(jEdit.getProperty("beanshell-error.message.2")));
  48. centerPanel.add(BorderLayout.NORTH,caption);
  49. JTextArea textArea = new JTextArea(10,60);
  50. textArea.setText(message);
  51. textArea.setLineWrap(true);
  52. textArea.setWrapStyleWord(true);
  53. centerPanel.add(BorderLayout.CENTER,new JScrollPane(textArea));
  54. content.add(BorderLayout.CENTER,centerPanel);
  55. Box buttons = new Box(BoxLayout.X_AXIS);
  56. buttons.add(Box.createGlue());
  57. JButton ok = new JButton(jEdit.getProperty("common.ok"));
  58. ok.addActionListener(new ActionHandler());
  59. buttons.add(ok);
  60. buttons.add(Box.createGlue());
  61. content.add(BorderLayout.SOUTH,buttons);
  62. getRootPane().setDefaultButton(ok);
  63. pack();
  64. setLocationRelativeTo(view);
  65. show();
  66. } //}}}
  67. //{{{ ok() method
  68. public void ok()
  69. {
  70. dispose();
  71. } //}}}
  72. //{{{ cancel() method
  73. public void cancel()
  74. {
  75. dispose();
  76. } //}}}
  77. //{{{ ActionHandler class
  78. class ActionHandler implements ActionListener
  79. {
  80. //{{{ actionPerformed() method
  81. public void actionPerformed(ActionEvent evt)
  82. {
  83. dispose();
  84. } //}}}
  85. } //}}}
  86. }