KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > javax > swing > JEditorPane

javax.swing
Class JEditorPane

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.text.JTextComponent
                  extended by javax.swing.JEditorPane
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, Scrollable
Direct Known Subclasses:
JTextPane
See Also:
Top Examples, Source Code, XMLEncoder, HONOR_DISPLAY_PROPERTIES, W3C_LENGTH_UNITS

public void addHyperlinkListener(HyperlinkListener listener)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


protected EditorKit createDefaultEditorKit()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static EditorKit createEditorKitForContentType(String type)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void fireHyperlinkUpdate(HyperlinkEvent e)
See Also:
EventListenerList
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public AccessibleContext getAccessibleContext()
See Also:
JTextComponent, Accessible
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public final String getContentType()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public EditorKit getEditorKit()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static String getEditorKitClassNameForContentType(String type)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public EditorKit getEditorKitForContentType(String type)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public HyperlinkListener[] getHyperlinkListeners()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public URL getPage()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Dimension getPreferredSize()
See Also:
ComponentUI, JComponent.setPreferredSize(java.awt.Dimension)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public boolean getScrollableTracksViewportHeight()
See Also:
JTextComponent, Scrollable
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public boolean getScrollableTracksViewportWidth()
See Also:
JTextComponent, Scrollable
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


protected InputStream getStream(URL page)
                         throws IOException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String getText()
See Also:
setText(java.lang.String), JTextComponent
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String getUIClassID()
See Also:
UIDefaults.getUI(javax.swing.JComponent), JComponent
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static final String HONOR_DISPLAY_PROPERTIES
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public JEditorPane()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[102]Render simple HTML using JEditorPane
By Anonymous on 2005/01/08 11:42:32  Rate
//render simple HTML using JEditorPane 
 HTMLEditorKit htmlKit = new HTMLEditorKit (  ) ; 
 JEditorPane ep = new JEditorPane (  ) ; 
 ep.setEditorKit ( htmlKit ) ; 
  
  
 BufferedReader in = new BufferedReader (  
 new StringReader (  
  " < HTML >  < TITLE > The Title < /TITLE >  
  < BODY >  < I > italics < /I >  < /BODY >  < /HTML > " )  ) ; 
  
  
 htmlKit.read ( in, ep.getDocument (  ) ,0 ) ; 
 


public JEditorPane(String url)
            throws IOException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public JEditorPane(String type,
                   String text)
See Also:
NullPointerException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public JEditorPane(URL initialPage)
            throws IOException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[103]Create html area
By Anonymous on 2002/10/18 17:54:38  Rate
//create html area 
 JEditorPane quotePane = null; 
 JScrollPane scrollPane = null; 
 try  {  
     URL url = new URL ( "http://www.KickJava.com" ) ; 
     quotePane = new JEditorPane ( url ) ; 
     quotePane.setEditable ( false ) ; 
     scrollPane = new JScrollPane ( quotePane ) ; 
     scrollPane.setPreferredSize ( new Dimension ( 300, 175 )  ) ; 
     if  ( DEBUG )  
   System.out.println ( quotePane.getText (  )  ) ; 
  
  
  }  catch  ( java.io.IOException e )   {  
     scrollPane = new JScrollPane ( new JTextArea ( "Can't find HTML file." )  ) ; 
     scrollPane.setFont ( demoFont ) ; 
  }  
  
  
 


protected String paramString()
See Also:
JTextComponent
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void read(InputStream in,
                 Object desc)
          throws IOException
See Also:
JTextComponent.setDocument(javax.swing.text.Document), JTextComponent.read(java.io.Reader, java.lang.Object)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[879]Display a HTML file
By Garry on 2004/11/18 05:21:52  Rate
    JEditorPane pane = new JEditorPane (  ) ; 
     pane.setEditable ( false ) ; 
     pane.setContentType ( "text/hmtl" ) ; 
      
     HTMLDocument h = new HTMLDocument (  ) ; 
     HTMLEditorKit ek = new HTMLEditorKit (  ) ; 
     pane.setEditorKit ( ek ) ; 
      
     try 
      {  
       FileReader fileReader = new FileReader ( "H:\\misc\\foo.html ) ; 
       pane.read ( fileReader, h ) ; 
  
  
      }  
     catch  ( FileNotFoundException e )  
      {  
       // TODO Auto-generated catch block 
       System.out.println ( "File was not found" ) ; 
       e.printStackTrace (  ) ; 
        
      }   
     catch  ( IOException e )  
      {  
       // TODO Auto-generated catch block 
       e.printStackTrace (  ) ; 
      } 


public static void registerEditorKitForContentType(String type,
                                                   String classname)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static void registerEditorKitForContentType(String type,
                                                   String classname,
                                                   ClassLoader loader)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void removeHyperlinkListener(HyperlinkListener listener)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void replaceSelection(String content)
See Also:
JTextComponent
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void scrollToReference(String reference)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public final void setContentType(String type)
See Also:
getContentType(), NullPointerException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[833]Use JEditorPane for plain text or HTML
By Anonymous on 2004/07/12 06:17:09  Rate
//plain text 
 javax.swing.JEditorPane editor = new javax.swing.JEditorPane (  ) ; 
 editor.setContentType ( "text/plain" ) ; 
 editor.setText ( "plain text" ) ; 
  
  
 //html  
 javax.swing.JEditorPane editor = new javax.swing.JEditorPane (  ) ; 
 editor.setContentType ( "text/html" ) ; 
 editor.setText ( " < b > bold text < /b > " ) ;


public void setEditorKit(EditorKit kit)
See Also:
getEditorKit()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setEditorKitForContentType(String type,
                                       EditorKit k)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setPage(String url)
             throws IOException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setPage(URL page)
             throws IOException
See Also:
getPage()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setText(String t)
See Also:
getText(), JTextComponent
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static final String W3C_LENGTH_UNITS
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  

Popular Tags