// Path: OnlineTranslator/src/main/java/translator/data/Language.java
// public class Language {
//     private final String description;
//     private final String language;
// 
//     Language(String _desc, String _lang) {
//         this.description = _desc;
//         this.language = _lang;
//     }
// 
//     public String getLanguage() {
//         return language;
//     }
// 
//     public String toString() {
//         return description;
//     }
// }
// 
// Path: OnlineTranslator/src/main/java/translator/data/Translator.java
// public interface Translator {
// 
//     String translate(String text, String from, String to);
// 
//     Language[] getLanguages();
// }
// 
// Path: OnlineTranslator/src/main/java/translator/data/TranslatorFactory.java
// public class TranslatorFactory {
//     public static Vector<Translator> getTranslators() {
//         Vector<Translator> translators = new Vector<>();
//         translators.add(new Tureng());
//         translators.add(new Seslisozluk());
//         return translators;
//     }
// }


import translator.data.Language;
import translator.data.Translator;
import translator.data.TranslatorFactory;
import javax.swing.*;
import java.awt.*;
package translator;



/**
 * A simple HTTP page request and parsing example
 * <p>
 * - Apache HttpComponents to request and download page (https://hc.apache.org/)
 * - jsoup to parse HTML file (https://jsoup.org/)
 */
public class Main extends JFrame {
    private JComboBox<Language> cmbFrom = null;
    private JComboBox<Language> cmbTo = null;
    private JComboBox<Translator> cmbService = null;

    private Main() {
        super();
        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        this.setSize(800, 600);
        this.setContentPane(getJContentPane());
        this.setTitle("Online Translator");
        this.setVisible(true);
    }

    public static void main(String[] args) {
        new Main();
    }

    private JPanel getJContentPane() {
        JPanel jContentPane = new JPanel(null);
        cmbFrom = new JComboBox<>();
        cmbFrom.setBounds(5, 5, 200, 20);
        jContentPane.add(cmbFrom);

        cmbTo = new JComboBox<>();
        cmbTo.setBounds(210, 5, 200, 20);
        jContentPane.add(cmbTo);

        cmbService = new JComboBox<>(TranslatorFactory.getTranslators());
        cmbService.addItemListener(e -> updateLanguages());
        cmbService.setBounds(415, 5, 200, 20);
        jContentPane.add(cmbService);

// Path: OnlineTranslator/src/main/java/translator/data/Language.java
// public class Language {
//     private final String description;
//     private final String language;
// 
//     Language(String _desc, String _lang) {
//         this.description = _desc;
//         this.language = _lang;
//     }
// 
//     public String getLanguage() {
//         return language;
//     }
// 
//     public String toString() {
//         return description;
//     }
// }
// 
// Path: OnlineTranslator/src/main/java/translator/data/Translator.java
// public interface Translator {
// 
//     String translate(String text, String from, String to);
// 
//     Language[] getLanguages();
// }
// 
// Path: OnlineTranslator/src/main/java/translator/data/TranslatorFactory.java
// public class TranslatorFactory {
//     public static Vector<Translator> getTranslators() {
//         Vector<Translator> translators = new Vector<>();
//         translators.add(new Tureng());
//         translators.add(new Seslisozluk());
//         return translators;
//     }
// }


// Path: OnlineTranslator/src/main/java/translator/Main.java
import translator.data.Language;
import translator.data.Translator;
import translator.data.TranslatorFactory;
import javax.swing.*;
import java.awt.*;

package translator;



/**
 * A simple HTTP page request and parsing example
 * <p>
 * - Apache HttpComponents to request and download page (https://hc.apache.org/)
 * - jsoup to parse HTML file (https://jsoup.org/)
 */
public class Main extends JFrame {
    private JComboBox<Language> cmbFrom = null;
    private JComboBox<Language> cmbTo = null;
    private JComboBox<Translator> cmbService = null;

    private Main() {
        super();
        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        this.setSize(800, 600);
        this.setContentPane(getJContentPane());
        this.setTitle("Online Translator");
        this.setVisible(true);
    }

    public static void main(String[] args) {
        new Main();
    }

    private JPanel getJContentPane() {
        JPanel jContentPane = new JPanel(null);
        cmbFrom = new JComboBox<>();
        cmbFrom.setBounds(5, 5, 200, 20);
        jContentPane.add(cmbFrom);

        cmbTo = new JComboBox<>();
        cmbTo.setBounds(210, 5, 200, 20);
        jContentPane.add(cmbTo);

        cmbService = new JComboBox<>(TranslatorFactory.getTranslators());
        cmbService.addItemListener(e -> updateLanguages());
        cmbService.setBounds(415, 5, 200, 20);
        jContentPane.add(cmbService);

        JTextArea txtText = new JTextArea();