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


Java WrappedPlainView类代码示例

本文整理汇总了Java中javax.swing.text.WrappedPlainView的典型用法代码示例。如果您正苦于以下问题:Java WrappedPlainView类的具体用法?Java WrappedPlainView怎么用?Java WrappedPlainView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: testCreateElement

import javax.swing.text.WrappedPlainView; //导入依赖的package包/类
public void testCreateElement() throws Exception {
    Document doc = jta.getDocument();
    Element elem = doc.getDefaultRootElement();
    BasicTextUI ui = (BasicTextUI) jta.getUI();
    assertTrue(ui.create(elem) instanceof PlainView);
    jta.setLineWrap(true);
    assertTrue(ui.create(elem) instanceof WrappedPlainView);
    jta.setLineWrap(false);
    elem = elem.getElement(0);
    assertTrue(ui.create(elem) instanceof PlainView);
    jta.setLineWrap(true);
    assertTrue(ui.create(elem) instanceof WrappedPlainView);

    try {      
        new BasicTextAreaUI().create(null);  
        fail("NPE should be thrown");
    } catch (NullPointerException npe) {              
        // PASSED            
    } 
}
 
开发者ID:shannah,项目名称:cn1,代码行数:21,代码来源:BasicTextAreaUITest.java

示例2: getViewFactory

import javax.swing.text.WrappedPlainView; //导入依赖的package包/类
/**
 * Returns a ViewFactory that supplies WrappedPlainViews.
 */
public ViewFactory getViewFactory()
{
  return new ViewFactory()
  {
    public View create(Element el)
    {
      return new WrappedPlainView(el);
    }
  };
}
 
开发者ID:vilie,项目名称:javify,代码行数:14,代码来源:JEditorPane.java

示例3: create

import javax.swing.text.WrappedPlainView; //导入依赖的package包/类
/**
 * Create the view.  Returns a WrappedPlainView if the text area
 * has lineWrap set to true, otherwise returns a PlainView.  If
 * lineWrap is true has to check whether the wrap style is word
 * or character and return an appropriate WrappedPlainView.
 *
 * @param elem the element to create a View for
 * @return an appropriate View for the element
 */
public View create(Element elem)
{
  JTextArea comp = (JTextArea) getComponent();
  if (comp.getLineWrap())
    {
      if (comp.getWrapStyleWord())
        return new WrappedPlainView(elem, true);
      else
        return new WrappedPlainView(elem, false);
    }
  else
    return new PlainView(elem);
}
 
开发者ID:vilie,项目名称:javify,代码行数:23,代码来源:BasicTextAreaUI.java

示例4: create

import javax.swing.text.WrappedPlainView; //导入依赖的package包/类
/**
 * Create the view.  Returns a WrappedPlainView if the text area
 * has lineWrap set to true, otherwise returns a PlainView.  If
 * lineWrap is true has to check whether the wrap style is word 
 * or character and return an appropriate WrappedPlainView.
 * 
 * @param elem the element to create a View for
 * @return an appropriate View for the element
 */
public View create(Element elem)
{
  JTextArea comp = (JTextArea) getComponent();
  if (comp.getLineWrap())
    {
      if (comp.getWrapStyleWord())
        return new WrappedPlainView(elem, true);
      else
        return new WrappedPlainView(elem, false);
    }
  else
    return new PlainView(elem);
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:23,代码来源:BasicTextAreaUI.java

示例5: create

import javax.swing.text.WrappedPlainView; //导入依赖的package包/类
@Override
public View create(final Element element) {
    Document doc = element.getDocument();
    Boolean i18n = (Boolean)doc.getProperty(StringConstants.BIDI_PROPERTY);
    if (i18n.booleanValue()) {
        return AccessController.doPrivileged(new PrivilegedAction<View>() {
            public View run() {
                try {
                    Class cls = Class.forName(PLAIN_VIEW_I18N_CLASS);
                    Constructor constructor =
                        cls.getConstructor(new Class[] {Element.class});
                    constructor.setAccessible(true);
                    return (View)constructor.newInstance(new Object[] {element});
                } catch (Exception e) {
                    return null;
                }
            }
        });
    }

    JTextComponent comp = getComponent();
    boolean lineWrap = false;
    boolean wordWrap = false;
    if (comp instanceof JTextArea) {
        JTextArea c = (JTextArea)getComponent();
        lineWrap = c.getLineWrap();
        wordWrap = c.getWrapStyleWord();
    }
    if (lineWrap) {
        return new WrappedPlainView(element, wordWrap);
    }

    return new PlainView(element);

}
 
开发者ID:shannah,项目名称:cn1,代码行数:36,代码来源:BasicTextAreaUI.java

示例6: getScrollableTracksViewportWidth

import javax.swing.text.WrappedPlainView; //导入依赖的package包/类
/**
 * Return true when a Wrapped View is used.
 *
 * @see Scrollable#getScrollableTracksViewportWidth()
 */
public boolean getScrollableTracksViewportWidth() {
    View view = editor.getUI().getRootView(editor).getView(0);

    if (view instanceof WrappedPlainView) {
        return true;
    } else if (getParent() instanceof JViewport) {
        return (((JViewport) getParent()).getWidth() > getPreferredSize().width);
    }

    return false;
}
 
开发者ID:huajun2013,项目名称:ablaze,代码行数:17,代码来源:ScrollableEditorPanel.java

示例7: create

import javax.swing.text.WrappedPlainView; //导入依赖的package包/类
/** Plain view for the element
*/
public @Override View create(Element elem) {
    return new WrappedPlainView(elem);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:6,代码来源:BaseDocument.java

示例8: create

import javax.swing.text.WrappedPlainView; //导入依赖的package包/类
public View create(Element elem) {
    return new WrappedPlainView(elem);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:4,代码来源:JEditorPane.java


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