From 56e2808177b28c54ac971c55080b93cb0da2d0d8 Mon Sep 17 00:00:00 2001 From: fdai7460 Date: Fri, 20 Jan 2023 14:38:52 +0100 Subject: [PATCH] Setup Panel with label nr 1 --- src/main/java/src/MainFrame.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/main/java/src/MainFrame.java b/src/main/java/src/MainFrame.java index 3865459..f6619af 100644 --- a/src/main/java/src/MainFrame.java +++ b/src/main/java/src/MainFrame.java @@ -36,13 +36,14 @@ public class MainFrame extends JFrame { int j = 0; - double d = 1.0; - String str = "Hallo"; JPanel boxPanel = setupJPanel(); boxPanel.setLayout(new BoxLayout(boxPanel, BoxLayout.X_AXIS)); rootPanel.add(boxPanel); + JPanel jPanel1 = setupJPannel2("1"); + boxPanel.add(jPanel1); + JButton back = new JButton(); back.setVisible(true); back.setBounds(5, 5, 100, 25); @@ -69,6 +70,20 @@ public class MainFrame extends JFrame { } + private JPanel setupJPannel2(String number) { + JPanel jPanel = new JPanel(); + jPanel.setBackground(Color.BLUE); + jPanel.setVisible(true); + jPanel.setBorder(new LineBorder(Color.PINK, 1)); + + JLabel numLabel1 = new JLabel(); + numLabel1.setText(number); + numLabel1.setLayout(null); + numLabel1.setVisible(true); + jPanel.add(numLabel1); + + return jPanel; + } public JPanel setupJPanel() {