国产gaysexchina男同gay,japanrcep老熟妇乱子伦视频,吃奶呻吟打开双腿做受动态图,成人色网站,国产av一区二区三区最新精品

App下載
首頁javajeditorpaneJava Swing - 如何在JEditorPane上顯示圖像

Java Swing - 如何在JEditorPane上顯示圖像

我們想知道如何在JEditorPane上顯示圖像。
import java.io.IOException;
import javax.swing.JEditorPane;
import javax.swing.JFrame;

public class Main extends JFrame {

  public static void main(String[] args) throws Exception {
    Main.createAndShowGUI();
  }

  private static void createAndShowGUI() throws IOException {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    String imgsrc = Main.class.getClassLoader().getSystemResource("a.jpg")
        .toString();
    frame.getContentPane().add(
        new JEditorPane("text/html", "<html><img src='" + imgsrc
            + "' width=200height=200></img>"));
    frame.pack();

    frame.setVisible(true);
  }
}