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


Java JTextPane.setContentType方法代码示例

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


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

示例1: 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(20));
	vBox.add(hBox);
	vBox.add(Box.createVerticalStrut(20));
	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:HOMlab,项目名称:QN-ACTR-Release,代码行数:21,代码来源:SectorsTextualPanel.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: 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);
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:19,代码来源:SynopsisPanel.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: setup_child_split_pane_right

import javax.swing.JTextPane; //导入方法依赖的package包/类
private void setup_child_split_pane_right(final JSplitPane split_pane){
	JScrollPane result_scroll_pane = new JScrollPane();
	split_pane.setRightComponent(result_scroll_pane);
	
	JPanel result_panel = new JPanel();
	result_panel.setLayout(new BoxLayout(result_panel, BoxLayout.Y_AXIS));
	result_scroll_pane.setViewportView(result_panel);
	
	result_text_pane = new JTextPane();
	result_text_pane.setEditable(false);
	result_text_pane.setContentType("text/html");
	result_panel.add(result_text_pane);
	
	JPanel checkbox_panel = new JPanel();
	result_panel.add(checkbox_panel);
	
	show_all_checkbox = new JCheckBox("Show all");
	checkbox_panel.add(show_all_checkbox);
}
 
开发者ID:QwertygidQ,项目名称:DeutschSim,代码行数:20,代码来源:GUI.java

示例6: 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(20));
	vBox.add(hBox);
	vBox.add(Box.createVerticalStrut(20));
	hBox.add(Box.createHorizontalStrut(20));
	hBox.add(synScroll);
	hBox.add(Box.createHorizontalStrut(20));
	this.setLayout(new GridLayout(1, 1));
	this.add(vBox);
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:19,代码来源:SynopsisPanel.java

示例7: getPane

import javax.swing.JTextPane; //导入方法依赖的package包/类
private JTextPane getPane(File[] files, File projectDir, String url, String revision) {
    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
    setupPane(bubble, files, projectDir, url, revision);
    return bubble;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:VCSNotificationDisplayer.java

示例8: getElementsComponent

import javax.swing.JTextPane; //导入方法依赖的package包/类
private JComponent getElementsComponent (String msg) {
    JTextPane area = new JTextPane ();
    area.setEditable (false);
    area.setContentType ("text/html"); // NOI18N
    area.setText (msg);
    area.setOpaque (false);
    area.setBackground(new Color(0, 0, 0, 0));
    area.putClientProperty( JTextPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE );
    return area;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:OperationPanel.java

示例9: 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

示例10: 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(20));
	vBox.add(h2Box);
	vBox.add(Box.createVerticalStrut(20));
	vBox.add(synScroll);
	vBox.add(Box.createVerticalStrut(20));
	//h2Box.add(Box.createHorizontalStrut(20));
	h2Box.add(descrLabel);
	h2Box.add(button_save);
	hBox.add(Box.createHorizontalStrut(20));
	hBox.add(vBox);
	hBox.add(Box.createHorizontalStrut(20));
	// h2Box.setMaximumSize(new Dimension(580,50));
	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:HOMlab,项目名称:QN-ACTR-Release,代码行数:33,代码来源:TextualPanel.java

示例11: HelpWindow

import javax.swing.JTextPane; //导入方法依赖的package包/类
public HelpWindow(){
	JTextPane text = new JTextPane();
	setPreferredSize(new Dimension(400,900));
	
	text.setEditable(false);
	text.setContentType("text/html");
	text.setText(helpText);
	text.setCaretPosition(0); //Makes the scroll start at the top.
	
	JScrollPane scroll = new JScrollPane(text);
	add(scroll);
	pack();
	setVisible(true);
	
}
 
开发者ID:Emoun,项目名称:racp,代码行数:16,代码来源:HelpWindow.java

示例12: createTextPane

import javax.swing.JTextPane; //导入方法依赖的package包/类
/** Callback factory method for a fresh HTML-enabled text pane. */
protected JTextPane createTextPane() {
    JTextPane result = new JTextPane();
    result.setContentType("text/html");
    result.setEditable(false);
    return result;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:8,代码来源:HelpFactory.java

示例13: 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

示例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: draw

import javax.swing.JTextPane; //导入方法依赖的package包/类
public void draw(Graphics g, GamePieceImage defn) {

    TextBoxItemInstance tbi = null;
    if (defn != null) {
      tbi = defn.getTextBoxInstance(getConfigureName());
    }
    if (tbi == null) {
      tbi = new TextBoxItemInstance();
    }

    Color fg = tbi.getFgColor().getColor();
    Color bg = tbi.getBgColor().getColor();

    Point origin = layout.getPosition(this);
    Rectangle r = new Rectangle(origin.x, origin.y, getWidth(), getHeight());
    String s = null;
    if (textSource.equals(SRC_FIXED)) {
      s = text;
    }
    else {
      if (defn != null) {
        if (tbi != null) {
          s = tbi.getValue();
        }
      }
    }

    Graphics2D g2d = ((Graphics2D) g);
    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, isAntialias() ?
      RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF);

    AffineTransform saveXForm = null;
    if (getRotation() != 0) {
      saveXForm = g2d.getTransform();
      AffineTransform newXForm =
        AffineTransform.getRotateInstance(Math.toRadians(getRotation()), getLayout().getVisualizerWidth()/2, getLayout().getVisualizerHeight()/2);
      g2d.transform(newXForm);
    }

    if (bg != null) {
      g.setColor(bg);
      g.fillRect(r.x, r.y, r.width, r.height);
    }

    JTextPane l = new JTextPane();
    if (isHTML) l.setContentType("text/html"); //$NON-NLS-1$
    l.setText(s);
    l.setSize(width-2, height-2);
    l.setBackground(bg != null ? bg : new Color(0,true));
    l.setForeground(fg != null ? fg : new Color(0,true));
    FontStyle fs = FontManager.getFontManager().getFontStyle(fontStyleName);
    Font f = fs.getFont();
    l.setFont(f);

    final BufferedImage img = ImageUtils.createCompatibleTranslucentImage(
      Math.max(l.getWidth(), 1),
      Math.max(l.getHeight(), 1)
    );
    final Graphics2D big = img.createGraphics();
    l.paint(big);
    big.dispose();

    g2d.drawImage(img, origin.x+1, origin.y+1, null);

    if (saveXForm != null) {
      g2d.setTransform(saveXForm);
    }
  }
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:69,代码来源:TextBoxItem.java


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