去查看Swing组件都具有这功能,尤其是JXXHTML XXPanel...的你有些Caption直接setText("<html><font xxx>sdfsdfd...");
就ok

解决方案 »

  1.   

    好像一直没有好的解决方案
    jintegra 可以  使用过不错  就是整合的中间包
    不过要收费的http://www.intrinsyc.com/products/j-integra/
      

  2.   

    to:liaomingxue() 
    就是想在应用中实现一个简单的浏览器功能,
    如地址栏,GO,Back,Home,超链接这些
    就是用java实现浏览器谢谢先
      

  3.   

    还是给个演示程序你吧,把下面的代码放到一个Frame1.java文件中
    我不肯定能适合你的需要,因为我不能完全领会你的需要,希望对你有
    帮助:(下面用到的方法我也是从别人,但已经忘记是谁了,那里获得的)
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.event.*;public class Frame1
    {
      public static void main(String[] args)
      {
        JFrame frame = new EditorPaneFrame();
        frame.show();
      }
    }
    class EditorPaneFrame extends JFrame
    {
      public EditorPaneFrame()
      {
        this.setTitle("EditorPaneTest");
        this.setSize(600, 400);
        this.addWindowListener(new WindowAdapter()
        {
          public void windowClosing(WindowEvent e){  System.exit(0);  }
        } );
        // set up text field and load button for typing in URL
        url = new JTextField(30);
        loadButton = new JButton("Load");
        loadButton.addActionListener(new ActionListener()
        {
          public void actionPerformed(ActionEvent event)
          {
            try
            {  // remember URL for back button
               urlStack.push(url.getText());
               editorPane.setPage(url.getText());
            }
            catch(IOException e) {  editorPane.setText("Error: " + e); }
          }
         });
         // set up back button and button action
         backButton = new JButton("Back");
         backButton.addActionListener(new ActionListener()
         {
           public void actionPerformed(ActionEvent event)
           {
             if (urlStack.size() <= 1) return;
             try
             {  // get URL from back button
                urlStack.pop();
                // show URL in text field
                String urlString = (String)urlStack.peek();
                url.setText(urlString);
                editorPane.setPage(urlString);
             }
             catch(IOException e){  editorPane.setText("Error: " + e); }
           }
         });
         // set up editor pane and hyperlink listener
         editorPane = new JEditorPane();
         editorPane.setEditable(false);
         editorPane.addHyperlinkListener(new HyperlinkListener()
         {
           public void hyperlinkUpdate(HyperlinkEvent event)
           {
             if (event.getEventType()== HyperlinkEvent.EventType.ACTIVATED)
             {
               try
               {  // remember URL for back button
                  urlStack.push(event.getURL().toString());
                  // show URL in text field
                  url.setText(event.getURL().toString());
                  editorPane.setPage(event.getURL());
                }
                catch(IOException e){  editorPane.setText("Error: " + e);}
             }
           }
          });
          // set up checkbox for toggling edit mode
          editable = new JCheckBox();
          editable.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent event)
            {
              editorPane.setEditable(editable.isSelected());
            }
          });
          Container contentPane = getContentPane();
          contentPane.add(new JScrollPane(editorPane), "Center");
          // put all control components in a panel
          JPanel panel = new JPanel();
          panel.add(new JLabel("URL"));
          panel.add(url);
          panel.add(loadButton);
          panel.add(backButton);
          panel.add(new JLabel("Editable"));
          panel.add(editable);
          contentPane.add(panel, "South");
       }
       private JTextField url;
       private JCheckBox editable;
       private JButton loadButton;
       private JButton backButton;
       private JEditorPane editorPane;
       private Stack urlStack = new Stack();
    }
      

  4.   

    to:liaomingxue() 
    非常感谢,你的代码基本上能够实现我的想法,
    另外如果方便的话,麻烦告诉前进功能如何实现呢
      

  5.   

    to:liaomingxue()
    好像不支持javascript:)
    哪儿有官方的包下载吗
      

  6.   

    class EditorPaneFrame extends JFrame
    {
      private JTextField url;
      private JCheckBox editable;
      private JButton loadButton;
      private JButton backButton;
      private JButton forwardButton=new JButton("forward");
      private JEditorPane editorPane;
      final static int MAX_PAGES=100;
      private Vector pages=new Vector();
      private int currentPage=-1;
      public EditorPaneFrame()
      {
        this.setTitle("EditorPaneTest");
        this.setSize(600, 400);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        // set up text field and load button for typing in URL
        url = new JTextField(30);
        loadButton = new JButton("Load");
        loadButton.addActionListener(new ActionListener()
        {
          public void actionPerformed(ActionEvent event)
          {
            try
            {
               currentPage++;
               pages.add(url.getText());
               editorPane.setPage(url.getText());
            }
            catch(IOException e) {  editorPane.setText("Error: " + e); }
          }
         });     // set up back button and button action
         backButton = new JButton("Back");
         backButton.addActionListener(new ActionListener()
         {
           public void actionPerformed(ActionEvent event)
           {
             currentPage--;
             if(currentPage<0) return;
             try
             {
                String urlString = (String)pages.get(currentPage);
                url.setText(urlString);
                editorPane.setPage(urlString);
             }
             catch(IOException e){  editorPane.setText("Error: " + e); }
           }
         });
         forwardButton.addActionListener(new ActionListener()
         {
           public void actionPerformed(ActionEvent event)
           {
             currentPage++;
             if (currentPage>=pages.size()) return;
             try
             {
               String urlString = (String)pages.get(currentPage);
               url.setText(urlString);
               editorPane.setPage(urlString);
             }
             catch (IOException e) {editorPane.setText("Error: " + e);}
           }
         });     // set up editor pane and hyperlink listener
         editorPane = new JEditorPane();
         editorPane.setEditable(false);
         editorPane.addHyperlinkListener(new HyperlinkListener()
         {
           public void hyperlinkUpdate(HyperlinkEvent event)
           {
             if (event.getEventType()== HyperlinkEvent.EventType.ACTIVATED)
             {
               try
               {
                  currentPage++;
                  pages.add(event.getURL().toString());
                  url.setText(event.getURL().toString());
                  editorPane.setPage(event.getURL());
               }
               catch(IOException e){editorPane.setText("Error: " + e);}
             }
           }
          });
          // set up checkbox for toggling edit mode
          editable = new JCheckBox();
          editable.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent event)
            {
              editorPane.setEditable(editable.isSelected());
            }
          });
          Container contentPane = getContentPane();
          contentPane.add(new JScrollPane(editorPane), "Center");
          // put all control components in a panel
          JPanel panel = new JPanel();
          panel.add(new JLabel("URL"));
          panel.add(url);
          panel.add(loadButton);
          panel.add(backButton);
          panel.add(forwardButton);
          panel.add(new JLabel("Editable"));
          panel.add(editable);
          contentPane.add(panel, "South");
       }
    }
      

  7.   

    啊,javascript呀?如果你真的要超过ie,那么我是没有办法喽。你可以
    直接调用ie呀。
      

  8.   

    谁有办法把IE嵌在JAVA应用程序里我就服了他,我加他三百分
      

  9.   

    可以呀,下面时演示:不过要换个被演示的html哟:
    public class Frame1
    {
        public static void main(String[] args)
        {
          try
          {
            // 使用命令行,相当于在windows命令行中运行
            Runtime.getRuntime().exec("cmd  /c  start  F://javaProjects//WatMaker//doc//index.html");
          }
          catch (IOException e) {}
        }
    }
      

  10.   

    是内嵌,这样做是在程序外部启动,能嵌在JFrame或其他容器里吗?