如果你想做一个类似于浏览器的东西,可以使用第三方的一些东西,比较方便。
我用c++做过,java的我关注!!!!!兼帮忙找找!!!

解决方案 »

  1.   

    swing本身就可以在控件中显示html:
    Button b=new Button("<html><font color='red'>确定</font></html>");
      

  2.   

    to flyxxxxx(灭神) 
    Button b=new Button("<html><font color='red'>确定</font></html>");
    我试了你这种方法不行,我用的是JButton,Button是AWT的
      

  3.   

    javax.swing.JEditorPane
    可以直接显示html3.2:
    HTML text. The kit used in this case is the class javax.swing.text.html.HTMLEditorKit which provides HTML 3.2 support.
      

  4.   

    我用javax.swing.JEditorPane,是可以显示了,
    我用它的setText()方法,传的是一个html文本,但它如果这个文本中有下面这句话,它就显示不出来了,不知为何
    <meta http-equiv="content-type" content="text/html; charset=GB2312">
    兄弟们帮帮忙,解决就结帖
      

  5.   

    JEditorPane应该可以,测试一下
      

  6.   

    我用javax.swing.JEditorPane,是可以显示了,
    我用它的setText()方法,传的是一个html文本,但它如果这个文本中有下面这句话,它就显示不出来了,不知为何
    String html= ....//from <meta http-equiv="content-type" content="text/html; charset=GB2312">html=html.replaceAll("<meta http","<my http");