I've used setPreferredSize
and setSize
on the color1
button but no effect in the application, it continues using the entire application.
public static void janelaPrincipal()
{
//FRAME
JFrame janela = new JFrame();
janela.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
janela.pack();
janela.setResizable(false);
janela.setVisible(true);
janela.setSize(new Dimension(WIDTH, HEIGHT));
janela.setLocation((SCREEN.width / 2) - (WIDTH / 2), (SCREEN.height / 2) - (HEIGHT / 2));
//PAINEIS
JPanel fundo = new JPanel();
fundo.setSize(new Dimension(WIDTH, HEIGHT));
fundo.setBackground(background);
//BOTOES
JButton color1 = new JButton();
color1.setPreferredSize(new Dimension(WIDTHBUTTON, HEIGHTBUTTON));
color1.setBackground(RED);
//ADICIONAR NO FRAME
janela.add(fundo);
janela.add(color1);
}