I coded a little URL encoding tool to exercise the JAVA MVC pattern with SWING.Can somebody give me feedback if this is the right way to implement the MVC pattern?package model;import java.io.UnsupportedEncodingException;import java.net.URLEncoder;public class MainModel{    public String convertText(String text)    {        try        {            return URLEncoder.encode(text, UTF-8);        }        catch (UnsupportedEncodingException e)        {            return Could not be converted.;        }    }}package view;import java.awt.Color;import java.awt.event.ActionListener;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JPanel;import javax.swing.JScrollPane;import javax.swing.JTextArea;public class MainView extends JFrame{    private static final long serialVersionUID = 1L;    private JButton convertButton;    private JTextArea textArea;    public MainView()    {        setBounds(50, 50, 300, 400);        JPanel panel = new JPanel();        textArea = new JTextArea(10, 10);        panel.add(new JScrollPane(textArea));        convertButton = new JButton(Convert);        panel.add(convertButton);        add(panel);        getContentPane().setBackground(Color.white);        setVisible(true);    }    public String getText()    {        return textArea.getText();    }    public void setText(String text)    {        this.textArea.setText(text);    }    public void addConvertListener(ActionListener listener)    {        convertButton.addActionListener(listener);    }}package controller;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import model.MainModel;import view.MainView;public class MainController{    MainView view;    MainModel model;    public MainController(MainView view, MainModel model)    {        super();        this.view = view;        this.model = model;        view.addConvertListener(new ConvertActionListener());    }    class ConvertActionListener implements ActionListener    {        @Override        public void actionPerformed(ActionEvent e)        {            view.setText(model.convertText(view.getText()));        }    }}
URL encoder with MVC Pattern
java;mvc;swing