|  |  | @ -1,21 +1,32 @@ | 
			
		
	
		
		
			
				
					
					|  |  |  | package siprp.medicina.processo.mail; |  |  |  | package siprp.medicina.processo.mail; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import info.clearthought.layout.TableLayout; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import info.clearthought.layout.TableLayoutConstraints; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.awt.BorderLayout; |  |  |  | import java.awt.BorderLayout; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import java.awt.Color; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.awt.FlowLayout; |  |  |  | import java.awt.FlowLayout; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.awt.GridLayout; |  |  |  | import java.awt.GridLayout; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.awt.event.ActionEvent; |  |  |  | import java.awt.event.ActionEvent; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.awt.event.ActionListener; |  |  |  | import java.awt.event.ActionListener; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import java.awt.event.ItemEvent; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import java.awt.event.ItemListener; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.awt.event.WindowAdapter; |  |  |  | import java.awt.event.WindowAdapter; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.awt.event.WindowEvent; |  |  |  | import java.awt.event.WindowEvent; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.Arrays; |  |  |  | import java.util.Arrays; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.Comparator; |  |  |  | import java.util.Comparator; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.Vector; |  |  |  | import java.util.Vector; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import javax.swing.AbstractAction; | 
			
		
	
		
		
			
				
					
					|  |  |  | import javax.swing.Action; |  |  |  | import javax.swing.Action; | 
			
		
	
		
		
			
				
					
					|  |  |  | import javax.swing.ActionMap; |  |  |  | import javax.swing.ActionMap; | 
			
		
	
		
		
			
				
					
					|  |  |  | import javax.swing.JButton; |  |  |  | import javax.swing.JButton; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import javax.swing.JComboBox; | 
			
		
	
		
		
			
				
					
					|  |  |  | import javax.swing.JFrame; |  |  |  | import javax.swing.JFrame; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import javax.swing.JLabel; | 
			
		
	
		
		
			
				
					
					|  |  |  | import javax.swing.JPanel; |  |  |  | import javax.swing.JPanel; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import javax.swing.JScrollPane; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import javax.swing.JTextField; | 
			
		
	
		
		
			
				
					
					|  |  |  | import javax.swing.JTextPane; |  |  |  | import javax.swing.JTextPane; | 
			
		
	
		
		
			
				
					
					|  |  |  | import javax.swing.text.AttributeSet; |  |  |  | import javax.swing.text.AttributeSet; | 
			
		
	
		
		
			
				
					
					|  |  |  | import javax.swing.text.DefaultEditorKit; |  |  |  | import javax.swing.text.DefaultEditorKit; | 
			
		
	
	
		
		
			
				
					|  |  | @ -24,12 +35,19 @@ import javax.swing.text.StyledEditorKit; | 
			
		
	
		
		
			
				
					
					|  |  |  | import javax.swing.text.html.HTMLEditorKit; |  |  |  | import javax.swing.text.html.HTMLEditorKit; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.evolute.utils.images.ImageIconLoader; |  |  |  | import com.evolute.utils.images.ImageIconLoader; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.evolute.utils.tables.BaseTable; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.evolute.utils.tables.VectorTableModel; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | public class MailPanel extends JPanel |  |  |  | public class MailPanel extends JPanel | 
			
		
	
		
		
			
				
					
					|  |  |  | { |  |  |  | { | 
			
		
	
		
		
			
				
					
					|  |  |  | 	protected StyledEditorKit.FontSizeAction FONT_SIZE_ACTIONS[]; |  |  |  | 	protected StyledEditorKit.FontSizeAction FONT_SIZE_ACTIONS[]; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	protected int FONT_SIZES[]; |  |  |  | 	protected int FONT_SIZES[]; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	 |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	protected JTextField toText; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	protected JTextField bccText; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	protected JTextField subjectText; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	protected BaseTable attachmentsTable; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	protected VectorTableModel attachmentsModel; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	protected JTextPane bodyPane; |  |  |  | 	protected JTextPane bodyPane; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	 |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	public static void main( String args[] ) |  |  |  | 	public static void main( String args[] ) | 
			
		
	
	
		
		
			
				
					|  |  | @ -56,6 +74,96 @@ public class MailPanel extends JPanel | 
			
		
	
		
		
			
				
					
					|  |  |  | 	 |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	private void setupComponents() |  |  |  | 	private void setupComponents() | 
			
		
	
		
		
			
				
					
					|  |  |  | 		throws Exception |  |  |  | 		throws Exception | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		setLayout( new BorderLayout() ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		JPanel headerPanel = new JPanel(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		setupHeaderComponents( headerPanel ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		add( headerPanel, BorderLayout.NORTH ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		JPanel htmlPanel = new JPanel(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		setupHTMLComponents( htmlPanel ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		add( htmlPanel, BorderLayout.CENTER ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	private void setupHeaderComponents( JPanel headerPanel ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		throws Exception | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		Action sendAction = new AbstractAction( "send" ){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			/** | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			 *  | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			 */ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			private static final long serialVersionUID = 1L; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			public void actionPerformed( ActionEvent e ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		}; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		JButton sendButton = createButton( sendAction, "siprp/medicina/processo/mail/icons/mail2.png" ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		Action attachAction = new AbstractAction( "attach" ){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			/** | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			 *  | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			 */ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			private static final long serialVersionUID = 1L; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			public void actionPerformed( ActionEvent e ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		}; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		JButton attachButton = createButton( attachAction, "siprp/medicina/processo/mail/icons/mail_attachment.png" ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		Action removeAttachmentAction = new AbstractAction( "remove-attachment" ){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			/** | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			 *  | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			 */ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			private static final long serialVersionUID = 1L; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			public void actionPerformed( ActionEvent e ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		}; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		JButton removeAttachmentButton = createButton( removeAttachmentAction, "siprp/medicina/processo/mail/icons/delete2.png" ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		JPanel buttonPanel = new JPanel();		 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		buttonPanel.setLayout( new FlowLayout( FlowLayout.LEFT ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		buttonPanel.add( sendButton ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		buttonPanel.add( attachButton ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		buttonPanel.add( removeAttachmentButton ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		JLabel toLabel = new JLabel( "Para:" ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		toText = new JTextField(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		toText.setEditable( false ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		JLabel bccLabel = new JLabel( "C\u00f3pia:" ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		bccText = new JTextField(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		bccText.setEditable( false ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		JLabel assuntoLabel = new JLabel( "Assunto:" ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		subjectText = new JTextField(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		attachmentsModel = new VectorTableModel( new String[]{ "" } ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		attachmentsTable = new BaseTable( attachmentsModel ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		JScrollPane attachmentsScroll = new JScrollPane( attachmentsTable, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		TableLayout layout =  | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			new TableLayout( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				new double[]{ TableLayoutConstraints.MINIMUM, TableLayoutConstraints.FILL, TableLayoutConstraints.FILL }, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				new double[]{ TableLayoutConstraints.PREFERRED, TableLayoutConstraints.MINIMUM, TableLayoutConstraints.MINIMUM, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 								TableLayoutConstraints.MINIMUM } ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		layout.setHGap( 2 ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		layout.setVGap( 2 ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		headerPanel.setLayout( layout ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		headerPanel.add( buttonPanel, new TableLayoutConstraints( 0, 0, 2, 0 ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		headerPanel.add( toLabel, new TableLayoutConstraints( 0, 1 ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		headerPanel.add( toText, new TableLayoutConstraints( 1, 1 ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		headerPanel.add( attachmentsScroll, new TableLayoutConstraints( 2, 1, 2, 3 ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		headerPanel.add( bccLabel, new TableLayoutConstraints( 0, 2 ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		headerPanel.add( bccText, new TableLayoutConstraints( 1, 2 ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		headerPanel.add( assuntoLabel, new TableLayoutConstraints( 0, 3 ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		headerPanel.add( subjectText, new TableLayoutConstraints( 1, 3 ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	private void setupHTMLComponents( JPanel htmlPanel ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		throws Exception | 
			
		
	
		
		
			
				
					
					|  |  |  | 	{ |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 		HTMLEditorKit kit = new HTMLEditorKit(); |  |  |  | 		HTMLEditorKit kit = new HTMLEditorKit(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		Action actions[] = kit.getActions(); |  |  |  | 		Action actions[] = kit.getActions(); | 
			
		
	
	
		
		
			
				
					|  |  | @ -73,6 +181,10 @@ public class MailPanel extends JPanel | 
			
		
	
		
		
			
				
					
					|  |  |  | 				} |  |  |  | 				} | 
			
		
	
		
		
			
				
					
					|  |  |  | 				fontSizeActions.add( ( StyledEditorKit.FontSizeAction ) actions[ n ] ); |  |  |  | 				fontSizeActions.add( ( StyledEditorKit.FontSizeAction ) actions[ n ] ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 			} |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			else if( str.toLowerCase().indexOf( "font" ) != -1 ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				System.out.println( str ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  | 		} |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  | 		 |  |  |  | 		 | 
			
		
	
		
		
			
				
					
					|  |  |  | 		FONT_SIZE_ACTIONS = fontSizeActions.toArray( new StyledEditorKit.FontSizeAction[ fontSizeActions.size() ] ); |  |  |  | 		FONT_SIZE_ACTIONS = fontSizeActions.toArray( new StyledEditorKit.FontSizeAction[ fontSizeActions.size() ] ); | 
			
		
	
	
		
		
			
				
					|  |  | @ -111,7 +223,7 @@ public class MailPanel extends JPanel | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 			public void actionPerformed( ActionEvent e ) |  |  |  | 			public void actionPerformed( ActionEvent e ) | 
			
		
	
		
		
			
				
					
					|  |  |  | 			{ |  |  |  | 			{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 				bodyPane.requestFocusInWindow(); |  |  |  | 				 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 				int start = bodyPane.getSelectionStart(); |  |  |  | 				int start = bodyPane.getSelectionStart(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 				AttributeSet set = bodyPane.getStyledDocument().getCharacterElement( start ).getAttributes(); |  |  |  | 				AttributeSet set = bodyPane.getStyledDocument().getCharacterElement( start ).getAttributes(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 				int size = StyleConstants.getFontSize( set ); |  |  |  | 				int size = StyleConstants.getFontSize( set ); | 
			
		
	
	
		
		
			
				
					|  |  | @ -123,6 +235,7 @@ public class MailPanel extends JPanel | 
			
		
	
		
		
			
				
					
					|  |  |  | 						break; |  |  |  | 						break; | 
			
		
	
		
		
			
				
					
					|  |  |  | 					} |  |  |  | 					} | 
			
		
	
		
		
			
				
					
					|  |  |  | 				} |  |  |  | 				} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				bodyPane.requestFocusInWindow(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 			} |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  | 		};  |  |  |  | 		};  | 
			
		
	
		
		
			
				
					
					|  |  |  | 		Action fontSmallerAction =  |  |  |  | 		Action fontSmallerAction =  | 
			
		
	
	
		
		
			
				
					|  |  | @ -134,7 +247,7 @@ public class MailPanel extends JPanel | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 			public void actionPerformed( ActionEvent e ) |  |  |  | 			public void actionPerformed( ActionEvent e ) | 
			
		
	
		
		
			
				
					
					|  |  |  | 			{ |  |  |  | 			{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 				bodyPane.requestFocusInWindow(); |  |  |  | 				 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 				int start = bodyPane.getSelectionStart(); |  |  |  | 				int start = bodyPane.getSelectionStart(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 				AttributeSet set = bodyPane.getStyledDocument().getCharacterElement( start ).getAttributes(); |  |  |  | 				AttributeSet set = bodyPane.getStyledDocument().getCharacterElement( start ).getAttributes(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 				int size = StyleConstants.getFontSize( set ); |  |  |  | 				int size = StyleConstants.getFontSize( set ); | 
			
		
	
	
		
		
			
				
					|  |  | @ -146,8 +259,51 @@ public class MailPanel extends JPanel | 
			
		
	
		
		
			
				
					
					|  |  |  | 						break; |  |  |  | 						break; | 
			
		
	
		
		
			
				
					
					|  |  |  | 					} |  |  |  | 					} | 
			
		
	
		
		
			
				
					
					|  |  |  | 				} |  |  |  | 				} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				bodyPane.requestFocusInWindow(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		}; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		Action colorAction =  | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			new StyledEditorKit.ForegroundAction( "color", Color.black ){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			/** | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			 *  | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			 */ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			private static final long serialVersionUID = 1L; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			public void actionPerformed( ActionEvent e ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				ColorChooserDialog dialog = new ColorChooserDialog( null, Color.black ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				dialog.setVisible( true ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				Color color = dialog.getColor(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				if( color != null ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 					bodyPane.requestFocusInWindow(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 					Action colorTempAction = new StyledEditorKit.ForegroundAction( "color-temp", color ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 					bodyPane.getActionMap().put( "color-temp", colorTempAction ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 					colorTempAction.actionPerformed( e ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				bodyPane.requestFocusInWindow(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 			} |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  | 		}; |  |  |  | 		}; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		String fontFamilies[] = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		JComboBox fontCombo = new JComboBox(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		for( int n = 0; n < fontFamilies.length; n++ ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			fontCombo.addItem( fontFamilies[ n ] ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		fontCombo.addItemListener( new ItemListener(){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			@Override | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			public void itemStateChanged(ItemEvent e) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				String selected = ( String ) e.getItem(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				Action fontFamilyAction =  | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 					new StyledEditorKit.FontFamilyAction( "font-family-action" , selected ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				bodyPane.getActionMap().put( "font-family-action", fontFamilyAction ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				fontFamilyAction.actionPerformed(  | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 						new ActionEvent( e.getSource(), e.getID(), "" ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				bodyPane.requestFocusInWindow(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		} ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		 |  |  |  | 		 | 
			
		
	
		
		
			
				
					
					|  |  |  | 		Action alignLeftAction = actionMap.get( "left-justify" ); |  |  |  | 		Action alignLeftAction = actionMap.get( "left-justify" ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		Action alignCenterAction = actionMap.get( "center-justify" ); |  |  |  | 		Action alignCenterAction = actionMap.get( "center-justify" ); | 
			
		
	
	
		
		
			
				
					|  |  | @ -171,20 +327,25 @@ public class MailPanel extends JPanel | 
			
		
	
		
		
			
				
					
					|  |  |  | 		upperPanel.add( createButton( cutAction, "siprp/medicina/processo/mail/icons/cut.png" ) ); |  |  |  | 		upperPanel.add( createButton( cutAction, "siprp/medicina/processo/mail/icons/cut.png" ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		upperPanel.add( createButton( copyAction, "siprp/medicina/processo/mail/icons/copy.png" ) ); |  |  |  | 		upperPanel.add( createButton( copyAction, "siprp/medicina/processo/mail/icons/copy.png" ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		upperPanel.add( createButton( pasteAction, "siprp/medicina/processo/mail/icons/paste.png" ) ); |  |  |  | 		upperPanel.add( createButton( pasteAction, "siprp/medicina/processo/mail/icons/paste.png" ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		upperPanel.add( new JLabel( " " ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		upperPanel.add( createButton( boldAction, "siprp/medicina/processo/mail/icons/text_bold.png" ) ); |  |  |  | 		upperPanel.add( createButton( boldAction, "siprp/medicina/processo/mail/icons/text_bold.png" ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		upperPanel.add( createButton( italicAction, "siprp/medicina/processo/mail/icons/text_italics.png" ) ); |  |  |  | 		upperPanel.add( createButton( italicAction, "siprp/medicina/processo/mail/icons/text_italics.png" ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		upperPanel.add( createButton( underlineAction, "siprp/medicina/processo/mail/icons/text_underlined.png" ) ); |  |  |  | 		upperPanel.add( createButton( underlineAction, "siprp/medicina/processo/mail/icons/text_underlined.png" ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		upperPanel.add( createButton( fontBiggerAction, "siprp/medicina/processo/mail/icons/font_bigger.png" ) ); |  |  |  | 		upperPanel.add( createButton( fontBiggerAction, "siprp/medicina/processo/mail/icons/font_bigger.png" ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		upperPanel.add( createButton( fontSmallerAction, "siprp/medicina/processo/mail/icons/font_smaller.png" ) ); |  |  |  | 		upperPanel.add( createButton( fontSmallerAction, "siprp/medicina/processo/mail/icons/font_smaller.png" ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		upperPanel.add( createButton( colorAction, "siprp/medicina/processo/mail/icons/colorwheel.png" ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		upperPanel.add( fontCombo ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		upperPanel.add( new JLabel( " " ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		upperPanel.add( createButton( alignLeftAction, "siprp/medicina/processo/mail/icons/text_align_left.png" ) ); |  |  |  | 		upperPanel.add( createButton( alignLeftAction, "siprp/medicina/processo/mail/icons/text_align_left.png" ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		upperPanel.add( createButton( alignCenterAction, "siprp/medicina/processo/mail/icons/text_align_center.png" ) ); |  |  |  | 		upperPanel.add( createButton( alignCenterAction, "siprp/medicina/processo/mail/icons/text_align_center.png" ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		upperPanel.add( createButton( alignRightAction, "siprp/medicina/processo/mail/icons/text_align_right.png" ) ); |  |  |  | 		upperPanel.add( createButton( alignRightAction, "siprp/medicina/processo/mail/icons/text_align_right.png" ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		upperPanel.add( createButton( alignJustifyAction, "siprp/medicina/processo/mail/icons/text_align_justified.png" ) ); |  |  |  | 		upperPanel.add( createButton( alignJustifyAction, "siprp/medicina/processo/mail/icons/text_align_justified.png" ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		 |  |  |  | 		 | 
			
		
	
		
		
			
				
					
					|  |  |  | 		setLayout( new BorderLayout() ); |  |  |  | 		htmlPanel.setLayout( new BorderLayout() ); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 		 |  |  |  | 		 | 
			
		
	
		
		
			
				
					
					|  |  |  | 		add( upperPanel, BorderLayout.NORTH ); |  |  |  | 		htmlPanel.add( upperPanel, BorderLayout.NORTH ); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		add( bodyPane, BorderLayout.CENTER ); |  |  |  | 		htmlPanel.add( new JScrollPane( bodyPane, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 										JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ), BorderLayout.CENTER ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | 	 |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	private JButton createButton( Action action, String iconPath ) |  |  |  | 	private JButton createButton( Action action, String iconPath ) | 
			
		
	
	
		
		
			
				
					|  |  | 
 |