本文整理汇总了Java中javax.swing.JEditorPane.setPreferredSize方法的典型用法代码示例。如果您正苦于以下问题:Java JEditorPane.setPreferredSize方法的具体用法?Java JEditorPane.setPreferredSize怎么用?Java JEditorPane.setPreferredSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JEditorPane
的用法示例。
在下文中一共展示了JEditorPane.setPreferredSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getErrorMessage
import javax.swing.JEditorPane; //导入方法依赖的package包/类
private JEditorPane getErrorMessage() {
JEditorPane errorMsg = new JEditorPane();
errorMsg.setEditable(false);
errorMsg.setPreferredSize(new Dimension(700, 130));
errorMsg.setBackground(null);
// Text font
Font font = new Font("Sans", Font.PLAIN, 6);
errorMsg.setFont(font);
// Handle HTML
errorMsg.setEditorKit(new HTMLEditorKit());
errorMsg.addHyperlinkListener(this);
errorMsg.setText(ERROR_MSG);
return errorMsg;
}
示例2: initComponents
import javax.swing.JEditorPane; //导入方法依赖的package包/类
/** This method is called from within the constructor to
* initialize the form.
*/
private void initComponents() {
setLayout(new BorderLayout());
editorPane = new JEditorPane();
editorPane.setContentType("text/x-properties"); // NOI18N
// XXX pretty arbitrary! No way to set by rows & columns??
editorPane.setPreferredSize(new Dimension(200, 100));
add(new JScrollPane(editorPane), BorderLayout.CENTER);
warnings = new JTextField(30);
warnings.setEditable(false);
add(warnings, BorderLayout.SOUTH);
}
示例3: SwingSpyPanel
import javax.swing.JEditorPane; //导入方法依赖的package包/类
/**
* Initialization.
*/
public SwingSpyPanel() {
setPreferredSize(new Dimension(INITIAL_WIDTH, INITIAL_HEIGHT));
setLayout(new BorderLayout());
root = new DefaultMutableTreeNode();
componentTree = new JTree(root);
componentTree.setRootVisible(false);
componentTree.setCellRenderer(new SwingComponentRenderer());
componentTree.addTreeSelectionListener(new CustomSelectionListener());
// add(new JScrollPane(componentTree), BorderLayout.CENTER);
detailsData = new JEditorPane();
detailsData.setBackground(new Color(250, 250, 250));
detailsData.setForeground(new Color(33, 33, 33));
detailsData.setBorder(BorderFactory.createLineBorder(new Color(100, 100, 244), 1));
detailsData.setPreferredSize(new Dimension(150, INITIAL_HEIGHT));
detailsData.setEditable(false);
detailsData.setContentType("text/html");
SwingUtil.enforceJEditorPaneFont(detailsData, font);
detailsScrollPane = new JScrollPane(detailsData);
// add(detailsScrollPane, BorderLayout.EAST);
JSplitPane hPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(componentTree), detailsScrollPane);
hPane.setContinuousLayout(true);
hPane.setOneTouchExpandable(true);
hPane.setDividerLocation(INITIAL_WIDTH - 200);
add(hPane, BorderLayout.CENTER);
componentData = new JEditorPane();
componentData.setBackground(new Color(250, 250, 250));
componentData.setForeground(new Color(33, 33, 33));
componentData.setBorder(BorderFactory.createLineBorder(new Color(100, 100, 244), 1));
componentData.setPreferredSize(new Dimension(INITIAL_WIDTH, 36));
componentData.setEditable(false);
componentData.setContentType("text/html");
SwingUtil.enforceJEditorPaneFont(componentData, font);
add(componentData, BorderLayout.SOUTH);
}