Can you add some functions to this Java GUI program?
I just want to change color of foreground and background withJComboBox.
public class SettingFormimplements ActionListener {
JComboBox<String> comboBox1, comboBox2;
public voidsettingButton() {
JFrame settingFrame = newJFrame(“Setting”);
JLabel p1 = newJLabel(“Background”);
p1.setSize(300, 30);
p1.setBounds(0, 10, 150, 50);
settingFrame.setLayout(null);
settingFrame.add(p1);
JLabel p2 = new JLabel(“KeypadColor”);
p2.setBounds(0, 70, 150, 50);
settingFrame.add(p2);
comboBox1 = newJComboBox<>();
comboBox1.addActionListener(this);
comboBox1.addItem(“Black”);
comboBox1.addItem(“White”);
comboBox1.addItem(“Blue”);
comboBox1.setBounds(140, 10, 150, 50);
settingFrame.add(comboBox1);
comboBox2 = new JComboBox<>();
comboBox2.addActionListener(this);
comboBox2.addItem(“Black”);
comboBox2.addItem(“White”);
comboBox2.addItem(“Blue”);
comboBox2.setBounds(140, 70, 150, 50);
settingFrame.add(comboBox2);
//OK button
JButton ok = newJButton(“OK”);
ok.addActionListener(this);
settingFrame.add(ok);
ok.setBounds(0, 300, 300, 50);
settingFrame.setVisible(true);
settingFrame.pack();
settingFrame.setSize(300,400);
settingFrame.setLocationRelativeTo(null);
}
publicstatic void main(String[] args){
SettingForm form = newSettingForm();
form.settingButton();
}
@Override
public voidactionPerformed(ActionEvent e) {
System.out.println(“Bottonpressed!!!”);
}
}
Expert
OR
PayPal Gateway not configured
OR
PayPal Gateway not configured
PayPal Gateway not configured
PayPal Gateway not configured