forked from Coded/SIPRP
				
			git-svn-id: https://svn.coded.pt/svn/SIPRP@596 bb69d46d-e84e-40c8-a05a-06db0d633741
	
		
	
				
					
				
			
							parent
							
								
									2c083a4018
								
							
						
					
					
						commit
						6ce0a8db7c
					
				| @ -0,0 +1,83 @@ | |||||||
|  | package siprp.medicina.processo.mail; | ||||||
|  | 
 | ||||||
|  | import java.awt.BorderLayout; | ||||||
|  | import java.awt.FlowLayout; | ||||||
|  | import java.awt.GridLayout; | ||||||
|  | import java.awt.event.WindowAdapter; | ||||||
|  | import java.awt.event.WindowEvent; | ||||||
|  | 
 | ||||||
|  | import javax.swing.Action; | ||||||
|  | import javax.swing.ActionMap; | ||||||
|  | import javax.swing.JButton; | ||||||
|  | import javax.swing.JFrame; | ||||||
|  | import javax.swing.JPanel; | ||||||
|  | import javax.swing.JTextPane; | ||||||
|  | import javax.swing.text.DefaultEditorKit; | ||||||
|  | import javax.swing.text.html.HTMLEditorKit; | ||||||
|  | 
 | ||||||
|  | public class MailPanel extends JPanel | ||||||
|  | { | ||||||
|  | 	protected JTextPane bodyPane; | ||||||
|  | 	 | ||||||
|  | 	public static void main( String args[] ) | ||||||
|  | 	{ | ||||||
|  | 		JFrame frm = new JFrame(); | ||||||
|  | 		frm.getContentPane().setLayout( new GridLayout( 1, 1 ) ); | ||||||
|  | 		frm.getContentPane().add( new MailPanel() ); | ||||||
|  | 		frm.addWindowListener( new WindowAdapter(){ | ||||||
|  | 			public void windowClosing( WindowEvent e ) | ||||||
|  | 			{ | ||||||
|  | 				System.exit( 0 ); | ||||||
|  | 			} | ||||||
|  | 		} ); | ||||||
|  | 		frm.setSize( 1024, 768 ); | ||||||
|  | 		frm.setVisible( true ); | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	public MailPanel() | ||||||
|  | 	{ | ||||||
|  | 		setupComponents(); | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	private void setupComponents() | ||||||
|  | 	{ | ||||||
|  | 		HTMLEditorKit kit = new HTMLEditorKit(); | ||||||
|  | 		bodyPane = new JTextPane(); | ||||||
|  | 		bodyPane.setEditorKit( kit ); | ||||||
|  | 		ActionMap actionMap = bodyPane.getActionMap(); | ||||||
|  | 		 | ||||||
|  | 		Action cutAction = actionMap.get( DefaultEditorKit.cutAction ); | ||||||
|  | 		Action copyAction = actionMap.get( DefaultEditorKit.copyAction ); | ||||||
|  | 		Action pasteAction = actionMap.get( DefaultEditorKit.pasteAction ); | ||||||
|  | 		 | ||||||
|  | 		Action boldAction = actionMap.get( HTMLEditorKit.BOLD_ACTION ); | ||||||
|  | 		Action italicAction = actionMap.get( HTMLEditorKit.ITALIC_ACTION ); | ||||||
|  | 		Action underlineAction = actionMap.get( "font-underline" ); | ||||||
|  | 		Action smallerAction = actionMap.get( HTMLEditorKit.FONT_CHANGE_SMALLER  ); | ||||||
|  | 		Action biggerAction = actionMap.get( HTMLEditorKit.FONT_CHANGE_BIGGER ); | ||||||
|  | 		 | ||||||
|  | 		Action alignLeftAction = actionMap.get( HTMLEditorKit.PARA_INDENT_LEFT ); | ||||||
|  | 		Action alignCenterAction = actionMap.get( "center-justify" ); | ||||||
|  | 		Action alignRightAction = actionMap.get( HTMLEditorKit.PARA_INDENT_RIGHT ); | ||||||
|  | 		 | ||||||
|  | 		JPanel upperPanel = new JPanel(); | ||||||
|  | 		upperPanel.setLayout( new FlowLayout( FlowLayout.LEFT ) ); | ||||||
|  | 		upperPanel.add( new JButton( cutAction ) ); | ||||||
|  | 		upperPanel.add( new JButton( copyAction ) ); | ||||||
|  | 		upperPanel.add( new JButton( pasteAction ) ); | ||||||
|  | 		upperPanel.add( new JButton( boldAction ) ); | ||||||
|  | 		upperPanel.add( new JButton( italicAction ) ); | ||||||
|  | 		upperPanel.add( new JButton( underlineAction ) ); | ||||||
|  | 		upperPanel.add( new JButton( smallerAction ) ); | ||||||
|  | 		upperPanel.add( new JButton( biggerAction ) ); | ||||||
|  | 		upperPanel.add( new JButton( alignLeftAction ) ); | ||||||
|  | 		upperPanel.add( new JButton( alignCenterAction ) ); | ||||||
|  | 		upperPanel.add( new JButton( alignRightAction ) ); | ||||||
|  | 		 | ||||||
|  | 		 | ||||||
|  | 		setLayout( new BorderLayout() ); | ||||||
|  | 		 | ||||||
|  | 		add( upperPanel, BorderLayout.NORTH ); | ||||||
|  | 		add( bodyPane, BorderLayout.CENTER ); | ||||||
|  | 	} | ||||||
|  | } | ||||||
					Loading…
					
					
				
		Reference in new issue