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;

How to do this in Java?

I resolve my problem by changing the following code:

  Listbox Entry AdListSignitionListener (New List Selection Listener) {Public Zero Value Changed (Selectivevent RGET) {{String Query = "Entry List, Meaning, Select Formulas from Entry, Where Are Entry Listings Preferred?" = Connection.prepareStatement (query); pst setString (1, (string) ListboxEntry.getSe lectedValue ()); rs = pst.executeQuery (ResultSet); while (rs.next ()) {txtEntry.setText (rs.getString ( "EntryLists")); txtMeanings.setText (Rsgetstring ( "Earth")); txtSources .setText (rs.getString ( "source"));} pst.close (); rsclose ();} catch (exception e) {e.printStackTrace ();} string htmlText = "& lt; html & gt;" + "& Lt; body & gt;" + "& lt; div class = 'content' & gt; + + + txtMeanings.getText () +" & lt; / div & gt; "+" & lt; div class = 'Footnote' & gt; "+ txtSources.getText () +" & lt; / div> "+" & lt; / Body & gt; "+" & lt; / Html> "; EditorPane.setText (htmlText);}});  

However, if someone wants to correct it, then your suggestion is welcome.


Comments