Results 1 to 1 of 1
- 09-14-2012, 05:42 PM #1
Member
- Join Date
- Jan 2012
- Posts
- 11
- Rep Power
- 0
Image and Hyperlink issues (JEditorPane
First thing when i copy and paste the output of my JDailog (What this textpane is displayed on), the image is coming out with "ignored text" How can I get it to copy the image?
Second problem: I want the variable regLink to be a hyperlink. How can I do this?
Here is my code:
Java Code:String fName = jt_fName.getText(); String lName = jt_lName.getText(); String telNet = jt_telNet.getText(); String telPhone = jt_telPhone.getText(); String mobPhone = jt_mobPhone.getText(); String role = jt_role.getText(); String img = jt_imgBanner.getText(); String regLink = jt_regLink.getText(); String regText = jt_regText.getText(); // Get the text pane's document JTextPane textPane = new JTextPane(); textPane.setEditable(false); StyledDocument doc = (StyledDocument)textPane.getDocument(); javax.swing.text.Style style2 = doc.addStyle("StyleName", null); // The image must first be wrapped in a style javax.swing.text.Style style = doc.addStyle("StyleName", null); StyleConstants.setIcon(style, new ImageIcon(img)); // Insert the image at the end of the text try { doc.insertString(doc.getLength(),fName + lName + "\n" + "Role: " + role + "\n" + "Telnet: " + telNet + "\n" + "Telphone Number: " + telPhone + "\n" + "Mobile Number: " + mobPhone + "\n", style2); doc.insertString(doc.getLength(), "ignored text", style); doc.insertString(doc.getLength(), "Register Here: " + regLink + " | " + regText, style2); } catch (BadLocationException e1) { // TODO Auto-generated catch block e1.printStackTrace(); }Last edited by cfc1252; 09-14-2012 at 05:47 PM.
Similar Threads
-
Having issues with drawing portion of an image
By 7H3LaughingMan in forum Java 2DReplies: 2Last Post: 05-03-2012, 06:50 AM -
Image issues
By Toll in forum Advanced JavaReplies: 7Last Post: 05-20-2011, 04:38 AM -
Getting the hyperlink URL
By leifster in forum New To JavaReplies: 1Last Post: 11-27-2010, 05:01 PM -
How to display image in JEditorPane
By usccar in forum New To JavaReplies: 1Last Post: 12-10-2009, 06:34 AM -
Hyperlink in swing
By aneesahamedaa in forum AWT / SwingReplies: 1Last Post: 07-28-2008, 03:41 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks