View Javadoc
1 package net.sourceforge.pmd.util.viewer.gui; 2 3 import net.sourceforge.pmd.util.viewer.util.NLS; 4 5 import javax.swing.BorderFactory; 6 import javax.swing.JButton; 7 import javax.swing.JDialog; 8 import javax.swing.JFrame; 9 import javax.swing.JPanel; 10 import javax.swing.JScrollPane; 11 import javax.swing.JTextArea; 12 import java.awt.BorderLayout; 13 import java.awt.FlowLayout; 14 import java.awt.event.ActionEvent; 15 import java.awt.event.ActionListener; 16 17 18 /*** 19 * handles parsing exceptions 20 * 21 * @author Boris Gruschko ( boris at gruschko.org ) 22 * @version $Id: ParseExceptionHandler.java,v 1.2 2003/09/23 20:51:06 tomcopeland Exp $ 23 */ 24 public class ParseExceptionHandler 25 extends JDialog 26 implements ActionListener 27 { 28 private Exception exc; 29 private JTextArea errorArea; 30 private JButton okBtn; 31 32 /*** 33 * creates the dialog 34 * 35 * @param parent dialog's parent 36 * @param exc exception to be handled 37 */ 38 public ParseExceptionHandler( JFrame parent, Exception exc ) 39 { 40 super( parent, NLS.nls( "COMPILE_ERROR.DIALOG.TITLE" ), true ); 41 42 this.exc = exc; 43 44 init( ); 45 } 46 47 private void init( ) 48 { 49 errorArea = new JTextArea( ); 50 errorArea.setEditable( false ); 51 errorArea.setText( exc.getMessage( ) + "\n" ); 52 53 getContentPane( ).setLayout( new BorderLayout( ) ); 54 55 JPanel messagePanel = new JPanel( new BorderLayout( ) ); 56 57 messagePanel.setBorder( 58 BorderFactory.createCompoundBorder( 59 BorderFactory.createRaisedBevelBorder( ), 60 BorderFactory.createTitledBorder( 61 BorderFactory.createEtchedBorder( ), 62 NLS.nls( "COMPILE_ERROR.PANEL.TITLE" ) ) ) ); 63 64 messagePanel.add( new JScrollPane( errorArea ), BorderLayout.CENTER ); 65 66 getContentPane( ).add( messagePanel, BorderLayout.CENTER ); 67 68 JPanel btnPane = new JPanel( new FlowLayout( FlowLayout.RIGHT ) ); 69 70 okBtn = new JButton( NLS.nls( "COMPILE_ERROR.OK_BUTTON.CAPTION" ) ); 71 72 okBtn.addActionListener( this ); 73 74 btnPane.add( okBtn ); 75 76 getRootPane( ).setDefaultButton( okBtn ); 77 78 getContentPane( ).add( btnPane, BorderLayout.SOUTH ); 79 80 pack( ); 81 82 setLocationRelativeTo( getParent( ) ); 83 84 setVisible( true ); 85 } 86 87 /*** 88 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) 89 */ 90 public void actionPerformed( ActionEvent e ) 91 { 92 if ( e.getSource( ) == okBtn ) 93 { 94 dispose( ); 95 } 96 } 97 } 98 99 100 /* 101 * $Log: ParseExceptionHandler.java,v $ 102 * Revision 1.2 2003/09/23 20:51:06 tomcopeland 103 * Cleaned up imports 104 * 105 * Revision 1.1 2003/09/23 20:32:42 tomcopeland 106 * Added Boris Gruschko's new AST/XPath viewer 107 * 108 * Revision 1.1 2003/09/24 01:33:03 bgr 109 * moved to a new package 110 * 111 * Revision 1.2 2003/09/24 00:40:35 bgr 112 * evaluation results browsing added 113 * 114 * Revision 1.1 2003/09/22 05:21:54 bgr 115 * initial commit 116 * 117 */

This page was automatically generated by Maven