Question: You have been provided with code that will generate the following user Interface. The code contains missing statements. Write the code for each missing statement.

You have been provided with code that will generate the following user Interface. The code contains missing statements. Write the code for each missing statement. import javax.swing.*;
import javax.swing.border. TitledBorder;
import java.awt.*;
import java.awt. event.ActionEvent;
1.1
public class VoucherApp {
public static void main(String[] args){
SwingUtilities.invokeLater(()->>{
// Create the main frame
JFrame frame = new JFrame("1.2
(1)");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLayout(new BorderLayout());
frame.setSize(600,400);
// Panel with GridLayout
JPanel gridPanel = new JPanel(new GridLayout(2,3,10,10));
for (int i =1; i =1.: ;1); i++){
gridPanel.add(new JLabel("Voucher "+ i +": CODE" + i));
}
// Panel with TitledBorder and TextField
JPanel voucherPanel = new JPanel();
voucherPanel.1.4(1)(new TitledBorder("Voucher Code")
;
JTextField voucherField = new JTextField(15);
voucherPanel.add(voucherField); JTextField voucherField = new JTextField(15);
voucherPanel.add(voucherField);
// Panel with JTextArea, JCheckBox, and JComboBox
JPanel historyPanel = new JPanel(new BorderLayout());
JTextArea historyArea = new JTextArea(10,40);
historyArea.setEditable(false);
JScrollPane scrollPane = new JScrollPane(historyArea);
JCheckBox pensionerCheckBox 1.!
_(1)
pensionerCheckBox.1.
(1)
JComboBox []{
"Between 65 and 80",
"Between 80 and 90",
"Over 100"
});
ageComboBox.setEnabled(true);
// Add components to the historyPanel
JPanel checkBoxPanel = new JPanel();
checkBoxPanel.add(pensionerCheckBox);
checkBoxPanel.add(ageComboBox);
historyPanel.add(checkBoxPanel, BorderLayout.NORTH);
historyPanel.add(scrollPane, BorderLayout.CENTER);
// Panel with buttons
JPanel buttonPanel = new JPanel();
JButton addVoucherButton = new JButton("Add Voucher");
JButton saveVouchersButton = new JButton("Save Vouchers");
JButton exitButton = new JButton("Exit");
// Add action listener for exit button
exitButton.1.8
(1)(e -> System. exit(0));public void actionPerformed(ActionEvent e){
ageComboBox.setEnabled(pensionerCheckBox. is Selected ());
}
});
// Display the frame
1.S
});
1.1C
(1)
}
84
B5
Voucher Application
Voucher Code , Voucher 2: CODE21 Are you a pensioner?
You have been provided with code that will

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!