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


Java GlyphView类代码示例

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


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

示例1: breakView

import javax.swing.text.GlyphView; //导入依赖的package包/类
public View breakView(int axis, int p0, float pos, float len) {
    if (axis == View.X_AXIS) {
        checkPainter();
        int p1 = getGlyphPainter().getBoundedPosition(this, p0, pos,
                len);
        try {
            // if the view contains line break char break the view
            int index = getDocument().getText(p0, p1 - p0)
                    .indexOf(WrapHTMLFactory.SEPARATOR);
            if (index >= 0) {
                GlyphView v = (GlyphView) createFragment(p0,
                        p0 + index + 1);
                return v;
            }
        } catch (BadLocationException ex) {
            // should never happen
        }
        
    }
    return super.breakView(axis, p0, pos, len);
}
 
开发者ID:Jamling,项目名称:SmartQQ4IntelliJ,代码行数:22,代码来源:WrapHTMLFactory.java

示例2: bug6857057

import javax.swing.text.GlyphView; //导入依赖的package包/类
bug6857057() {
    Element elem = new StubBranchElement(" G L Y P H V");
    GlyphView view = new GlyphView(elem);
    float pos = elem.getStartOffset();
    float len = elem.getEndOffset() - pos;
    int res = view.getBreakWeight(View.X_AXIS, pos, len);
    if (res != View.ExcellentBreakWeight) {
        throw new RuntimeException("breakWeight != ExcellentBreakWeight");
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:11,代码来源:bug6857057.java

示例3: retrieveGlyphViews

import javax.swing.text.GlyphView; //导入依赖的package包/类
private static void retrieveGlyphViews(View root) {
    for (int i=0; i<= root.getViewCount()-1; i++) {
        View view = root.getView(i);
        if (view instanceof GlyphView && view.isVisible()) {
            if (!glyphViews.contains(view)) {
                glyphViews.add((GlyphView)view);
            }
        } else {
            retrieveGlyphViews(view);
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:13,代码来源:bug8014863.java

示例4: breakView

import javax.swing.text.GlyphView; //导入依赖的package包/类
public View breakView(int axis, int p0, float pos, float len)
{
	if(axis == View.X_AXIS)
	{
		checkPainter();
		int p1 = getGlyphPainter().getBoundedPosition(this, p0, pos, len);
		int breakSpot = getBreakSpot(p0, p1);

		if(breakSpot != -1)
		{
			p1 = breakSpot;
		}
		
		// else, no break in the region, return a fragment of the
		// bounded region.
		if(p0 == getStartOffset() && p1 == getEndOffset())
		{
			return this;
		}
		
		GlyphView v = (GlyphView)createFragment(p0, p1);
		
		// FIX no setter
		//v.x = (int)pos;
		
		return v;
	}
	return this;
}
 
开发者ID:andy-goryachev,项目名称:PasswordSafe,代码行数:30,代码来源:XLabelView.java

示例5: main

import javax.swing.text.GlyphView; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    robot = new Robot();
    robot.setAutoDelay(50);
    glyphViews = new ArrayList<GlyphView>();

    createAndShowGUI(text1);

    toolkit.realSync();

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            retrieveGlyphViews(editorPane.getUI().getRootView(editorPane));
        }
    });
    GlyphView [] arr1 = glyphViews.toArray(new GlyphView[glyphViews.size()]);

    frame.dispose();
    glyphViews.clear();

    createAndShowGUI(text2);

    toolkit.realSync();

    Util.hitKeys(robot, KeyEvent.VK_HOME);
    toolkit.realSync();

    Util.hitKeys(robot, KeyEvent.VK_O);
    Util.hitKeys(robot, KeyEvent.VK_N);
    Util.hitKeys(robot, KeyEvent.VK_E);
    Util.hitKeys(robot, KeyEvent.VK_SPACE);
    Util.hitKeys(robot, KeyEvent.VK_T);
    Util.hitKeys(robot, KeyEvent.VK_W);
    Util.hitKeys(robot, KeyEvent.VK_O);
    Util.hitKeys(robot, KeyEvent.VK_SPACE);

    toolkit.realSync();

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            retrieveGlyphViews(editorPane.getUI().getRootView(editorPane));
        }
    });
    GlyphView [] arr2 = glyphViews.toArray(new GlyphView[glyphViews.size()]);

    if (arr1.length != arr2.length) {
        throw new RuntimeException("Test Failed!");
    }

    for (int i=0; i<arr1.length; i++) {
        GlyphView v1 = arr1[i];
        GlyphView v2 = arr2[i];
        Field field = GlyphView.class.getDeclaredField("breakSpots");
        field.setAccessible(true);
        int[] breakSpots1 = (int[])field.get(v1);
        int[] breakSpots2 = (int[])field.get(v2);
        if (!Arrays.equals(breakSpots1,breakSpots2)) {
            throw new RuntimeException("Test Failed!");
        }
    }

    frame.dispose();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:64,代码来源:bug8014863.java

示例6: main

import javax.swing.text.GlyphView; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    robot = new Robot();
    robot.setAutoDelay(50);
    glyphViews = new ArrayList<GlyphView>();

    createAndShowGUI(text1);

    robot.waitForIdle();

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            retrieveGlyphViews(editorPane.getUI().getRootView(editorPane));
        }
    });
    GlyphView [] arr1 = glyphViews.toArray(new GlyphView[glyphViews.size()]);

    frame.dispose();
    glyphViews.clear();

    createAndShowGUI(text2);

    robot.waitForIdle();

    Util.hitKeys(robot, KeyEvent.VK_HOME);
    robot.waitForIdle();

    Util.hitKeys(robot, KeyEvent.VK_O);
    Util.hitKeys(robot, KeyEvent.VK_N);
    Util.hitKeys(robot, KeyEvent.VK_E);
    Util.hitKeys(robot, KeyEvent.VK_SPACE);
    Util.hitKeys(robot, KeyEvent.VK_T);
    Util.hitKeys(robot, KeyEvent.VK_W);
    Util.hitKeys(robot, KeyEvent.VK_O);
    Util.hitKeys(robot, KeyEvent.VK_SPACE);

    robot.waitForIdle();

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            retrieveGlyphViews(editorPane.getUI().getRootView(editorPane));
        }
    });
    GlyphView [] arr2 = glyphViews.toArray(new GlyphView[glyphViews.size()]);

    if (arr1.length != arr2.length) {
        throw new RuntimeException("Test Failed!");
    }

    for (int i=0; i<arr1.length; i++) {
        GlyphView v1 = arr1[i];
        GlyphView v2 = arr2[i];
        Field field = GlyphView.class.getDeclaredField("breakSpots");
        field.setAccessible(true);
        int[] breakSpots1 = (int[])field.get(v1);
        int[] breakSpots2 = (int[])field.get(v2);
        if (!Arrays.equals(breakSpots1,breakSpots2)) {
            throw new RuntimeException("Test Failed!");
        }
    }

    frame.dispose();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:63,代码来源:bug8014863.java

示例7: getSpan

import javax.swing.text.GlyphView; //导入依赖的package包/类
public float getSpan(GlyphView v, int startOffset, int endOffset,
                     TabExpander tabExpander, float x) {
    return CHAR_WIDTH * (endOffset - startOffset);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:5,代码来源:InlineViewTest.java

示例8: getBoundedPosition

import javax.swing.text.GlyphView; //导入依赖的package包/类
public int getBoundedPosition(GlyphView v, int startOffset,
                              float x, float len) {
    int result = (int)len / CHAR_WIDTH + startOffset;
    return result <= v.getEndOffset() ? result : v.getEndOffset();
}
 
开发者ID:shannah,项目名称:cn1,代码行数:6,代码来源:InlineViewTest.java

示例9: getHeight

import javax.swing.text.GlyphView; //导入依赖的package包/类
public float getHeight(GlyphView v) {
    return 0;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:4,代码来源:InlineViewTest.java

示例10: getAscent

import javax.swing.text.GlyphView; //导入依赖的package包/类
public float getAscent(GlyphView v) {
    return 0;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:4,代码来源:InlineViewTest.java

示例11: getDescent

import javax.swing.text.GlyphView; //导入依赖的package包/类
public float getDescent(GlyphView v) {
    return 0;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:4,代码来源:InlineViewTest.java

示例12: paint

import javax.swing.text.GlyphView; //导入依赖的package包/类
public void paint(GlyphView v, Graphics g, Shape alloc,
                  int startOffset, int endOffset) {
}
 
开发者ID:shannah,项目名称:cn1,代码行数:4,代码来源:InlineViewTest.java

示例13: modelToView

import javax.swing.text.GlyphView; //导入依赖的package包/类
public Shape modelToView(GlyphView v, int offset, Bias bias,
                         Shape alloc) throws BadLocationException {
    return null;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:5,代码来源:InlineViewTest.java

示例14: viewToModel

import javax.swing.text.GlyphView; //导入依赖的package包/类
public int viewToModel(GlyphView v, float x, float y,
                       Shape alloc, Bias[] biasReturn) {
    return -1;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:5,代码来源:InlineViewTest.java


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