1 31 package org.objectweb.proactive.ic2d.gui.util; 32 33 import org.objectweb.proactive.ic2d.util.IC2DMessageLogger; 34 35 public class MessagePanel extends javax.swing.JPanel { 36 37 private javax.swing.JTextPane messageArea; 38 private IC2DMessageLogger messageLogger; 39 40 44 public MessagePanel(String title) { 45 setLayout(new java.awt.BorderLayout ()); 46 messageArea = new javax.swing.JTextPane (); 47 messageLogger = createMessageLogger(messageArea); 48 setBorder(javax.swing.BorderFactory.createTitledBorder(title)); 49 javax.swing.JPanel topPanel = new javax.swing.JPanel (new java.awt.BorderLayout ()); 50 javax.swing.JButton clearLogButton = new javax.swing.JButton ("clear messages"); 52 clearLogButton.addActionListener(new java.awt.event.ActionListener () { 53 public void actionPerformed(java.awt.event.ActionEvent e) { 54 messageArea.setText(""); 55 } 56 }); 57 topPanel.add(clearLogButton, java.awt.BorderLayout.WEST); 58 add(topPanel, java.awt.BorderLayout.NORTH); 59 javax.swing.JScrollPane pane = new javax.swing.JScrollPane (messageArea); 60 add(pane, java.awt.BorderLayout.CENTER); 61 } 62 63 64 68 public IC2DMessageLogger getMessageLogger() { 69 return messageLogger; 70 } 71 72 76 protected IC2DMessageLogger createMessageLogger(javax.swing.JTextPane messageArea) { 77 return new TextPaneMessageLogger(messageArea); 78 } 79 80 84 85 89 } | Popular Tags |