private JPanel createControlPanel() {
JPanel ctrl = new JPanel();
addBorder(ctrl,"Controls");
//add 3 buttons here
return ctrl;
}
我想创建这 3 个按钮并将它们添加到 ctrl
从文档中:
GridLayout experimentLayout = new GridLayout(1,3);
compsToExperiment.setLayout(experimentLayout);
compsToExperiment.add(new JButton("Button 1"));
compsToExperiment.add(new JButton("Button 2"));
compsToExperiment.add(new JButton("Button 3"));
医生