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


Java BasicHTML.isHTMLString方法代码示例

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


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

示例1: setDisplayName

import javax.swing.plaf.basic.BasicHTML; //导入方法依赖的package包/类
/** Sets localized display name of this <code>TopComponent</code>.
 * @param displayName localized display name which is set
 * @since 4.13 */
public void setDisplayName(String displayName) {
    String old = this.displayName;

    if ((displayName == old) || ((displayName != null) && displayName.equals(old))) {
        return;
    }

    // warning if display name contains html tags
    if (BasicHTML.isHTMLString(displayName)) {
        Logger.getAnonymousLogger().warning(
            "Call of " + getClass().getName() + ".setDisplayName(\"" + displayName + "\")" +
            " shouldn't contain any HTML tags. Please use " + getClass().getName() + ".setHtmlDisplayName(String)" +
            "for such purpose. For details please see http://www.netbeans.org/issues/show_bug.cgi?id=66777.");
    }
    
    this.displayName = displayName;
    firePropertyChange("displayName", old, displayName); // NOI18N

    WindowManager.getDefault().topComponentDisplayNameChanged(this, displayName);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:TopComponent.java

示例2: componentAdded

import javax.swing.plaf.basic.BasicHTML; //导入方法依赖的package包/类
@Override
public void componentAdded(ContainerEvent e) {
	JTabbedPane tp = (JTabbedPane) e.getContainer();
	Component child = e.getChild();
	if (child instanceof UIResource) {
		return;
	}
	int index = tp.indexOfComponent(child);
	String title = tp.getTitleAt(index);
	boolean isHTML = BasicHTML.isHTMLString(title);
	if (isHTML) {
		if (htmlViews == null) { // Initialize vector
			htmlViews = createHTMLVector();
		}
		else { // Vector already exists
			View v = BasicHTML.createHTMLView(tp, title);
			htmlViews.insertElementAt(v, index);
		}
	}
	else { // Not HTML
		if (htmlViews != null) { // Add placeholder
			htmlViews.insertElementAt(null, index);
		} // else nada!
	}
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:26,代码来源:CloseTabPaneUI.java

示例3: createHTMLVector

import javax.swing.plaf.basic.BasicHTML; //导入方法依赖的package包/类
private Vector<View> createHTMLVector() {
	Vector<View> htmlViews = new Vector<View>();
	int count = tabPane.getTabCount();
	if (count > 0) {
		for (int i = 0; i < count; i++) {
			String title = tabPane.getTitleAt(i);
			if (BasicHTML.isHTMLString(title)) {
				htmlViews.addElement(BasicHTML.createHTMLView(tabPane, title));
			}
			else {
				htmlViews.addElement(null);
			}
		}
	}
	return htmlViews;
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:17,代码来源:CloseTabPaneUI.java

示例4: htmlHack

import javax.swing.plaf.basic.BasicHTML; //导入方法依赖的package包/类
/**
 * A hack to prepare HTML-based Swing components: size initialization is called inside paint method.
 * @param g a non-null Graphics object
 * @param component an HTML-based component that needs to be initialized
 * @param cellRect a space where the component should be painted
 */
public static void htmlHack( Graphics g, Component component, Rectangle cellRect ) {
  String text;
  if ( component instanceof JLabel )
    text = ( ( JLabel )component ).getText();
  else if ( component instanceof AbstractButton )
    text = ( ( AbstractButton )component ).getText();
  else if ( component instanceof JToolTip )
    text = ( ( JToolTip )component ).getTipText();
  else
    text = null;
  if ( !BasicHTML.isHTMLString( text ) )
    return;
  component.setBounds( cellRect );
  Graphics gg = g.create( -cellRect.width, -cellRect.height, cellRect.width, cellRect.height );
  try {
    component.paint( gg );
  } catch ( NullPointerException e ) {
    // Thrown on applet reinitialization.
  } finally {
    gg.dispose();
  }
}
 
开发者ID:Qualtagh,项目名称:JBroTable,代码行数:29,代码来源:JBroTableHeaderUI.java

示例5: buildDimensions

import javax.swing.plaf.basic.BasicHTML; //导入方法依赖的package包/类
private JLabel buildDimensions() {
  // Build and return a JLabel if we need to render HTML,
  // then determine the dimensions of the label.
  final JLabel label;

  if (BasicHTML.isHTMLString(txt)) {
    label = new JLabel(txt);
    label.setForeground(fg);
    label.setFont(font);
    size = label.getPreferredSize();
    label.setSize(size);
  }
  else {
    label = null;

    final Graphics2D g = ImageUtils.NULL_IMAGE.createGraphics();
    final FontMetrics fm = g.getFontMetrics(font);
    size = new Dimension(fm.stringWidth(txt), fm.getHeight());
    g.dispose();
  }

  return label;
}
 
开发者ID:fifa0329,项目名称:vassal,代码行数:24,代码来源:Labeler.java

示例6: updateTitle

import javax.swing.plaf.basic.BasicHTML; //导入方法依赖的package包/类
/** Actually sets title for the frame
 */
@Override
public void updateTitle(String title) {
    // extract HTML from text - Output window (and soon others) uses it
    if (BasicHTML.isHTMLString(title)) {
        char[] c = title.toCharArray();
        StringBuffer sb = new StringBuffer(title.length());
        boolean inTag = false;
        for (int i=0; i < c.length; i++) {
            if (inTag && c[i] == '>') { //NOI18N
                inTag = false;
                continue;
            }
            if (!inTag && c[i] == '<') { //NOI18N
                inTag = true;
                continue;
            }
            if (!inTag) {
                sb.append(c[i]);
            }
        }
        //XXX, would be nicer to support the full complement of entities...
        title = sb.toString().replace("&nbsp;", " "); //NOI18N
    }
    String completeTitle = MessageFormat.format(
            NbBundle.getMessage(DefaultSeparateContainer.class, "CTL_SeparateEditorTitle"),
            title);
    setTitle(completeTitle);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:DefaultSeparateContainer.java

示例7: setText

import javax.swing.plaf.basic.BasicHTML; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public void setText(String text) {
  // check for HTML
  if (BasicHTML.isHTMLString(text)) setContentType("text/html");
  super.setText(text);
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:8,代码来源:FlowLabel.java

示例8: AbstractToolIconNode

import javax.swing.plaf.basic.BasicHTML; //导入方法依赖的package包/类
/**
 * Constructor.
 * 
 * @param image image displayed on the icon
 * @param text optional HTML or plain text, centered under image
 */
public AbstractToolIconNode( Image image, String text ) {
    super();
    
    PImage imageNode = new PImage( image );
    imageNode.setOffset( 0, 0 );
    addChild( imageNode );
    
    if ( text != null ) {

        PNode labelNode = null;
        
        if ( BasicHTML.isHTMLString( text ) ) {
            HTMLNode htmlNode = new HTMLNode( text );
            htmlNode.setFont( LABEL_FONT );
            htmlNode.setHTMLColor( LABEL_COLOR );
            labelNode = htmlNode;
        }
        else {
            PText ptextNode = new PText( text );
            ptextNode.setFont( LABEL_FONT );
            ptextNode.setTextPaint( LABEL_COLOR );
            labelNode = ptextNode;
        }
        addChild( labelNode );

        if ( imageNode.getWidth() > labelNode.getWidth() ) {
            imageNode.setOffset( 0, 0 );
            labelNode.setOffset( imageNode.getX() + ( imageNode.getWidth() - labelNode.getWidth() ) / 2, imageNode.getY() + imageNode.getHeight() + VERTICAL_SPACING );
        }
        else {
            labelNode.setOffset( 0, imageNode.getY() + imageNode.getHeight() + VERTICAL_SPACING );
            imageNode.setOffset( labelNode.getX() + ( labelNode.getWidth() - imageNode.getWidth() ) / 2, 0 );
        }
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:42,代码来源:AbstractToolIconNode.java

示例9: getBeakerViewRatioString

import javax.swing.plaf.basic.BasicHTML; //导入方法依赖的package包/类
public static final String getBeakerViewRatioString() {
    String s = CHECK_BOX_H3O_OH_RATIO;
    if ( !BasicHTML.isHTMLString( CHECK_BOX_H3O_OH_RATIO ) ) {
        s = "<html>" + s + "</html>";
    }
    Object[] args = { LABEL_H3O, LABEL_OH };
    return MessageFormat.format( s, args );
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:9,代码来源:PHScaleStrings.java

示例10: makeHTML

import javax.swing.plaf.basic.BasicHTML; //导入方法依赖的package包/类
/**
 * Converts a plain text string to HTML.
 * If the text string is already HTML, then it is simply returned.
 *
 * @param s
 * @return HTML
 */
private String makeHTML( String s ) {
    String htmlString = s;
    if ( !BasicHTML.isHTMLString( s ) ) {
        htmlString = "<html>" + s + "</html>";
    }
    return htmlString;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:15,代码来源:HTMLGraphic.java

示例11: setErrorMessage

import javax.swing.plaf.basic.BasicHTML; //导入方法依赖的package包/类
/**
 * Set the error message for the dialog box
 *
 * @param errorMessage Message for the error dialog
 */
private void setErrorMessage(String errorMessage) {
    if (BasicHTML.isHTMLString(errorMessage)) {
        this.errorMessage.setContentType("text/html");
    } else {
        this.errorMessage.setContentType("text/plain");
    }
    this.errorMessage.setText(errorMessage);
    this.errorMessage.setCaretPosition(0);
}
 
开发者ID:teddyted,项目名称:iSeleda,代码行数:15,代码来源:BasicErrorPaneUI.java

示例12: configureMessagePaneUi

import javax.swing.plaf.basic.BasicHTML; //导入方法依赖的package包/类
@NotNull
public static JTextPane configureMessagePaneUi(JTextPane messageComponent,
                                               String message,
                                               final boolean addBrowserHyperlinkListener) {
  messageComponent.setFont(UIUtil.getLabelFont());
  if (BasicHTML.isHTMLString(message)) {
    final HTMLEditorKit editorKit = new HTMLEditorKit();
    editorKit.getStyleSheet().addRule(UIUtil.displayPropertiesToCSS(UIUtil.getLabelFont(), UIUtil.getLabelForeground()));
    messageComponent.setEditorKit(editorKit);
    messageComponent.setContentType(UIUtil.HTML_MIME);
    if (addBrowserHyperlinkListener) {
      messageComponent.addHyperlinkListener(BrowserHyperlinkListener.INSTANCE);
    }
  }
  messageComponent.setText(message);
  messageComponent.setEditable(false);
  if (messageComponent.getCaret() != null) {
    messageComponent.setCaretPosition(0);
  }

  if (UIUtil.isUnderNimbusLookAndFeel()) {
    messageComponent.setOpaque(false);
    messageComponent.setBackground(UIUtil.TRANSPARENT_COLOR);
  }
  else {
    messageComponent.setBackground(UIUtil.getOptionPaneBackground());
  }

  messageComponent.setForeground(UIUtil.getLabelForeground());
  return messageComponent;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:Messages.java

示例13: createTextComponent

import javax.swing.plaf.basic.BasicHTML; //导入方法依赖的package包/类
protected JComponent createTextComponent() {
  JComponent textComponent;
  if (BasicHTML.isHTMLString(myMessage)) {
    textComponent = createMessageComponent(myMessage);
  }
  else {
    JLabel textLabel = new JLabel(myMessage);
    textLabel.setUI(new MultiLineLabelUI());
    textComponent = textLabel;
  }
  textComponent.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
  return textComponent;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:Messages.java

示例14: setText

import javax.swing.plaf.basic.BasicHTML; //导入方法依赖的package包/类
public void setText(String text) {
  if (BasicHTML.isHTMLString(getText())) { // if is currently showing string as html
    super.setText(underlineTextInHtml(text));
  }
  else {
    super.setText(text);
  }
  myOriginalText = text;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:HoverHyperlinkLabel.java

示例15: setErrorMessage

import javax.swing.plaf.basic.BasicHTML; //导入方法依赖的package包/类
/**
 * Set the error message for the dialog box
 * @param errorMessage Message for the error dialog
 */
private void setErrorMessage(String errorMessage) {
    if(BasicHTML.isHTMLString(errorMessage)) {
        this.errorMessage.setContentType("text/html");
    } else {
        this.errorMessage.setContentType("text/plain");
    }
    this.errorMessage.setText(errorMessage);
    this.errorMessage.setCaretPosition(0);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:14,代码来源:BasicErrorPaneUI.java


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