3 import java.awt.event.*;
5 public class enterPanel extends JPanel{
12 public enterPanel( final roomFrame rf ) {
14 setLayout( new BorderLayout() );
16 JPanel p = new JPanel();
17 p.setBorder( BorderFactory.createTitledBorder(
18 BorderFactory.createEtchedBorder(), "Recipient" ) );
19 p.setLayout( new BorderLayout() );
21 p.add( "Center", to = new JTextField() );
23 JButton b = new JButton( "Select" );
24 b.addActionListener( new ActionListener() {
25 public void actionPerformed( ActionEvent e ) {
26 System.out.println( "User list bialog!" );
33 to.addActionListener( new ActionListener() {
34 public void actionPerformed( ActionEvent e ) {
39 p.setBorder( BorderFactory.createTitledBorder(
40 BorderFactory.createEtchedBorder(), "Message Text" ) );
41 p.setLayout( new BorderLayout() );
43 p.add( "Center", new JScrollPane( msg = new JTextArea(),
44 JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
45 JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ) );
47 msg.setLineWrap( true );
48 msg.setWrapStyleWord( true );
54 p.add( b = new JButton( "Send" ) );
55 b.addActionListener( new ActionListener() {
56 public void actionPerformed( ActionEvent e ) {
57 String cmd = "ENT0 1|";
59 if( ri.mail ) cmd = cmd + to.getText();
62 String theMsg = wrap( msg.getText() );
64 System.out.println( theMsg );
65 citadel.me.networkEvent( cmd, theMsg, new CallBack() {
66 public void run( citReply r ) {
68 citadel.me.warning( r.getArg(0) );
74 p.add( b = new JButton( "Cancel" ) );
75 b.addActionListener( new ActionListener() {
76 public void actionPerformed( ActionEvent e ) {
83 public void refresh( roomInfo ri ) {
88 to.setEnabled( ri.mail );
91 public String wrap( String in ) {
92 StringBuffer b = new StringBuffer( in );
93 int last_space = 0, line_length=0;
94 for( int i = 0; i < b.length(); i++ ) {
96 if( line_length > 76 ) {
97 b.setCharAt( last_space, '\n' );
101 if( b.charAt(i) == ' ' )