1
I used the setPreferredSize
and the setSize
on the button color1
but no effect on 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);
}