|
@ -1,4 +1,5 @@ |
|
|
import java.awt.BorderLayout; |
|
|
import java.awt.BorderLayout; |
|
|
|
|
|
import java.awt.Color; |
|
|
import java.awt.Dimension; |
|
|
import java.awt.Dimension; |
|
|
import java.awt.Toolkit; |
|
|
import java.awt.Toolkit; |
|
|
import java.awt.event.ActionEvent; |
|
|
import java.awt.event.ActionEvent; |
|
@ -50,6 +51,11 @@ public class ChatGUI implements ActionListener { |
|
|
colors.add(blue); |
|
|
colors.add(blue); |
|
|
colors.add(green); |
|
|
colors.add(green); |
|
|
|
|
|
|
|
|
|
|
|
red.addActionListener(this); |
|
|
|
|
|
blue.addActionListener(this); |
|
|
|
|
|
black.addActionListener(this); |
|
|
|
|
|
green.addActionListener(this); |
|
|
|
|
|
|
|
|
exit.addActionListener(this); |
|
|
exit.addActionListener(this); |
|
|
|
|
|
|
|
|
bar.add(menu); |
|
|
bar.add(menu); |
|
@ -86,6 +92,16 @@ public class ChatGUI implements ActionListener { |
|
|
String inputText = inputTextField.getText(); |
|
|
String inputText = inputTextField.getText(); |
|
|
outputTextArea.append(inputText + "\n"); |
|
|
outputTextArea.append(inputText + "\n"); |
|
|
inputTextField.setText(""); |
|
|
inputTextField.setText(""); |
|
|
|
|
|
} |
|
|
|
|
|
if (e.getSource() == red) { |
|
|
|
|
|
outputTextArea.setForeground(Color.RED); |
|
|
|
|
|
} |
|
|
|
|
|
if (e.getSource() == blue) { |
|
|
|
|
|
outputTextArea.setForeground(Color.BLUE); |
|
|
|
|
|
}else if (e.getSource() == black) { |
|
|
|
|
|
outputTextArea.setForeground(Color.BLACK); |
|
|
|
|
|
} else if (e.getSource() == green) { |
|
|
|
|
|
outputTextArea.setForeground(Color.GREEN); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|