本文整理匯總了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);
}