比如说:用ie打开sina新闻的页面,然后把整个页面嵌入到我的Swing里面(去掉地址栏,收藏夹之类的功能,只要内容)
就相当于外面皮实CS,其实内部是BS。
不知道大家能不能看懂我想表达的意思。

解决方案 »

  1.   

    java web start 不就是...
      

  2.   

    能看懂!就是用SWING做浏览器是吧???
      

  3.   

    嵌套进去,不是做。
    好像有个 jdic 东西。。??
      

  4.   

    刚刚找了个例子,但是嵌套进去的网页格式都变了,特别乱。import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.event.*;/**
     * This program demonstrates how to display HTML documents in an editor pane.
     */
    public class EditorPaneTest {
    public static void main(String[] args) {
    JFrame frame = new EditorPaneFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
    }
    }/**
     * This frame contains an editor pane, a text field and button to enter a URL
     * and load a document, and a Back button to return to a previously loaded
     * document.
     */
    class EditorPaneFrame extends JFrame {
    public EditorPaneFrame() {
    setTitle("EditorPaneTest ");
    setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); final Stack<String> urlStack = new Stack<String>();
    final JEditorPane editorPane = new JEditorPane();
    final JTextField url = new JTextField(30); // set up hyperlink listener 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("Exception:   " + e);
    }
    }
    }
    }); // set up checkbox for toggling edit mode final JCheckBox editable = new JCheckBox();
    editable.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent event) {
    editorPane.setEditable(editable.isSelected());
    }
    }); // set up load button for loading URL ActionListener listener = 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("Exception:   " + e);
    }
    }
    }; JButton loadButton = new JButton("Load ");
    loadButton.addActionListener(listener);
    url.addActionListener(listener); // set up back button and button action JButton 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 = urlStack.peek();
    url.setText(urlString);
    editorPane.setPage(urlString);
    } catch (IOException e) {
    editorPane.setText("Exception:   " + e);
    }
    }
    }); add(new JScrollPane(editorPane), BorderLayout.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); add(panel, BorderLayout.SOUTH);
    } private static final int DEFAULT_WIDTH = 600;
    private static final int DEFAULT_HEIGHT = 400;
    }
      

  5.   

    为什么要采用SWING嵌套网页呢?不知道LZ的需求是什么?目的又何在?
      

  6.   

    说起来挺可笑的
    我们公司给客户简单的弄了一个股票的系统,BS模式的,但是他说要CS的,所以才想了这么一招,先应付过去,签了合同再说。
      

  7.   

    哈哈,居然想出了这招!可惜SWING实现不了
      

  8.   

    Swing中可以显示网页的,不一定要涉及到ie,使用JEditorPane