import javax.swing.*;import java.awt.*;import java.awt.event.*;public class Converter extends JFrame implements ActionListener { // GUI Components private JTextField decimalField; private JLabel binaryLabel, octalLabel, hexLabel; public Converter() { // Set up the GUI setTitle("Decimal to Other Bases Converter"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setPreferredSize(new Dimension(300, 200)); // Create GUI components decimalField = new JTextField(10); JButton convertButton = new JButton("Convert"); convertButton.addActionListener(this); binaryLabel = new JLabel("Binary: "); octalLabel = new JLabel("Octal: "); hexLabel = new JLabel("Hexadecimal: "); // Add components to the content pane Container contentPane = getContentPane(); contentPane.setLayout(new GridLayout(4, 1)); contentPane.add(decimalField); contentPane.add(convertButton); contentPane.add(binaryLabel); contentPane.add(octalLabel); contentPane.add(hexLabel); // Display the GUI pack(); setVisible(true); } public void actionPerformed(ActionEvent e) { // Get the decimal input int decimal = Integer.parseInt(decimalField.getText()); // Convert to binary, octal, and hexadecimal String binary = Integer.toBinaryString(decimal); String octal = Integer.toOctalString(decimal); String hex = Integer.toHexString(decimal); // Display the results binaryLabel.setText("Binary: " + binary); octalLabel.setText("Octal: " + octal); hexLabel.setText("Hexadecimal: " + hex); } public static void main(String[] args) { new Converter(); }}