import java.awt.*; import java.awt.event.*; import java.lang.Integer; import java.util.Calendar; import java.io.File; import javax.swing.*; import javax.swing.event.*; /** * TextEntryPane - Allows entry of text to be sent to the participants. * * @author Paul Kronenwetter * @author Jayme Manning * *

* Paul Kronenwetter
* Jayme Manning
* Trade Secrets and/or Confidential
* Commercial or Financial Information
* Exempt From Disclosure Under the Freedom
* of Information Act (5 USC 552(b)(3)
* and 5 USC 552(b)(4)) and Under 18 USC 1905
*

*

* Proprietary Information Notice
* * This document contains information proprietary to, and is the * sole property of, Paul Kronenwetter and Jayme Manning. It shall not * be reproduced, used or disclosed in any manner or for any purpose * not authorized in writing by both Paul Kronenwetter and * Jayme Manning, and except, as retention may be so authorized, it * shall be returned to Paul Kronenwetter or Jayme Manning upon * request.

*

© 1998 by Paul Kronenwetter and Jayme * Manning
All Rights Reserved

* * @version * $Revision: 1.8 $
* $Date: 1998/12/17 17:17:08 $

* *

 * $Log: TextEntryPane.java,v $
 * Revision 1.8  1998/12/17 17:17:08  cps606
 * Added method to retrieve text.
 *
 * Revision 1.7  1998/12/17 15:32:52  cps606
 * Added method to attach action handler to buttons.
 *
 * Revision 1.6  1998/12/17 03:22:43  cps606
 * Modified to use a TextScrollPane instead of generating a JScrollPane object.
 *
 * Revision 1.5  1998/12/15 22:56:07  cps606
 * * Manually edited the comments to correct formatting.
 *
 * Revision 1.4  1998/12/15 00:08:04  cps606
 * * Cleaned up and added documentation.  Rearranged methods a little
 *   as seemed appropriate. 
 *
 * Revision 1.3  1998/12/13 21:42:23  cps606
 * * Added getPreferred Size Method
 * * Removed Custom TextArea references.
 *
 * Revision 1.2  1998/12/13 20:13:21  cps606
 * * Fiddled around with the text entry pane. Still doesn't work.
 *
 * Revision 1.1  1998/12/12 03:22:12  cps606
 * * First CVS checkin.
 *
 * 
*/ public class TextEntryPane extends JPanel { private final String rcsId="$Id: TextEntryPane.java,v 1.8 1998/12/17 17:17:08 cps606 Exp $"; private Color bgColor=Color.white; private Color fgColor=Color.black; private JLabel paneLabel; private JButton allUsersButton, highlightedUsersButton; private TextScrollPane scrollPane; private GBC gbc; private GridBagLayout gbl; private final String allUsersText="All Users"; private final String highlightedUsersText="Highlighted"; /** * Void constructor that calls realCtor. */ public TextEntryPane() { realCtor(); } /** * Replies to requests for this component's preferred size. * * @return The preferred size of this panel in a Dimension. */ public Dimension getPreferredSize() { return new Dimension(250,150); } /** * Method to re-initialize panel. Probably not needed, except for * debugging purposes. */ public void reset() { init(); } // Start of private methods and classes. /** * This is the method that does the "real" work of setting up the * variables and other objects needed to make this panel work. */ private void realCtor() { // Make the colors "sane" //setForeground(fgColor); //setBackground(bgColor); // Setup layout variables gbc = new GBC(); gbl = new GridBagLayout(); // Make sure this panel uses a BorderLayout. setLayout(gbl); // Set up the buttons and the button panel... allUsersButton = new JButton(allUsersText); gbc.setupConstraints(0,10,1,1,100,100,GBC.CENTER,GBC.NONE,0); gbl.setConstraints(allUsersButton,gbc); add(allUsersButton); highlightedUsersButton = new JButton(highlightedUsersText); gbc.setupConstraints(2,10,1,1,100,100,GBC.CENTER,GBC.NONE,0); gbl.setConstraints(highlightedUsersButton,gbc); add(highlightedUsersButton); // Create the text area... scrollPane = new TextScrollPane(); gbc.setupConstraints(0,1,3,9,100,100,GBC.CENTER,GBC.BOTH,0); gbl.setConstraints(scrollPane,gbc); add(scrollPane); // Label this panel paneLabel = new JLabel("Talk"); gbc.setupConstraints(1,0,1,1,100,80,GBC.CENTER,GBC.NONE,0); gbl.setConstraints(paneLabel,gbc); add(paneLabel); } /** * Initialization method for the CalendarPane. Also probably not * needed except for debugging. */ private void init() { validate(); } /** * addActionListener - Method used to add an event handler from another class * to listen to our buttons. * * @param al ActionListener event handler used to monitor our buttons */ public void addActionListener(ActionListener al) { allUsersButton.addActionListener(al); highlightedUsersButton.addActionListener(al); } /** * getText - This method is simply a delegate to a method with the same * name in TextScrollPane. * * @return String - The text from our embedded JTextArea component. */ public String getText() { String t1 = scrollPane.getText(); scrollPane.clearText(); return t1; } }