JComponent dont know how create panel : I having problem with create panel witch will allow me read/write to file. I mean i have some class like book(with fields author, pages, publication date) and another comics class witch extend class book. In this class I have 3 another fields and also have this from book. Now i want create panel to edit object from class comics that panel should have field from both class but i also dont want duplicate code when i write another class witch also extends book.

So far i have

     abstract public class book implements Serializable {
        String author;
        String publication_date;
        Integer pages;
    public String toString(){
        return "";
    }
    public void edit(){};
   }
And this is my class comics witch will be edit through jpanel

     public class comics extends book implements Serializable {
     Integer number1;
     Integer number2;
     String name;

    public Samochod(String author, String publication_date, int pages, 
         int number1, int number2, String name){
        this.author = author;
        this.publication_date = publication_date;
        this.pages = pages;
        this.number1 = number1;
        this.number2 = number2;
        this.name = name;

    }

    public String toString(){
        return author + publication_date + pages + number1 + number2 + name;
    }

    private JPanel createPanel(){
        return new editComics(this);
    }
    public void e(){
         new Frame(createPanel());
    }
Frame witch is container

    public class Frame extends JFrame implements Serializable {
    public Frame(JPanel panel) {
        add(panel);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        pack();
        setVisible(true);
    }
    }

And i would like  avoid copy/paste code witch in every class repeat code witch create fields from book class

    public class editComics extends JPanel implements Serializable{
    comics obiekt ;
    private  JTextField author = new JTextField();
    private  JTextField publication_date = new JTextField();
    private  JTextField pages = new JTextField();
    private  JTextField number1 = new JTextField();
    private  JTextField number2 = new JTextField();
    private  JTextField name = new JTextField();

    public editComics(comics obiekt){
        super();
        this.obiekt = obiekt;
        setLayout(new BorderLayout());
        createPanels();
    }

    private void createPanels() {
        JPanel upperpane; = new JPanel();
        upperpane.setLayout(new GridLayout(3, 2)); 
        JButton save = new JButton("save");
        save.addActionListener(new ConvertListener());

        author.setText(obiekt.author);
        publication_date.setText(publication_date.marka);
        pages.setText(obiekt.pages.toString());
        number1.setText(obiekt.number1.toString());
        number2.setText(obiekt.number2.toString());
        name.setText(obiekt.name);

        upperpanel.add(author);
        upperpanel.add(new JLabel("author:"));
        upperpanel.add(publication_date);
        upperpanel.add(new JLabel("publication_date: "));
        upperpanel.add(pages);
        upperpanel.add(new JLabel("pages: "));
        upperpanel.add(number1);
        upperpanel.add(new JLabel("number1: "));
        upperpanel.add(number2);
        upperpanel.add(new JLabel("number2: "));
        upperpanel.add(name);
        upperpanel.add(new JLabel("name"));

        this.add(upperpanel, BorderLayout.CENTER);
        this.add(save, BorderLayout.SOUTH);
    }

Can someone give me advice how can i do it because all time repeat code is so bad but i dont know how do it.