Package java.awt.font

Examples of java.awt.font.TextHitInfo


    if ((mnemonicIndex >= 0) && (mnemonicIndex < paintText.length()))
    {
      TextLayout layout = new TextLayout(as.getIterator(),
                                         g2.getFontRenderContext());

      TextHitInfo leading = TextHitInfo.leading(mnemonicIndex);
      TextHitInfo trailing = TextHitInfo.trailing(mnemonicIndex);

      Rectangle r =
        layout.getVisualHighlightShape(leading, trailing).getBounds();

      // draw a horizontal line under the specified character to indicate
View Full Code Here


public class getCharIndex implements Testlet
{

  public void test(TestHarness harness)
  {
    TextHitInfo info = TextHitInfo.leading(-2);
    harness.check(info.getCharIndex(), -2);
   
    info = TextHitInfo.leading(0);
    harness.check(info.getCharIndex(), 0);
   
    info = TextHitInfo.leading(4);
    harness.check(info.getCharIndex(), 4);
   
    info = TextHitInfo.trailing(-2);
    harness.check(info.getCharIndex(), -2);
   
    info = TextHitInfo.trailing(0);
    harness.check(info.getCharIndex(), 0);
   
    info = TextHitInfo.trailing(4);
    harness.check(info.getCharIndex(), 4);
  }
View Full Code Here

    equalsTextHitInfo(harness);
  }
 
  public void equalsObject(TestHarness harness)
  {
    TextHitInfo info = TextHitInfo.trailing(0);
    harness.check(info.equals((Object) null), false);

    harness.check(info.equals((Object) TextHitInfo.trailing(0)), true);
   
    String a = "Some String";
    harness.check(info.equals(a), false);
  }
View Full Code Here

    harness.check(info.equals(a), false);
  }

  public void equalsTextHitInfo(TestHarness harness)
  {
    TextHitInfo info = TextHitInfo.trailing(0);
    harness.check(info.equals((TextHitInfo) null), false);

    harness.check(info.equals(TextHitInfo.trailing(0)), true);
    harness.check(info.equals(TextHitInfo.trailing(1)), false);
    harness.check(info.equals(TextHitInfo.leading(0)), false);
    harness.check(info.equals(TextHitInfo.leading(1)), false);
  }
View Full Code Here

public class toString implements Testlet
{

  public void test(TestHarness harness)
  {
    TextHitInfo info = TextHitInfo.leading(0);
    harness.check(info.toString(), "TextHitInfo[0L]");
   
    info = TextHitInfo.trailing(5);
    harness.check(info.toString(), "TextHitInfo[5T]")
  }
View Full Code Here

public class getOtherHit implements Testlet
{

  public void test(TestHarness harness)
  {
    TextHitInfo info = TextHitInfo.leading(0);
    harness.check(info.getOtherHit().toString(), "TextHitInfo[-1T]");
   
    info = TextHitInfo.trailing(0);
    harness.check(info.getOtherHit().toString(), "TextHitInfo[1L]");
  }
View Full Code Here

public class isLeadingEdge implements Testlet
{

  public void test(TestHarness harness)
  {
    TextHitInfo info = TextHitInfo.leading(-2);
    harness.check(info.isLeadingEdge(), true);
   
    info = TextHitInfo.leading(0);
    harness.check(info.isLeadingEdge(), true);
   
    info = TextHitInfo.leading(4);
    harness.check(info.isLeadingEdge(), true);
   
    info = TextHitInfo.trailing(-2);
    harness.check(info.isLeadingEdge(), false);
   
    info = TextHitInfo.trailing(0);
    harness.check(info.isLeadingEdge(), false);
   
    info = TextHitInfo.trailing(4);
    harness.check(info.isLeadingEdge(), false);
   
    harness.check(TextHitInfo.leading(1).isLeadingEdge(), true);
    harness.check(TextHitInfo.trailing(1).isLeadingEdge(), false);
  }
View Full Code Here

public class getInsertionIndex implements Testlet
{

  public void test(TestHarness harness)
  {
    TextHitInfo info = TextHitInfo.leading(-2);
    harness.check(info.getInsertionIndex(), -2);
   
    info = TextHitInfo.leading(0);
    harness.check(info.getInsertionIndex(), 0);
   
    info = TextHitInfo.leading(4);
    harness.check(info.getInsertionIndex(), 4);
   
    info = TextHitInfo.trailing(-2);
    harness.check(info.getInsertionIndex(), -1);
   
    info = TextHitInfo.trailing(0);
    harness.check(info.getInsertionIndex(), 1);
   
    info = TextHitInfo.trailing(4);
    harness.check(info.getInsertionIndex(), 5);
   
    harness.check(TextHitInfo.leading(1).getInsertionIndex(), 1);
    harness.check(TextHitInfo.trailing(1).getInsertionIndex(), 2);   
  }
View Full Code Here

public class hashCode implements Testlet
{

  public void test(TestHarness harness)
  {
    TextHitInfo info = TextHitInfo.leading(-2);
    harness.check(info.hashCode(), -2);
   
    info = TextHitInfo.leading(0);
    harness.check(info.hashCode(), 0);
   
    info = TextHitInfo.leading(4);
    harness.check(info.hashCode(), 4);
   
    info = TextHitInfo.trailing(-2);
    harness.check(info.hashCode(), -2);
   
    info = TextHitInfo.trailing(0);
    harness.check(info.hashCode(), 0);
   
    info = TextHitInfo.trailing(4);
    harness.check(info.hashCode(), 4);
   
    harness.check(TextHitInfo.leading(1).hashCode(), 1);
    harness.check(TextHitInfo.trailing(1).hashCode(), 1);    
  }
View Full Code Here

public class getOffsetHit implements Testlet
{

  public void test(TestHarness harness)
  {
    TextHitInfo info = TextHitInfo.leading(0);
    harness.check(info.getOffsetHit(0).toString(), "TextHitInfo[0L]");
    harness.check(info.isLeadingEdge(), true);
   
    info = TextHitInfo.leading(0);
    harness.check(info.getOffsetHit(-2).toString(), "TextHitInfo[-2L]");
    harness.check(info.isLeadingEdge(), true);
   
    info = TextHitInfo.leading(0);
    harness.check(info.getOffsetHit(2).toString(), "TextHitInfo[2L]");
    harness.check(info.isLeadingEdge(), true);
   
    info = TextHitInfo.trailing(0);
    harness.check(info.getOffsetHit(0).toString(), "TextHitInfo[0T]");
    harness.check(info.isLeadingEdge(), false);
   
    info = TextHitInfo.trailing(0);
    harness.check(info.getOffsetHit(-2).toString(), "TextHitInfo[-2T]");
    harness.check(info.isLeadingEdge(), false);
   
    info = TextHitInfo.trailing(0);
    harness.check(info.getOffsetHit(2).toString(), "TextHitInfo[2T]");
    harness.check(info.isLeadingEdge(), false);
  }
View Full Code Here

TOP

Related Classes of java.awt.font.TextHitInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.