Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Java Swing JEditorPane

JEditorPaneÌṩÈýÖÖÀàÐ͵ÄÎı¾ÏÔʾ£¬text/plain,text/html,text/rtf.
JEditorPaneµÄ¼òµ¥Ó÷¨DEMOÈçÏ£º
package ibees.swing;
import java.awt.Toolkit;
import java.io.IOException;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;
/**
* JEditorPaneÖ§³Ötext/html,text/plain,text/rtfÄÚÈÝÏÔʾ
* ´ËDemoÖ÷ҪչʾÁËJEditorµÄÓ÷¨ºÍJFrameÈ«ÆÁµÄ·½·¨
* @author hhzxj2008
* */
public class JEditorPaneSample {
/**
* ÔÚJEditorÖÐÏÔʾHTML
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
JFrame jf = new JFrame("JEditorPaneʾÀý");

//text/htmlÎı¾ÀàÐÍ
final JEditorPane jep = new JEditorPane("http://csdn.net");
JScrollPane jsp = new JScrollPane(jep);//Ìí¼Ó¹ö¶¯Ö§³Ö
jep.addHyperlinkListener(new HyperlinkListener() {//Ìí¼ÓÁ´½Óµã»÷¼àÌýÕß

@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
if(e.getEventType() == HyperlinkEvent.EventType.ACTIVATED){
try {
jep.setPage(e.getURL());//ÉèÖÃÏÔʾµÄURL×ÊÔ´
} catch (IOException e1) {
e1.printStackTrace();
}
}

}
});
jf.add(jsp);

jf.setSize(Toolkit.getDefaultToolkit().getScreenSize().getSize());//´°¿ÚÈ«ÆÁ
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jf.setVisible(true);
}
}
  


Ïà¹ØÎĵµ£º

JavaÖеĶÑÕ»(°ïÄãÀí½âÄÚ´æÄ£ÐÍ)

JavaÖжÑÕ»µÄ¸ÅÄȻÊÇÂß¼­Éϵģ¬ÔÚÍêÈ«·ûºÏJava¹æ·¶µÄJava´¦ÀíÆ÷ÃæÊÀ֮ǰ£¬ËùÓÐJavaÐéÄâ»úÌṩµÄÄÚÈݶ¼ÊÇÓÉÈí¼þÄ£Äâ³öÀ´µÄ¡£
ʲô½Ð¶Ñ£¿ÄãÓÃÊ®¼¸¸öÂ齫ÅÆÊúÖ±µþ³ÉÒ»ÞûÕâ½Ð¶Ñ£¬Äã¿ÉÒÔ´ÓÉÏÃæ¡¢ÏÂÃæ¡¢ÖмäÈÎÒâ³é³öÒ»ÕÅÅÆ£¬Ò²¿ÉÒÔÈÎÒâ²åÈëÒ»ÕÅ¡£
ʲô½ÐÕ»£¿AK-47µÄµ¯Ï»¾ÍÊÇÒ»¸öÕ»£¬ÔÚÉÏÃæµÄ×Óµ¯Ã»±»È¡³ö֮ǰ£¬ÄãÎÞ·¨È¡³öÏÂà ......

Java¼¸¸ö¹ýÂËÆ÷ѧϰ¼¼ÇÉ

import javax.servlet.*;
¡¡¡¡import javax.servlet.http.HttpServletResponse;
¡¡¡¡import java.io.IOException;
¡¡¡¡/**
¡¡¡¡* ÓÃÓÚµÄʹ Browser ²»»º´æÒ³ÃæµÄ¹ýÂËÆ÷
¡¡¡¡*/
¡¡¡¡public class ForceNoCacheFilter
¡¡¡¡implements Filter
¡¡¡¡{
¡¡¡¡publi ......

¹ØÓÚjavaµÄhashCode·½·¨

JavaÖеļ¯ºÏ£¨Collection£©ÓÐÁ½À࣬һÀàÊÇList£¬ÔÙÓÐÒ»ÀàÊÇSet¡£ÄãÖªµÀËüÃǵÄÇø±ðÂð£¿Ç°Õß¼¯ºÏÄÚµÄÔªËØÊÇÓÐÐòµÄ£¬ÔªËØ¿ÉÒÔÖظ´£»ºó
ÕßÔªËØÎÞÐò£¬µ«ÔªËز»¿ÉÖظ´¡£ÄÇôÕâÀï¾ÍÓÐÒ»¸ö±È½ÏÑÏÖصÄÎÊÌâÁË£ºÒªÏë±£Ö¤ÔªËز»Öظ´£¬¿ÉÁ½¸öÔªËØÊÇ·ñÖظ´Ó¦¸ÃÒÀ¾ÝʲôÀ´ÅжÏÄØ£¿Õâ¾ÍÊÇ
Object.equals·½·¨ÁË¡£µ«ÊÇ£¬Èç¹ûÿÔö¼ÓÒ»¸öÔªËØ ......

JavaʱÇøbug£¬TimeZone.setDefault()Ö»ÔÚµ±Ç°Ïß³ÌÓÐЧ

   ÏîÄ¿ÊÇ»ùÓÚGMTʱ¼äµÄ£¬ÔÚϵͳÆô¶¯µÄʱºò£¬ÎÒÃǾͻáµ÷ÓÃTimeZone.setDefault(timeZone)½«Ä¬ÈÏʱÇøÉèΪGMT¡£
   ºóÀ´Í»È»·¢ÏÖ£¬ÓÐʱÓû§Ñ¡ÔñµÄʱ¼ä¾­¹ýºǫ́һȦºó»Ø²úÉú8¸öСʱÎó²î¡£ÓÖÊǼäЪÐԵģ¬ÒªËûÖØÏÖµÄʱºòÓÖÆ«²»À´¡£¿àÐÄdebug£¬ÖÕÓÚ·¢ÏÖÔÚ²¿·ÖÏß³ÌÖУ¬Ê±Çø»¹ÊÇGMT+8£¬ºǫ́ij¸öµ÷ÓÿÉÄÜ°ÑʱÇø ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ