Loading an html document to JTextPane is making my editor to behave very badly in paste?

If you want "open" the html document in your text editor, you should use a JEditorPane combined (if it's necessary) which a JScrollPane. Here's an example code (It needs try/catch blocks).

If you want "open" the html document in your text editor, you should use a JEditorPane combined (if it's necessary) which a JScrollPane. Here's an example code (It needs try/catch blocks): private void visualiserLog() { JEditorPane docEP = new JEditorPane(); docEP. SetEditable(true); File f = new File(/path/to/file.

Html); java.net. URL fileURL = null; try { fileURL = f.toURI().toURL(); // Transform path into URL } catch (MalformedURLException e1) { e1.printStackTrace(); } try { docEP. SetPage(fileURL); // Load the file to the editor } catch (IOException e) { e.printStackTrace(); } // Initialize scroll pane (if you need it) JScrollPane docSP = new JScrollPane(docEP, ScrollPaneConstants.

VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants. HORIZONTAL_SCROLLBAR_AS_NEEDED); docSP. SetPreferredSize(new Dimension(800,700)); // Set up a frame to layout the editor panel JFrame frame = new JFrame("HTML File"); frame.

SetDefaultCloseOperation(DISPOSE_ON_CLOSE); frame. SetLayout(new BorderLayout()); frame. SetBounds(0,0,800,700); // If you don't use ScrollPane, you must swap docSP for docEP frame.getContentPane().

Add(docSP,BorderLayout. CENTER); frame. SetVisible(true); } I think that can works properly to set the file into the editor.

After that you should put the copy function and the necessary listeners. Regards!

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions