How to pass data from two textfield to Jeditorpane as html? -
I try to recover data from the database and generate it in the jellist. After this, when I click on the list, the data will arrive in the 3 Textfield. Two of them will be populated in the form of a combination of HTML file in a combination of HTML file. I have tried the following method but it makes an error.
string means 1 = txtMeanings.getText (); String source 1 = txtSources.getText (); String htmlText = "& lt; html & gt;" + "& Lt; body & gt;" + "& Lt; div class = 'content' & gt; {meaning 1} & lt; / div & gt; + "& Lt; div class = 'footnote' & gt; {source1} & lt; / div & gt; + "& Lt; / body & gt;" + "& Lt; / html & gt;"; JScrollPane scrollPane_1 = new JScrollPane (); ScrollPane_1.setBounds (10, 40, 529, 387); Panel_2.add (scrollPane_1); HTMLEditorKit head = new HTMLEditorKit (); Style Sheet SS = Head. Stylus Sheet (); Ss.addRule ("body {...}"); Ss.addRule ("h1 {...}"); Ss.addRule ("P {...}"); Ss.addRule ("blockquote {...}"); Ss.addRule ("# title {...}"); Ss.addRule ("bell {...}"); Ss.addRule ("#Content {...}"); Ss.addRule ("# Footer {...}"); Document Doctor = hed.createDefaultDocument (); EditorPan = new ZDatorPan (); EditorPane.setContentType ("text / html"); EditorPane.setEditorKit (hed); EditorPane.setDocument (doc); EditorPane.setEditable (wrong); ScrollPane_1.setViewportView (editorPane); ListboxEntry.addListSelectionListener (select new ListSelectionListener () {public void valueChanged (ListSelectionEvent arg0) {try {String query = "entry says EntryLists, meaning, sources where such EntryLists? '; PreparedStatement Pst = ConnectionkprepareStatement ( query); pst.setString (1, (string) ListboxEntry.getSelectedValue ()); rs = pst.executeQuery (ResultSet); while (rs.next ()) {txtEntry.setText (rs.getString ( "EntryLists")) ; txtMeanings.setText (Rs .getstring ( "Earth")); txtSources.setText (rs.getString ( "source"));} pst.close (); rsclose ();} catch (exception e) {e.printStackTrace ();} EditorPane.setText (htmlText);}}); What should I do? Is it possible to implement two figures (meaning and source) without first generating it in Jeditorpane for the first time in two lessons? In VB.Net, I simply solve the problem by putting this simple code: html & gt; & Lt; Top & gt; & Lt; Style and gt; & Lt
WebBrowser1.DocumentText = String.Format ( "& LT; - body {{....}} - & gt; & lt; / style and gt; & lt; / Head> gt;
Comments
Post a Comment