HTML表格边框的java Swing呈现 1 周,5 日 Questions & Answers 1763 从javax.swing.text.html.CSS的JavaDoc来看,它只提供有限的CSS支持。边界已建模但未渲染 如何扩展类以提供边界渲染,最佳起点在哪里
# 1 楼答案 Java的CSS呈现当然支持边框。例如 import java.awt.*; import javax.swing.*; class SwingHTMLBorder { static String html = "<html>" + "<head>" + "<style type='text/css'>" + "p {" + " border: solid 1px red;" + "}" + "</style>" + "</head>" + "<body>" + "<p>Do you see a border?</p>" + "<table border=1>" + "<tr>" + "<td>Cell 1</td>" + "<td>Cell 2</td>" + "</tr>" + "</table>"; public static void main(String[] args) { Runnable r = new Runnable() { @Override public void run() { JOptionPane.showMessageDialog(null, new JLabel(html)); } }; // Swing GUIs should be created and updated on the EDT // http://docs.oracle.com/javase/tutorial/uiswing/concurrency SwingUtilities.invokeLater(r); } }
# 1 楼答案
Java的CSS呈现当然支持边框。例如