當前位置: 首頁>>代碼示例>>Java>>正文


Java JEditorPane.setPreferredSize方法代碼示例

本文整理匯總了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;
}
 
開發者ID:meteoorkip,項目名稱:JavaGraph,代碼行數:18,代碼來源:BugReportDialog.java

示例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);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:17,代碼來源:PropertiesCustomEditor.java

示例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);

	}
 
開發者ID:igr,項目名稱:swingspy,代碼行數:43,代碼來源:SwingSpyPanel.java


注:本文中的javax.swing.JEditorPane.setPreferredSize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。