|
@ -6,6 +6,49 @@ import java.io.*; |
|
|
import java.net.Socket; |
|
|
import java.net.Socket; |
|
|
|
|
|
|
|
|
public class ChatClient extends JFrame implements KeyListener { |
|
|
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 address; |
|
|
private String connectionFailedMessage; |
|
|
private String connectionFailedMessage; |
|
|
private Socket connectionToServer; |
|
|
private Socket connectionToServer; |
|
@ -108,6 +151,8 @@ public class ChatClient extends JFrame implements KeyListener { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
public static void main(String[] args) { |
|
|
|
|
|
SwingUtilities.invokeLater(() -> new TR()); |
|
|
new ChatClient(); |
|
|
new ChatClient(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|