Primary TextArea

* Added PrimaryTextArea Class
* Implemented PrimaryTextArea in ChatWindow (messageEnterArea)
* Made some slight adjustments to the PrimaryButton Class
This commit is contained in:
DieGurke
2019-12-07 23:23:25 +01:00
parent 418a60c074
commit ecf2566431
3 changed files with 80 additions and 13 deletions

View File

@ -20,7 +20,6 @@ import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextPane;
import javax.swing.ListSelectionModel;
import javax.swing.SwingUtilities;
@ -55,7 +54,7 @@ public class ChatWindow extends JFrame {
private LocalDB localDB;
// GUI components
private JPanel contentPane = new JPanel();
private JTextArea messageEnterTextArea = new JTextArea();
private PrimaryTextArea messageEnterTextArea;
private JList<User> userList = new JList<>();
private Chat currentChat;
private JList<Message> messageList = new JList<>();
@ -125,6 +124,9 @@ public class ChatWindow extends JFrame {
gbc_scrollPane.insets = new Insets(space, space, space, space);
contentPane.add(scrollPane, gbc_scrollPane);
// Checks for changed Message
messageEnterTextArea = new PrimaryTextArea(space);
// Message enter field
messageEnterTextArea.addKeyListener(new KeyAdapter() {
@ -137,12 +139,7 @@ public class ChatWindow extends JFrame {
}
}
});
// Checks for changed Message
messageEnterTextArea.setWrapStyleWord(true);
messageEnterTextArea.setLineWrap(true);
messageEnterTextArea.setBorder(null);
messageEnterTextArea.setFont(new Font("Arial", Font.PLAIN, 17));
messageEnterTextArea.setBorder(new EmptyBorder(space, space, space, space));
GridBagConstraints gbc_messageEnterTextfield = new GridBagConstraints();
gbc_messageEnterTextfield.fill = GridBagConstraints.BOTH;