I have a very annoying problem. I am working with JAVA GUI and I am not that well equipped with Layout Managers however i know the basics. I have a code that supposedly should put a label component into its parent panel but it is not working as i tried BorderLayout.CENTER on adding. Can somebody help me guys. Here is the short code where I had the problem.
JPanel namePanel = new JPanel();
namePanel.setLayout(new BorderLayout());
namePanel.setPreferredSize(new Dimension(420,45));
namePanel.setBackground(Color.DARK_GRAY);
namePanel.setBorder(border);
JLabel nameLabel = new JLabel(taskName.get(i));
nameLabel.setFont(new Font("Century Gothic", Font.BOLD, 18));
nameLabel.setForeground(Color.WHITE);
namePanel.add(nameLabel, BorderLayout.CENTER);