Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // @Author: Jordan Fisher
- // @Version: 1.1
- import java.awt.BorderLayout;
- import java.awt.FlowLayout;
- import java.awt.Dimension;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.util.Random;
- import javax.swing.JFrame;
- import javax.swing.JPanel;
- import javax.swing.JTextField;
- import javax.swing.JButton;
- public class French extends JFrame implements ActionListener {
- JPanel panel = new JPanel();
- JTextField question = new JTextField("Start by saying your speech");
- JTextField englishTranslation = new JTextField("<<English translation>>");
- JButton newQuestion = new JButton("New Question");
- JButton showEnglish = new JButton("Show English translation");
- public String reference;
- public int random;
- Random myRandom = new Random();
- public French() {
- panel.setLayout(new FlowLayout());
- panel.add(newQuestion, BorderLayout.WEST);
- panel.add(showEnglish, BorderLayout.EAST);
- getContentPane().add(question, BorderLayout.NORTH);
- getContentPane().add(englishTranslation, BorderLayout.CENTER);
- getContentPane().add(panel, BorderLayout.SOUTH);
- setTitle("French Speaking revision..");
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- newQuestion.addActionListener(this);
- showEnglish.addActionListener(this);
- question.setEditable(false);
- englishTranslation.setEditable(false);
- question.setHorizontalAlignment(JTextField.CENTER);
- englishTranslation.setHorizontalAlignment(JTextField.CENTER);
- }
- public static void main(String[] args) {
- French frame = new French();
- frame.setLocation(100, 100);
- frame.pack();
- frame.setVisible(true);
- }
- public void actionPerformed(ActionEvent e) {
- if (e.getSource() == newQuestion) {
- random = myRandom.nextInt(17) + 1;
- switch (random) {
- case 1:
- question.setText("Quelle as-tu fait ton stage?");
- reference = "What did you do for your work experience?";
- break;
- case 2:
- question.setText("Quand as-tu fait ton stage?");
- reference = "When did you do for your work experience?";
- break;
- case 3:
- question.setText("Oú as-tu fait ton stage?");
- reference = "Where did you do for your work experience?";
- break;
- case 4:
- question.setText("Pourquoi as-du fait ton stage");
- reference = "Why did you do your work experience?";
- break;
- case 5:
- question.setText("Tu te léves a quelle heures?");
- reference = "What time do you get up?";
- break;
- case 6:
- question.setText("Tu quittes la maison avec qui?");
- reference = "You leave the house with who?";
- break;
- case 7:
- question.setText("Comment as-tu voyage?");
- reference = "How did you travel?";
- break;
- case 8:
- question.setText("Avec qui as-tu travaillé?");
- reference = "Who did you work with?";
- break;
- case 9:
- question.setText("Peux-tu decrire ton patron?");
- reference = "Can you describe your boss?";
- break;
- case 10:
- question.setText("Tu as un job?");
- reference = "You have a job?";
- break;
- case 11:
- question.setText("Quélle était ton opinion de ton stage?");
- reference = "What was your opinion of your work experience?";
- break;
- case 12:
- question.setText("Quelle as-ton amis pensé de ton stage?");
- reference = "What did your friend think of your work experience?";
- break;
- case 13:
- question.setText("A quelle heures as-tu finis ton stage?");
- reference = "What time did you finish your work experience?";
- break;
- case 14:
- question.setText("Peux-tu decrire ton stage?");
- reference = "Can you describe your work experience?";
- break;
- case 15:
- question.setText("Est-ce tu aimerais fair ca comme carriére?");
- reference = "Would you like to do that job as a career?";
- break;
- case 16:
- question.setText("A quelle heures as-ton stage commencé?");
- reference = "What time did your work experience start?";
- break;
- case 17:
- question.setText("Quellé était ton routiné pour ton stage?");
- reference = "What was your routine for your work experience?";
- break;
- default:
- question.setText("Merdé. C'est un problemé");
- reference = "Shit. There is a problem";
- break;
- }
- englishTranslation.setText("");
- } else if (e.getSource() == showEnglish) {
- englishTranslation.setText(reference);
- }
- }
- }
Add Comment
Please, Sign In to add comment