From cf76379ba94e3fc46fa27aa2925bfe18a833f584 Mon Sep 17 00:00:00 2001 From: Alena Bandarovich Date: Fri, 9 Feb 2024 11:44:44 +0100 Subject: [PATCH] Note Panel --- src/main/java/ChatClient.java | 45 +++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/src/main/java/ChatClient.java b/src/main/java/ChatClient.java index 271ac6e..5ede996 100644 --- a/src/main/java/ChatClient.java +++ b/src/main/java/ChatClient.java @@ -6,6 +6,49 @@ import java.io.*; import java.net.Socket; public class ChatClient extends JFrame implements KeyListener { + public static class TR extends JFrame { + + private JScrollPane jScrollPane; + + public TR() throws HeadlessException { + super("Notizen"); + this.jScrollPane = jScrollPane; + + initComponents(); + } + + private void initComponents() { + setVisible(true); + setBounds(200, 200, 350, 550); + setPreferredSize(new Dimension(300, 500)); + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setResizable(false); + + JPanel root = new JPanel(); + root.setPreferredSize(new Dimension(300, 500)); + + setContentPane(root); + + + + + } + + private JPanel setupPanel(String header) { + JPanel panel = new JPanel(); + panel.setPreferredSize(new Dimension(270, 150)); + panel.setLayout(new BorderLayout()); + + + JLabel jLabel = new JLabel(header); + jLabel.setHorizontalAlignment(JLabel.LEFT); + panel.add(jLabel, BorderLayout.NORTH); + + return panel; + } + + + } private String address; private String connectionFailedMessage; private Socket connectionToServer; @@ -108,6 +151,8 @@ public class ChatClient extends JFrame implements KeyListener { } public static void main(String[] args) { + SwingUtilities.invokeLater(() -> new TR()); new ChatClient(); } } +