The problem is here:
contentPane.add(textPane, BorderLayout.CENTER);
At this point, you haven’t set up textPane. You set it up 4 lines later:
textPane = new JTextPane();
textPane.setBackground(Color.DARK_GRAY);
textPane.setEditable(false);
textPane.setMargin(null);
textPane.setContentType("text/html");
You need to add it to the pane after initializing.
Simple debugging would have fixed this problem for you. SO is not an appropriate place for “fix my code” questions.
7
solved NullPointerException Runtimer Error [closed]