Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a GUI application that translates the Latin words to English. The window s

ID: 3647616 • Letter: W

Question

Write a GUI application that translates the Latin words to English. The window should have three buttons, one for each latin word. When the user clicks a button, the program displays the English translation in a label.


here is my error:


LatinTranslatorGUI.java:18: cannot find symbol
symbol : method setDefaultCLoseOperation(int)
location: class LatinTranslatorGUI
setDefaultCLoseOperation(JFrame.EXIT_ON_CLOSE);
^
1 error


here is what i have:


import javax.swing.*;
import java.awt.event.*;

public class LatinTranslatorGUI extends JFrame
{
private JButton button1;
private JButton button2;
private JButton button3;
private JPanel panel;
private final int WINDOW_WIDTH = 320;
private final int WINDOW_HEIGHT = 70;

//constructor
public LatinTranslatorGUI()
{
super("Simple Latin Translator");
setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
setDefaultCLoseOperation(JFrame.EXIT_ON_CLOSE);

button1 = new JButton("Sinister");
button2 = new JButton("Dexter");
button3 = new JButton("Medium");

button1.addActionListener(new ButtonListener());
button2.addActionListener(new ButtonListener());
button3.addActionListener(new ButtonListener());

panel = new JPanel();
panel.add(button1);
panel.add(button2);
panel.add(button3);
add(panel);
setVisible(true);
}
//button 1 listener
private class ButtonListener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == button1)
JOptionPane.showMessageDialog(null, "Left");
else if (e.getSource() == button2)
JOptionPane.showMessageDialog(null, "Right");
else if (e.getSource() == button3)
JOptionPane.showMessageDialog(null, "Center");

}
}

public static void main(String[] args)
{
LatinTranslatorGUI latinTranslate = new LatinTranslatorGUI();
}

}//end main class

Explanation / Answer

JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote