I am trying to add Components to my JPanel, however they aren't sized correctly and not in the right location. This my code for the componenent.
button = new JButton();
button.setSize(100, 100);
button.setLocation(400, 400);
button.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
vm.panel.add(button);
It's also behind the other things I'm drawing, so it's not visible (that's why I made the cursor crosshair, to see where my button was). This is what I'm drawing.
g.drawImage(ImageIO.read(getClass().getResourceAsStream("/background.jpg")), 0, 0, vm.panel.getWidth(), vm.panel.getHeight(), null);
g.setColor(Color.WHITE);
g.fillRoundRect(200, 200, 880, 560, 100, 100);
g.setColor(Color.BLACK);
g.setFont(new Font("Arial", Font.PLAIN, 48));
g.drawString("Login", 575, 300);