Package java.awt.font

Examples of java.awt.font.TransformAttribute


   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)     
  {
    AffineTransform identity = new AffineTransform();
    TransformAttribute t = new TransformAttribute(identity);
    harness.check(t.getTransform(), identity);
    // the transform passed to the constructor should be cloned by the
    // constructor, so the references should be different...
    harness.check(t.getTransform() != identity);
   
    AffineTransform at = AffineTransform.getTranslateInstance(1.2, 3.4);
    t = new TransformAttribute(at);
    harness.check(t.getTransform(), at);
   
    // spec doesn't say how to handle null, but RI throws
    // IllegalArgumentException
    boolean pass = false;
    try
    {
      t = new TransformAttribute(null);
    }
    catch (IllegalArgumentException e)
    {
      pass = true;  
    }
View Full Code Here


   *
   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)       
  {
    TransformAttribute t = new TransformAttribute(new AffineTransform());
    testSerialization(t, harness);
    t = new TransformAttribute(AffineTransform.getTranslateInstance(1.2, 3.4));
    testSerialization(t, harness);
  }
View Full Code Here

    testSerialization(t, harness);
  }
 
  private void testSerialization(TransformAttribute t1, TestHarness harness)
  {
    TransformAttribute t2 = null;
    try {
      ByteArrayOutputStream buffer = new ByteArrayOutputStream();
      ObjectOutput out = new ObjectOutputStream(buffer);
      out.writeObject(t1);
      out.close();

      ObjectInput in = new ObjectInputStream(
        new ByteArrayInputStream(buffer.toByteArray())
      );
      t2 = (TransformAttribute) in.readObject();
      in.close();
    }
    catch (Exception e) {
      harness.debug(e);
    }
    harness.check(t1.getTransform(), t2.getTransform());
  }
View Full Code Here

   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)     
  {
    AffineTransform t1 = new AffineTransform();
    TransformAttribute ta = new TransformAttribute(t1);
    harness.check(ta.isIdentity());
    AffineTransform t2 = AffineTransform.getTranslateInstance(1.2, 3.4);
    ta = new TransformAttribute(t2);
    harness.check(!ta.isIdentity());
  }
View Full Code Here

   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)     
  {
    AffineTransform t1 = AffineTransform.getTranslateInstance(1.2, 3.4);
    TransformAttribute ta = new TransformAttribute(t1);
    AffineTransform t2 = ta.getTransform();
    harness.check(t1, t2);
   
    // the returned transform should be a clone of the wrapped transform,
    // so changing it should not impact the TransformAttribute...
    t2.setToIdentity();
    AffineTransform t3 = ta.getTransform();
    harness.check(!t3.equals(t2));
  }
View Full Code Here

                    TextAttribute.POSTURE_OBLIQUE);
        } else if (derivefRequestedAttributes.get(TextAttribute.POSTURE) != null){
            derivefRequestedAttributes.remove(TextAttribute.POSTURE);
        }
        derivefRequestedAttributes.put(TextAttribute.TRANSFORM,
                new TransformAttribute(trans));

        return new Font(derivefRequestedAttributes);
    }
View Full Code Here

        }

        Hashtable<Attribute, Object> derivefRequestedAttributes = (Hashtable<Attribute, Object>)fRequestedAttributes.clone();

        derivefRequestedAttributes.put(TextAttribute.TRANSFORM,
                new TransformAttribute(trans));

        return new Font(derivefRequestedAttributes);

    }
View Full Code Here

                    TextAttribute.POSTURE_OBLIQUE);
        } else if (derivefRequestedAttributes.get(TextAttribute.POSTURE) != null){
            derivefRequestedAttributes.remove(TextAttribute.POSTURE);
        }
        derivefRequestedAttributes.put(TextAttribute.TRANSFORM,
                new TransformAttribute(trans));

        return new Font(derivefRequestedAttributes);
    }
View Full Code Here

        case EWIDTH: width = ((Number)o).floatValue(); break;
        case EPOSTURE: posture = ((Number)o).floatValue(); break;
        case ESIZE: size = ((Number)o).floatValue(); break;
        case ETRANSFORM: {
            if (o instanceof TransformAttribute) {
                TransformAttribute ta = (TransformAttribute)o;
                if (ta.isIdentity()) {
                    transform = null;
                } else {
                    transform = ta.getTransform();
                }
            } else {
                transform = new AffineTransform((AffineTransform)o);
            }
            updateDerivedTransforms();
View Full Code Here

        case EPOSTURE: return Float.valueOf(posture);
        case ESIZE: return Float.valueOf(size);
        case ETRANSFORM:
            return transform == null
                ? TransformAttribute.IDENTITY
                : new TransformAttribute(transform);
        case ESUPERSCRIPT: return Integer.valueOf(superscript);
        case EFONT: return font;
        case ECHAR_REPLACEMENT: return charReplacement;
        case EFOREGROUND: return foreground;
        case EBACKGROUND: return background;
View Full Code Here

TOP

Related Classes of java.awt.font.TransformAttribute

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.