samedi 19 août 2017

How can I make my CheckBox allign in Left side and what should I use layout to make it every checkbox print in another line?

How can I make my CheckBox allign in Left side and what should I use layout to make it every checkbox print in another line?

private void prepareGUI(){
  mainFrame = new JFrame("AIME'S STORE");
  mainFrame.setSize(400,400);
  mainFrame.setLayout(new GridLayout(2,1));
  mainFrame.addWindowListener(new WindowAdapter() {
     public void windowClosing(WindowEvent windowEvent){
        System.exit(0);
     }        
  });    
  headerLabel = new JLabel("", JLabel.LEFT);        
  statusLabel = new JLabel("",JLabel.LEFT);    

  statusLabel.setSize(350,100);

  controlPanel = new JPanel();
  controlPanel.setLayout(new FlowLayout());

  mainFrame.add(headerLabel);
  mainFrame.add(controlPanel);
  mainFrame.add(statusLabel);
  mainFrame.setVisible(true);

 }

How I can make those CheckBox allign on left?

  final JCheckBox chkColgate = new JCheckBox("Colgate");
  final JCheckBox chkHappy = new JCheckBox("Happy");
  final JCheckBox chkBeam = new JCheckBox("Beam");

What particular layout will I use in order to make it on the flow vertically? Please Help me Please help me I am new to this kind of codes.




Aucun commentaire:

Enregistrer un commentaire