当前位置: 首页>>代码示例>>Java>>正文


Java JTextPane.setText方法代码示例

本文整理汇总了Java中javax.swing.JTextPane.setText方法的典型用法代码示例。如果您正苦于以下问题:Java JTextPane.setText方法的具体用法?Java JTextPane.setText怎么用?Java JTextPane.setText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JTextPane的用法示例。


在下文中一共展示了JTextPane.setText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupPane

import javax.swing.JTextPane; //导入方法依赖的package包/类
public void setupPane(JTextPane pane, final File[] files, String fileNames, final File projectDir, final String url, final String revision) {
     String msg = revision == null
             ? NbBundle.getMessage(NotificationsManager.class, "MSG_NotificationBubble_DeleteDescription", fileNames, CMD_DIFF) //NOI18N
             : NbBundle.getMessage(NotificationsManager.class, "MSG_NotificationBubble_Description", fileNames, url, CMD_DIFF); //NOI18N
    pane.setText(msg);

    pane.addHyperlinkListener(new HyperlinkListener() {
        @Override
        public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) {
                if(CMD_DIFF.equals(e.getDescription())) {
                    Context ctx = new Context(files);
                    DiffAction.diff(ctx, Setup.DIFFTYPE_REMOTE, NbBundle.getMessage(NotificationsManager.class, "LBL_Remote_Changes", projectDir.getName()), false); //NOI18N
                } else if (revision != null) {
                    try {
                        SearchHistoryAction.openSearch(new SVNUrl(url), projectDir, Long.parseLong(revision));
                    } catch (MalformedURLException ex) {
                        LOG.log(Level.WARNING, null, ex);
                    }
                }
            }
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:NotificationsManager.java

示例2: createInfoPanel

import javax.swing.JTextPane; //导入方法依赖的package包/类
private static JTextPane createInfoPanel(String notification) {
    JTextPane balloon = new JTextPane();
    balloon.setContentType("text/html");
    String text = getDetails(notification).replaceAll("(\r\n|\n|\r)", "<br>");
    balloon.setText(text);
    balloon.setOpaque(false);
    balloon.setEditable(false);
    balloon.setBorder(new EmptyBorder(0, 0, 0, 0));


    if (UIManager.getLookAndFeel().getID().equals("Nimbus")) {
        //#134837
        //http://forums.java.net/jive/thread.jspa?messageID=283882
        balloon.setBackground(new Color(0, 0, 0, 0));
    }

    balloon.addHyperlinkListener(new HyperlinkListener() {

        public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) {
                URLDisplayer.getDefault().showURL(e.getURL());
            }
        }
    });
    return balloon;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:ShowNotifications.java

示例3: createDefaultHelp

import javax.swing.JTextPane; //导入方法依赖的package包/类
/**
 * Creates a default help panel, listing all the setting kinds for a given exploration key
 * with corresponding explanations.
 */
protected JTextPane createDefaultHelp(ExploreKey key) {
    JTextPane result = createTextPane();
    StringBuilder text = getExplanation(key);
    StringBuilder list = new StringBuilder();
    HTMLTag dt = new HTMLTag("dt");
    HTMLTag dd = new HTMLTag("dd");
    HTMLTag strong = HTMLConverter.STRONG_TAG;
    for (SettingKey kind : key.getKindType()
        .getEnumConstants()) {
        list.append(dt.on(strong.on(StringHandler.toUpper(kind.getName()))));
        list.append(dd.on(kind.getExplanation()));
    }
    new HTMLTag("dl").on(list);
    text.append(list);
    result.setText(text.toString());
    return result;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:22,代码来源:HelpFactory.java

示例4: initComponents

import javax.swing.JTextPane; //导入方法依赖的package包/类
private void initComponents() {
	Box vBox = Box.createVerticalBox();
	Box hBox = Box.createHorizontalBox();
	synView = new JTextPane();
	synView.setContentType("text/html");
	synView.setEditable(false);
	synScroll = new JScrollPane(synView);
	synScroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
	synScroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
	vBox.add(Box.createVerticalStrut(30));
	vBox.add(hBox);
	vBox.add(Box.createVerticalStrut(30));
	hBox.add(Box.createHorizontalStrut(20));
	hBox.add(synScroll);
	hBox.add(Box.createHorizontalStrut(20));
	this.setLayout(new GridLayout(1, 1));
	this.add(vBox);
	synView
			.setText("<html><body><center><font face=\"bold\" size=\"3\">Saturation Sectors will be here displayed once you solve the model.</font></center></body></html>");
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:21,代码来源:SectorsTextualPanel.java

示例5: getTreeCellRendererComponent

import javax.swing.JTextPane; //导入方法依赖的package包/类
@Override public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded,
        boolean leaf, int row, boolean hasFocus) {
    JTextPane pane = new JTextPane();
    if (sel) {
        pane.setBackground(bgSel);
        pane.setForeground(fgSel);
    } else {
        pane.setBackground(bgNonSel);
        pane.setForeground(fgNonSel);
    }
    AssertionTreeNode node = (AssertionTreeNode) value;
    pane.setText("");
    try {
        pane.getDocument().insertString(pane.getDocument().getLength(), node.getProperty() + " {", propertyStyle);
        pane.getDocument().insertString(pane.getDocument().getLength(),
                node.getDisplayNode().replace("\\", "\\\\").replace("\n", "\\n").replace("\r", "\\r"), valueStyle);
        pane.getDocument().insertString(pane.getDocument().getLength(), "}", propertyStyle);
    } catch (BadLocationException e) {
        e.printStackTrace();
    }
    return pane;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:23,代码来源:DefaultContextMenu.java

示例6: HelpWindow

import javax.swing.JTextPane; //导入方法依赖的package包/类
public HelpWindow() {
	super(Main.NAME + ": Help");
	setIconImage(Main.icon);
	final JTextPane text = new JTextPane();
	text.setText("Basic Configuration:\n"
			+ "Create a folder where you will put the shortcuts to display and set it in the settings\n"
			+ "(it should not be the default Desktop folder, as then icons would be displayed twice).\n"
			+ "Fill that folder with subfolders - these will be the different icon groups.\n"
			+ "In each subfolder, place shortcuts to display, or make subfolders if you want to display not only a shortcut,\n"
			+ "but some alternative shortcuts or related data too. This subfolder can be expanded with a right click on the icon later.\n"
			+ "\n"
			+ "Controls:\n"
			+ "Left click on icon: start application or open file\n"
			+ "Right click on icon: show sub-icons (if any)\n"
			+ "Double click on group title: open folder in explorer\n"
			+ "Middle click on icon or group title: rename file or folder");
	text.setEditable(false);
	add(text);
	pack();
}
 
开发者ID:Njol,项目名称:Motunautr,代码行数:21,代码来源:HelpWindow.java

示例7: fem

import javax.swing.JTextPane; //导入方法依赖的package包/类
public static void fem(int cent, JTextPane d, int dez, int unid) {
    switch (cent) {
        case 1:
            if (cent == 1 & dez == 0 & unid == 0) {
                d.setText(d.getText() + "Cem");
            } else {
                d.setText(d.getText() + "Cento ");
            }
            break;
        case 2:
            d.setText(d.getText() + "Duzentas");
            break;
        case 3:
            d.setText(d.getText() + "Trezentas");
            break;
        case 4:
            d.setText(d.getText() + "Quatrocentas");
            break;
        case 5:
            d.setText(d.getText() + "Quinhentas");
            break;
        case 6:
            d.setText(d.getText() + "Seiscentas");
            break;
        case 7:
            d.setText(d.getText() + "Setecentas");
            break;
        case 8:
            d.setText(d.getText() + "Oitocentas");
            break;
        case 9:
            d.setText(d.getText() + "Novecentas");
            break;
    }
    if (dez > 0 && cent > 0) {
        d.setText(d.getText() + " e ");
    }
}
 
开发者ID:JIGAsoftSTP,项目名称:NICON,代码行数:39,代码来源:Moeda.java

示例8: underlineStacktraces

import javax.swing.JTextPane; //导入方法依赖的package包/类
private static void underlineStacktraces(StyledDocument doc, JTextPane textPane, List<StackTracePosition> stacktraces, String comment) {
    Style defStyle = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE);
    Style hlStyle = doc.addStyle("regularBlue-stacktrace", defStyle); // NOI18N
    hlStyle.addAttribute(HyperlinkSupport.STACKTRACE_ATTRIBUTE, new StackTraceAction());
    StyleConstants.setForeground(hlStyle, UIUtils.getLinkColor());
    StyleConstants.setUnderline(hlStyle, true);

    int last = 0;
    textPane.setText(""); // NOI18N
    for (StackTraceSupport.StackTracePosition stp : stacktraces) {
        int start = stp.getStartOffset();
        int end = stp.getEndOffset();

        if (last < start) {
            insertString(doc, comment, last, start, defStyle);
        }
        last = start;

        // for each line skip leading whitespaces (look bad underlined)
        boolean inStackTrace = (comment.charAt(start) > ' ');
        for (int i = start; i < end; i++) {
            char ch = comment.charAt(i);
            if ((inStackTrace && ch == '\n') || (!inStackTrace && ch > ' ')) {
                insertString(doc, comment, last, i, inStackTrace ? hlStyle : defStyle);
                inStackTrace = !inStackTrace;
                last = i;
            }
        }

        if (last < end) {
            insertString(doc, comment, last, end, inStackTrace ? hlStyle : defStyle);
        }
        last = end;
    }
    try {
        doc.insertString(doc.getLength(), comment.substring(last), defStyle);
    } catch (BadLocationException ex) {
        Support.LOG.log(Level.SEVERE, null, ex);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:41,代码来源:StackTraceSupport.java

示例9: setupTextPane

import javax.swing.JTextPane; //导入方法依赖的package包/类
private void setupTextPane(final JTextPane textPane, String comment) {
    if( UIUtils.isNimbus() ) {
        textPane.setUI( new BasicTextPaneUI() );
    }
    textPane.setText(comment);
    
    Caret caret = textPane.getCaret();
    if (caret instanceof DefaultCaret) {
        ((DefaultCaret)caret).setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
    }

    // attachments
    if (!attachmentIds.isEmpty()) {
        AttachmentHyperlinkSupport.Attachement a = AttachmentHyperlinkSupport.findAttachment(comment, attachmentIds);
        if (a != null) {
            String attachmentId = a.id;
            if (attachmentId != null) {
                int index = attachmentIds.indexOf(attachmentId);
                if (index != -1) {
                    BugzillaIssue.Attachment attachment = attachments.get(index);
                    AttachmentLink attachmentLink = new AttachmentLink(attachment);
                    HyperlinkSupport.getInstance().registerLink(textPane, new int[] {a.idx1, a.idx2}, attachmentLink);
                } else {
                    Bugzilla.LOG.log(Level.WARNING, "couldn''t find attachment id in: {0}", comment); // NOI18N
                }
            }
        }
    }

    // pop-ups
    textPane.setComponentPopupMenu(commentsPopup);

    textPane.setBackground(blueBackground);

    textPane.setBorder(BorderFactory.createEmptyBorder(3,3,3,3));
    textPane.setEditable(false);
    textPane.getAccessibleContext().setAccessibleName(NbBundle.getMessage(CommentsPanel.class, "CommentsPanel.textPane.AccessibleContext.accessibleName")); // NOI18N
    textPane.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CommentsPanel.class, "CommentsPanel.textPane.AccessibleContext.accessibleDescription")); // NOI18N
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:40,代码来源:CommentsPanel.java

示例10: RTFDocsSwingDisplayer

import javax.swing.JTextPane; //导入方法依赖的package包/类
public RTFDocsSwingDisplayer(String heading, String filename, String jarName)
{
    super(heading);
    setSize(650, 550);

    // Initialize String which will go into the JTextPane
    String display_me = readFile(filename, jarName);
    // Buttons
    b1 = new JButton("Back");
    b1.setActionCommand("back");
    b1.addActionListener(this);

    // Initializing JTextPane()
    JTextPane textPane = new JTextPane();
    RTFEditorKit rtfkit = new RTFEditorKit();
    // HTMLEditorKit htmlkit = new HTMLEditorKit();
    textPane.setEditorKit(rtfkit); // set Kit which will read RTF Doc
    // textPane.setEditorKit(htmlkit);
    textPane.setEditable(false); // make uneditable
    textPane.setText(display_me); // set the Text
    textPane.setCaretPosition(0); // set Cret position to 0

    // Panels and addition to container
    p1 = new JPanel();
    Container contentPane = getContentPane();
    contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
    p1.setLayout(new BoxLayout(this.p1, BoxLayout.Y_AXIS));
    p1.add(new JScrollPane(textPane));
    p1.add(b1);
    contentPane.add(p1);
    setVisible(true);

}
 
开发者ID:sanskrit-coders,项目名称:indic-transliteration,代码行数:34,代码来源:RTFDocsSwingDisplayer.java

示例11: initComponents

import javax.swing.JTextPane; //导入方法依赖的package包/类
private void initComponents() {
	Box vBox = Box.createVerticalBox();
	Box hBox = Box.createHorizontalBox();
	Box h2Box = Box.createHorizontalBox();
	JLabel descrLabel = new JLabel(DESCRIPTION_PANEL);
	button_save = new JButton(ACTION_SAVE);
	button_save.setEnabled(false);

	synView = new JTextPane();
	synView.setContentType("text/html");
	synView.setEditable(false);

	synScroll = new JScrollPane(synView);
	synScroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
	synScroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
	vBox.add(Box.createVerticalStrut(30));
	vBox.add(h2Box);
	vBox.add(Box.createVerticalStrut(30));
	vBox.add(synScroll);
	vBox.add(Box.createVerticalStrut(30));
	h2Box.add(descrLabel);
	h2Box.add(button_save);
	hBox.add(Box.createHorizontalStrut(20));
	hBox.add(vBox);
	hBox.add(Box.createHorizontalStrut(20));
	this.setLayout(new GridLayout(1, 1));
	this.add(hBox);
	synView.setText("<html><body><center><font face=\"bold\" size=\"3\">Burstiness values will be here displayed once you solve the problem.</font></center></body></html>");
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:30,代码来源:TextualPanel.java

示例12: LicensesWindow

import javax.swing.JTextPane; //导入方法依赖的package包/类
/**
 * <p>Create and show a new LicensesWindow.</p>
 * @param parent The JFrame that should be the parent of this dialog.
 * @param isModal Does the dialog have to be closed before the user can interact with the parent?
 * */
public LicensesWindow(JFrame parent, boolean isModal) {
	super(parent, isModal);
	setBounds(100, 100, 600, 300); //Set the size of the dialog.
	setLocationRelativeTo(parent); //Center the dialog relative to the parent.  If you don't do this, the dialog will appear where the first JFrame spawned by the program did, and at the upper left corner.  It's disconcerting.
	setTitle("Licenses");
	JTextPane textPane = new JTextPane(); //Create a TextPane to show the licenses.
	textPane.setEditable(false); //The licenses are fixed.
	textPane.setContentType("text/html"); //Display the licenses as HTML to use hard returns and bold text.
	textPane.setText("<b>JSyntaxPane is available under the Apache License version 2.0</b><br><br>Copyright 2008 Ayman Al-Sairafi [email protected]<br><br>Apache License<br><br>Version 2.0, January 2004<br><br>http://www.apache.org/licenses/<br><br>TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION<br><br>1. Definitions.<br><br>\"License\" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.<br><br>\"Licensor\" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.<br><br>\"Legal Entity\" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, \"control\" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.<br><br>\"You\" (or \"Your\") shall mean an individual or Legal Entity exercising permissions granted by this License.<br><br>\"Source\" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.<br><br>\"Object\" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.<br><br>\"Work\" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).<br><br>\"Derivative Works\" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.<br><br>\"Contribution\" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, \"submitted\" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as \"Not a Contribution.\"<br><br>\"Contributor\" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.<br><br>2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.<br><br>3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.<br><br>4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:<br><br>    You must give any other recipients of the Work or Derivative Works a copy of this License; and<br><br>    You must cause any modified files to carry prominent notices stating that You changed the files; and<br><br>    You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and<br><br>    If the Work includes a \"NOTICE\" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.<br><br>5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.<br><br>6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.<br><br>7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.<br><br>8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.<br><br>9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.<br><br>END OF TERMS AND CONDITIONS<br><br><b>IAN is available under the MIT License</b><br><br>Copyright (c) 2016 Robert J. Walker<br><br>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:<br><br>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.<br><br>THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.");
	textPane.setCaretPosition(0); //Scroll right to the top.
	setContentPane(new JScrollPane(textPane)); //Wrap the text in a JScrollPane because it will probably overflow.
	setVisible(true); //Show the dialog.
}
 
开发者ID:Michaelkielstra,项目名称:Diana,代码行数:19,代码来源:LicensesWindow.java

示例13: SignUpPanel

import javax.swing.JTextPane; //导入方法依赖的package包/类
/**
 * Create the panel.
 */
public SignUpPanel() {
	setLayout(null);
	
	JLabel lblNewLabel = new JLabel("Hearthstone");
	lblNewLabel.setFont(new Font("Lucida Grande", Font.PLAIN, 35));
	lblNewLabel.setBounds(150, 35, 211, 61);
	add(lblNewLabel);
	
	JPanel panel = new JPanel();
	panel.setBorder(new LineBorder(new Color(0, 0, 0)));
	panel.setBounds(434, 20, 245, 260);
	add(panel);
	panel.setLayout(null);
	
	JLabel lblUpdateNotes = new JLabel("Update Notes:");
	lblUpdateNotes.setBounds(6, 6, 89, 16);
	panel.add(lblUpdateNotes);
	
	JTextPane txtpn_UpdateNotes = new JTextPane();
	txtpn_UpdateNotes.setEditable(false);
	txtpn_UpdateNotes.setBackground(this.getBackground());
	txtpn_UpdateNotes.setText("* Added Support for Multiplayer\n\n\n* Support for login\n\n\n* Server can hold multiple games at once");
	txtpn_UpdateNotes.setBounds(16, 34, 211, 207);
	panel.add(txtpn_UpdateNotes);
	
	JLabel label = new JLabel("Username:");
	label.setBounds(58, 103, 70, 16);
	add(label);
	
	txt_Username = new JTextField();
	txt_Username.setColumns(20);
	txt_Username.setBounds(134, 97, 254, 28);
	add(txt_Username);
	
	JLabel label_1 = new JLabel("Password:");
	label_1.setBounds(65, 151, 63, 16);
	add(label_1);
	
	psf_Password = new JPasswordField();
	psf_Password.setColumns(20);
	psf_Password.setBounds(134, 145, 254, 28);
	add(psf_Password);
	
	pwf_Retype = new JPasswordField();
	pwf_Retype.setColumns(20);
	pwf_Retype.setBounds(134, 191, 254, 28);
	add(pwf_Retype);
	
	JLabel lblRetypePassword = new JLabel("Retype Password:");
	lblRetypePassword.setBounds(19, 197, 109, 16);
	add(lblRetypePassword);
	
	btn_Login = new JButton("Login");
	btn_Login.setBounds(134, 240, 117, 29);
	add(btn_Login);
	
	btn_SignUp = new JButton("Sign Up");
	btn_SignUp.setBounds(271, 240, 117, 29);
	add(btn_SignUp);

}
 
开发者ID:ikhaliq15,项目名称:JHearthstone,代码行数:65,代码来源:SignUpPanel.java

示例14: disableOtherModules

import javax.swing.JTextPane; //导入方法依赖的package包/类
void disableOtherModules () {
    Runnable runnable = new Runnable() {
        @Override
        public void run() {
            boolean notify = false;
            outter: for (int i = 0; i < otherGitModules.length; i++) {
                FileLock lock = null;
                OutputStream os = null;
                try {
                    String newModule = otherGitModules[i];
                    String newModuleXML = "Modules/" + newModule.replace('.', '-') + ".xml"; // NOI18N
                    FileObject fo = FileUtil.getConfigFile(newModuleXML);
                    if (fo == null) continue;
                    Document document = readModuleDocument(fo);

                    NodeList list = document.getDocumentElement().getElementsByTagName("param"); // NOI18N
                    int n = list.getLength();
                    for (int j = 0; j < n; j++) {
                        Element node = (Element) list.item(j);
                        if ("enabled".equals(node.getAttribute("name"))) { // NOI18N
                            Text text = (Text) node.getChildNodes().item(0);
                            String value = text.getNodeValue();
                            if ("true".equals(value)) { // NOI18N
                                text.setNodeValue("false"); // NOI18N
                                break;
                            } else {
                                continue outter;
                            }
                        }
                    }
                    notify = true;                            
                    lock = fo.lock();
                    os = fo.getOutputStream(lock);
                    
                    XMLUtil.write(document, os, "UTF-8"); // NOI18N
                } catch (Exception e) {
                    Git.LOG.log(Level.WARNING, null, e);
                } finally {
                    if (os != null) try { os.close(); } catch (IOException ex) {}
                    if (lock != null) lock.releaseLock();
                }
            }
            if(notify) {
                JTextPane ballonDetails = getPane(NbBundle.getBundle(ModuleLifecycleManager.class).getString("MSG_Install_Warning")); // using the same pane causes the balloon popup
                JTextPane popupDetails = getPane(NbBundle.getBundle(ModuleLifecycleManager.class).getString("MSG_Install_Warning"));  // to trim the text to the first line
                NotificationDisplayer.getDefault().notify(
                        NbBundle.getMessage(ModuleLifecycleManager.class, "MSG_Install_Warning_Title"), //NOI18N
                        ImageUtilities.loadImageIcon("org/netbeans/modules/git/resources/icons/info.png", false),
                        ballonDetails, popupDetails, NotificationDisplayer.Priority.NORMAL, NotificationDisplayer.Category.WARNING);
            }
        }
                    
        private JTextPane getPane(String txt) {
            JTextPane bubble = new JTextPane();
            bubble.setOpaque(false);
            bubble.setEditable(false);
            if (UIManager.getLookAndFeel().getID().equals("Nimbus")) {                   //NOI18N
                //#134837
                //http://forums.java.net/jive/thread.jspa?messageID=283882
                bubble.setBackground(new Color(0, 0, 0, 0));
            }
            bubble.setContentType("text/html");                                          //NOI18N
            bubble.setText(txt);
            return bubble;
        }             
    };
    RequestProcessor.getDefault().post(runnable);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:69,代码来源:ModuleLifecycleManager.java

示例15: GameUI

import javax.swing.JTextPane; //导入方法依赖的package包/类
/**
 * Create the frame.
 */
public GameUI(GameRunnerMVC controller) {
	this.controller = controller;
	setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	setBounds(100, 100, 491, 426);
	contentPane = new JPanel();
	contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
	setContentPane(contentPane);
	contentPane.setLayout(null);
	
	textArea = new JTextArea();
	textArea.setLineWrap(true);
	textArea.setBounds(10, 25, 455, 196);
	textArea.setText("");
	contentPane.add(textArea);
	
	textPane1 = new JTextPane();
	textPane1.setBounds(10, 0, 149, 20);
	textPane1.setText("Health: 50");
	contentPane.add(textPane1);
	
	textPane2 = new JTextPane();
	textPane2.setBounds(169, 0, 134, 20);
	textPane2.setText("Money: 50");
	contentPane.add(textPane2);
	
	textPane3 = new JTextPane();
	textPane3.setBounds(313, 0, 134, 20);
	textPane3.setText("Satisfaction: 50");
	contentPane.add(textPane3);
	
	button1 = new JButton("");
	button1.setFont(new Font("Tahoma", Font.PLAIN, 11));
	button1.setBounds(10, 230, 222, 40);
	contentPane.add(button1);
	
	button2 = new JButton("");
	button2.setBounds(243, 230, 222, 40);
	contentPane.add(button2);
	
	button3 = new JButton("");
	button3.setBounds(10, 281, 222, 40);
	contentPane.add(button3);
	
	button4 = new JButton("");
	button4.setBounds(243, 281, 222, 40);
	contentPane.add(button4);
	
	button5 = new JButton("");
	button5.setBounds(10, 332, 222, 40);
	contentPane.add(button5);
	
	button6 = new JButton("");
	button6.setBounds(243, 332, 222, 40);
	contentPane.add(button6);
}
 
开发者ID:css4143,项目名称:The-Valley,代码行数:59,代码来源:GameUI.java


注:本文中的javax.swing.JTextPane.setText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。