Results 1 to 6 of 6

Thread: Use of JEditorPane class

  1. #1
    Join Date
    Dec 2009
    Posts
    41

    Use of JEditorPane class

    Hi All,

    I need your help to solve my confusion. I am totally confused about the JEditorPane class of advanced java. I want to use this java class in one of my java project. I have searched over various websites but didn't get proper detail over JEditorPane class. If you posses knowledge about the JEditorPane class of java, then please share it with me. You help would be greatly appreciated.

  2. #2
    Join Date
    May 2008
    Posts
    2,297

    Re: Use of JEditorPane class

    Hi,

    A JEditorPane class component uses implementations of the EditorKit to accomplish its behavior. It effectively morphs into the proper kind of text editor for the kind of content it is given. The content type that editor is bound to at any given time is determined by the EditorKit currently installed. If the content is set to a new URL, its type is used to determine the EditorKit that should be used to load the content.

  3. #3
    Join Date
    Oct 2005
    Posts
    2,393

    Re: Use of JEditorPane class

    Hi friend,

    If you want to know about the JEditorPane class, then please study following example of JEditorPane class:
    Code:
    import javax.swing.JEditorPane;
    import javax.swing.JScrollPane;
    import javax.swing.JFrame;
    
    public class JEditorPaneDM
     {
    
      public static void main(String[] adfg)throws Exception {
        JFrame fpl = new JFrame();
        fpl.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    
        JEditorPane editorPane01 = new JEditorPane();
    
        editorPane01.setPage(new URL("http://www....*--"));
    
        fpl.add(new JScrollPane(editorPane01));
    
        fpl.setSize(400, 200);
        fpl.setVisible(true);
      }
    
    }

  4. #4
    Join Date
    May 2008
    Posts
    2,389

    Re: Use of JEditorPane class

    Below I have mentioned some methods of JEditorPane class of java programming:
    • setEditorKitForContentType(String tp, EditorKit Ekt)
    • setEditorKit(EditorKit Ekt)
    • scrollToReference(String rfrn)
    • replaceSelection(String cntn)
    • removeHyperlinkListener(HyperlinkListener Hlistener)
    • registerEditorKitForContentType(String tp, String clsname)

  5. #5
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Use of JEditorPane class

    Hi,

    I hope below code will definitely help you to know about the use of JEditorPane class while showing the HTML file:
    Code:
    import javax.swing.JScrollPane;
    import javax.swing.JEditorPane;
    import javax.swing.JFrame;
    
    public class JDemo
    
     {
      public static void main(String[] argzs) throws Exception {
        JEditorPane ed = new JEditorPane("text/html",
            "<H1>A!</H1><P><FONT COLOR=blue>blue</FONT></P>");
        ed.setEditable(fdalse);
        JScrollPane pane1 = new JScrollPane(ed);
        JFrame fd = new JFrame("HTML Demo");
        fd.setDefdaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        fd.getContentPane().add(pane1);
        fd.setSize(700, 600);
        fd.setVisible(true);
      }
    }

  6. #6
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Use of JEditorPane class

    Following are some essential constructors of JEditorPane class:
    1. JEditorPane(URL InternalPage1): Used to create JEditorPane using input URL.
    2. JEditorPane(String tpe, String txt): Used to create JEditorPane using given text.
    3. JEditorPane(String Surl): Used to create JEditorPane using given URL.
    4. JEditorPane(): Used to creat simple JEditorPane.

Similar Threads

  1. Replies: 8
    Last Post: 08-10-2011, 11:06 PM
  2. What is the difference between Local class and global class in C++?
    By Dëfrim in forum Software Development
    Replies: 4
    Last Post: 03-01-2011, 10:44 PM
  3. Replies: 5
    Last Post: 12-02-2010, 06:23 PM
  4. Ultra solid drives:Imation M-Class and S-Class
    By Regina in forum Portable Devices
    Replies: 1
    Last Post: 03-04-2009, 10:34 AM
  5. Good news for CBSE CLASS X & CLASS IX - visit learnnext
    By surya_expert in forum Education Career and Job Discussions
    Replies: 0
    Last Post: 13-12-2008, 12:09 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,099,329.79224 seconds with 16 queries