Java 类javax.swing.text.GlyphView 实例源码

项目:SmartQQ4IntelliJ    文件:WrapHTMLFactory.java   
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);
}
项目:jdk8u-jdk    文件:bug6857057.java   
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");
    }
}
项目:jdk8u-jdk    文件:bug8014863.java   
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);
        }
    }
}
项目:openjdk-jdk10    文件:bug6857057.java   
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");
    }
}
项目:openjdk-jdk10    文件:bug8014863.java   
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);
        }
    }
}
项目:openjdk9    文件:bug6857057.java   
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");
    }
}
项目:openjdk9    文件:bug8014863.java   
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);
        }
    }
}
项目:jdk8u_jdk    文件:bug6857057.java   
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");
    }
}
项目:jdk8u_jdk    文件:bug8014863.java   
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);
        }
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:bug6857057.java   
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");
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:bug8014863.java   
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);
        }
    }
}
项目:PasswordSafe    文件:XLabelView.java   
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;
}
项目:infobip-open-jdk-8    文件:bug6857057.java   
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");
    }
}
项目:infobip-open-jdk-8    文件:bug8014863.java   
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);
        }
    }
}
项目:jdk8u-dev-jdk    文件:bug6857057.java   
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");
    }
}
项目:jdk8u-dev-jdk    文件:bug8014863.java   
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);
        }
    }
}
项目:jdk7-jdk    文件:bug6857057.java   
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");
    }
}
项目:openjdk-source-code-learn    文件:bug6857057.java   
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");
    }
}
项目:OLD-OpenJDK8    文件:bug6857057.java   
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");
    }
}
项目:OLD-OpenJDK8    文件:bug8014863.java   
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);
        }
    }
}
项目:JAVA_UNIT    文件:bug6857057.java   
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");
    }
}
项目:openjdk-jdk7u-jdk    文件:bug6857057.java   
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");
    }
}
项目:openjdk-jdk7u-jdk    文件:bug8014863.java   
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);
        }
    }
}
项目:openjdk-icedtea7    文件:bug6857057.java   
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");
    }
}
项目:jdk8u-jdk    文件:bug8014863.java   
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();
}
项目:openjdk-jdk10    文件:bug8014863.java   
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();
}
项目:openjdk9    文件:bug8014863.java   
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();
}
项目:jdk8u_jdk    文件:bug8014863.java   
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();
}
项目:lookaside_java-1.8.0-openjdk    文件:bug8014863.java   
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();
}
项目:infobip-open-jdk-8    文件:bug8014863.java   
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();
}
项目:jdk8u-dev-jdk    文件:bug8014863.java   
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();
}
项目:OLD-OpenJDK8    文件:bug8014863.java   
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();
}
项目:cn1    文件:InlineViewTest.java   
public float getSpan(GlyphView v, int startOffset, int endOffset,
                     TabExpander tabExpander, float x) {
    return CHAR_WIDTH * (endOffset - startOffset);
}
项目:cn1    文件:InlineViewTest.java   
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();
}
项目:cn1    文件:InlineViewTest.java   
public float getHeight(GlyphView v) {
    return 0;
}
项目:cn1    文件:InlineViewTest.java   
public float getAscent(GlyphView v) {
    return 0;
}
项目:cn1    文件:InlineViewTest.java   
public float getDescent(GlyphView v) {
    return 0;
}
项目:cn1    文件:InlineViewTest.java   
public void paint(GlyphView v, Graphics g, Shape alloc,
                  int startOffset, int endOffset) {
}
项目:cn1    文件:InlineViewTest.java   
public Shape modelToView(GlyphView v, int offset, Bias bias,
                         Shape alloc) throws BadLocationException {
    return null;
}
项目:cn1    文件:InlineViewTest.java   
public int viewToModel(GlyphView v, float x, float y,
                       Shape alloc, Bias[] biasReturn) {
    return -1;
}