Browse Source

Refactor: move panel

remotes/origin/server
Alena Bandarovich 11 months ago
parent
commit
ac8678e7cf
  1. 15
      src/main/java/ChatClient.java

15
src/main/java/ChatClient.java

@ -1,4 +1,5 @@
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
@ -8,7 +9,10 @@ import java.net.Socket;
public class ChatClient extends JFrame implements KeyListener {
public static class TR extends JFrame {
private JScrollPane jScrollPane;
private JPanel container;
public TR() throws HeadlessException {
super("Notizen");
@ -19,7 +23,7 @@ public class ChatClient extends JFrame implements KeyListener {
private void initComponents() {
setVisible(true);
setBounds(200, 200, 350, 550);
setBounds(1180, 170, 350, 550);
setPreferredSize(new Dimension(300, 500));
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setResizable(false);
@ -29,9 +33,14 @@ public class ChatClient extends JFrame implements KeyListener {
setContentPane(root);
jScrollPane = new JScrollPane( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
jScrollPane = new JScrollPane(container, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
jScrollPane.setPreferredSize(new Dimension(300, 500));
root.add(jScrollPane);
container = new JPanel();
container.setBorder(new EmptyBorder(3, 3, 3, 3));
container.setBackground(new Color(0x839683));
container.setLayout(new BoxLayout(container, BoxLayout.Y_AXIS));
}
private JPanel setupPanel(String header) {
@ -39,6 +48,8 @@ public class ChatClient extends JFrame implements KeyListener {
panel.setPreferredSize(new Dimension(270, 150));
panel.setLayout(new BorderLayout());
container.add(panel);
container.add(Box.createVerticalStrut(5));
JLabel jLabel = new JLabel(header);
jLabel.setHorizontalAlignment(JLabel.LEFT);

Loading…
Cancel
Save