我只想实现 Bullets (ordered list & unordered list)
高手们可以帮我修正吗?import java.awt.*;
import javax.swing.*;
import javax.swing.text.html.*;public class BasicEditor extends JFrame { private JTextPane editor; public BasicEditor() { try {
JPanel buttonPanel = new JPanel(); editor = new JTextPane();
editor.setContentType("text/html"); JButton bulletButton = new JButton("Bullets");
String INSERT_UL_HTML = "<ul><li></li></ul>";
HTMLEditorKit.InsertHTMLTextAction bulletAction = new HTMLEditorKit.InsertHTMLTextAction("Bullets", INSERT_UL_HTML,
HTML.Tag.UL, HTML.Tag.LI,
HTML.Tag.BODY, HTML.Tag.UL);
bulletButton.setAction(bulletAction);
buttonPanel.setLayout(new FlowLayout());
buttonPanel.add(bulletButton); JScrollPane scrollPane = new JScrollPane(editor);
scrollPane.setPreferredSize(new Dimension(getSize().width * 7 / 8, getSize().height * 5 / 8)); getContentPane().add(buttonPanel, BorderLayout.NORTH);
getContentPane().add(scrollPane, BorderLayout.CENTER);
setSize(600, 500);
setDefaultCloseOperation(EXIT_ON_CLOSE);
} catch (Exception e) {
e.printStackTrace();
} } public static void main(String[] args) {
BasicEditorApplet bea = new BasicEditorApplet();
bea.setVisible(true);
}
}
高手们可以帮我修正吗?import java.awt.*;
import javax.swing.*;
import javax.swing.text.html.*;public class BasicEditor extends JFrame { private JTextPane editor; public BasicEditor() { try {
JPanel buttonPanel = new JPanel(); editor = new JTextPane();
editor.setContentType("text/html"); JButton bulletButton = new JButton("Bullets");
String INSERT_UL_HTML = "<ul><li></li></ul>";
HTMLEditorKit.InsertHTMLTextAction bulletAction = new HTMLEditorKit.InsertHTMLTextAction("Bullets", INSERT_UL_HTML,
HTML.Tag.UL, HTML.Tag.LI,
HTML.Tag.BODY, HTML.Tag.UL);
bulletButton.setAction(bulletAction);
buttonPanel.setLayout(new FlowLayout());
buttonPanel.add(bulletButton); JScrollPane scrollPane = new JScrollPane(editor);
scrollPane.setPreferredSize(new Dimension(getSize().width * 7 / 8, getSize().height * 5 / 8)); getContentPane().add(buttonPanel, BorderLayout.NORTH);
getContentPane().add(scrollPane, BorderLayout.CENTER);
setSize(600, 500);
setDefaultCloseOperation(EXIT_ON_CLOSE);
} catch (Exception e) {
e.printStackTrace();
} } public static void main(String[] args) {
BasicEditorApplet bea = new BasicEditorApplet();
bea.setVisible(true);
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货