Can't get affine transforms do anything on an AttributedString

Hello,
I'm trying to transform individual characters in an AttributedString using the respective attribute, but nothing happens as though the transforms simply were ignored by the renderer. Other attributes like underline and strikethrough work fine, however. Am I missing something?
import java.awt.*;
import java.awt.font.*;
import java.text.*;
import java.applet.Applet;
import java.awt.geom.*;
public class test4 extends Applet {
     public void paint(Graphics g) {
          Graphics2D g2 = (Graphics2D) g;
          String s = "abc";
          Font f = new Font("Times New Roman", Font.PLAIN, 24);
          AttributedString as = new AttributedString(s);
          as.addAttribute(TextAttribute.FONT, f);
          as.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON, 0,
                    1);
          as.addAttribute(TextAttribute.TRANSFORM, new TransformAttribute(
                    AffineTransform.getScaleInstance(0.5, 3)), 1,3);
          g2.drawString(as.getIterator(new
                    TextAttribute[]{TextAttribute.TRANSFORM,TextAttribute.UNDERLINE}),30,40);
}

Hi,
I'm not sure why the code you have does not work but a quick search for bugs revealed that there are some outstanding issues relating to AttributedString. It may be worth looking into a little more.
The following code seems to get the desired result if it helps:
String s = "abc";
Font f = new Font("Times New Roman", Font.PLAIN, 24);
AttributedString as = new AttributedString(s);
as.addAttribute(TextAttribute.FONT, f);
as.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON, 0, 1);
AffineTransform transform = AffineTransform.getScaleInstance(0.5, 3);
f = f.deriveFont(transform);
as.addAttribute(TextAttribute.FONT, f, 1, 3);
g2.drawString(as.getIterator(), 30, 100);

Similar Messages

  • My  iPod touch screen says it is disabled.  Connect to iTunes.  When I connect the device to the computer a window pops up and said that the iPod is locked and I need to enter the passcode on the iPod..... I can't get it to do anything.  Any ideas?

    My  iPod touch screen says it is disabled.  Connect to iTunes.  When I connect the device to the computer a window pops up and said that the iPod is locked and I need to enter the passcode on the iPod..... I can't get it to do anything.  Any ideas?

    Place the iOS device in Recovery Mode and then connect to your computer and restore via iTunes. The iPod will be erased.
    iOS: Wrong passcode results in red disabled screen        
    If recovery mode does not work try DFU mode.
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings

  • My iphone 5 has just had an update for candy crush and ever since i opened it the screen has been black and I can't get it to do anything what can I do?

    My iphone 5 has just had an update for candy crush and ever since i opened it the screen has been black and I can't get it to do anything what can I do?

    - Quit the App by opening multi-tasking bar, and swiping the App upward to make it disappear.  (For iOS 6, holding down the icon for the App for about 3-5 seconds, and then tap the red circle with the white minus sign.)  Relaunch the App and try again.
    - Restart the device. http://support.apple.com/kb/ht1430
    - Reset the device. (Same article as above.)
    - Reset All Settings (Settings > General > Reset > Reset All Settings)
    - Delete the App, then reinstall it.
    Test the issue after each step.  Make sure to quit the app as described before each followup step.

  • My iphone is locked.  just has an itune pic on it.  Can't get it to do anything.  Any ideas?

    My iphone is locked.  just has an itune pic on it.  Can't get it to do anything.  Any ideas?

    jujumo4 wrote:
      just has an itune pic on it.  Can't get it to do anything.  Any ideas?
    Make sure you have the Latest Version of iTunes (v11) Installed on your computer
    iTunes free download from www.itunes.com/download
    1)  Connect to iTunes on the computer you usually Sync with and Restore
    http://support.apple.com/kb/HT1414
    2)  If necessary Place the Device into Recovery mode...
    http://support.apple.com/kb/HT1808
    Note on Recovery Mode.
    You may need to try this More than Once...
    Be sure to Follow ALL the Steps...
    Once you have Recovered your Device...
    Re-Sync your Content or Restore from the most Recent Backup...
    Restore from Backup  >  http://support.apple.com/kb/ht1766

  • Need help with Flash CS4 buttons/can't get buttons to control anything

    Hello,
    I need help with Flash CS4. I am making a banner with an animation (Image change into movie clip "3D Spiral") and added buttons but I cannot get the buttons to control the animation. Please help I am frustrated! If someone could help I would be most appreciated.

    Thank you.
    Regards,
    Michael J. Sheehan  allelois
    Date: Mon, 17 Aug 2009 18:48:09 -0600
    From: [email protected]
    To: [email protected]
    Subject: Need help with Flash CS4 buttons/can't get buttons to control anything
    Hi there
    I'm not sure how you wound up where you did. But you wound up in the Adobe Captivate forums. Please stand by as I move your thread to the Flash forums.
    Cheers... Rick
    >

  • HT4623 I thought I was updating my IPad, i selected update and came back home to the screen frozen with the Itunes symbol and a plug in cord displayed.  I can not get it to do anything.

    I thought I was updating my IPad, i selected update and came back home to the screen frozen with the Itunes symbol and a plug in cord displayed.  I can not get it to do anything.  Any suggestions?

    Your iPad has gone into recovery mode and it needs to be restored now. The instructions are in this kb article.
    If you can't update or restore your iOS device - Support - Apple

  • I have a new iPod touch.  It shows a picture of a USB plug going into the iTunes logo.  Can't get it to do anything.  What do I do?

    I have a new iPod touch.  It shows a picture of a USB plug going into the iTunes logo.  Can't get it to do anything.  What do I do?

    You really need to repair your computer.
    Please read Chapter 2.
    There have been some problems accessing pages on the Apple web site.  If the hyperlink gives you a "We're sorry" message, try again.

  • Screen is big and can't get it to do anything

    everything on the screen is huge and i can't get it to do anything...i've restored it and shut it down and nothing is working

    Like gdgmacguy said. Or Click Settings Icon > General > at bottom Accessability > Zoom turn it OFF.

  • Help please - have a Nano and a Shuffle and neither are working! The Nano wheel appears to have stopped working - I can't get it to do anything. I've done the reset,it worked the first time but not since. And the shuffle won't sync with my library!

    Hi,
    I have an iPod shuffle 4th generation and an iPod Nano 5th generation . The Nano wheel appears to have stopped working - I can't get it to play or anything. I've done the reset and it worked the first time, but now the only way I can get it to play anything is to shake it and go with the shuffle choices - I can't change volume, song, pause or turn it off.
    So, I decided to start using the Shuffle which I was given as a present last year. I've plugged it into my laptop (running windows 8 and newest version of iTunes). It appears in iTunes on the left hand side, but when I click to sync (whether I tick sync all or choose artists) it says synched but has no music. It seems to not be linked to the music library - when I tick synch all songs, next to the "sync music" it says 0 songs?
    Any help to fix either would be really appreciated - I'm without any music at the moment and I'm going away this weekend!
    Thanks

    Hi Bblairjones,
    If you are having issues with your Nano and Shuffle, you may want to try the Troubleshooting Assistants on the following page:
    Apple Support: iPod Troubleshooting Assistants
    http://www.apple.com/support/ipod/five_rs/
    Regards,
    - Brenden

  • I just bought an envy110 series and can't get it to copy anything

    I bought an Envy 110 series - was able to make one copy yesterday and now I can not get it to allow me to copy anything today - not sure what is going on?

    terrrd,
    What operating system are you using ? When you try to make a copy what does it do ?
    If I helped you at all it would be great if you clicked the blue kudos star!
    If I solved your post please mark it as solved to help others.
    I'm a printer tech with HP.

  • My screen is totally blank and can't get computer to do anything.

    I have a new MacBook Air. I was working with it tonight, using an external hard drive to put things on this computer that were on my old MacBook. I couldn't remember the keychain login it was asking for. I forced it to quit as I was getting a continual wheel of death. Now the screen is lit but there is nothing on it and I can't get the computer to do anything.

    Like gdgmacguy said. Or Click Settings Icon > General > at bottom Accessability > Zoom turn it OFF.

  • My iphone is in permanent super zoom mode; can't get to apps or anything; has anyone ever seen this?

    my iphone is in permanent super zoom mode. I can't get to apps, phone,or anything. Have tried powering down, resyncing, and i have the latest software update.  Have never seen this before.

    After you do what wjosten said, to disable zoom:
    Settings > General > Accessibility > Zoom > OFF

  • Can't get Javascript to do anything - v5.5 - Syntax Error

    I know how to write javascript. I created an event on a slide and On Enter, I execute:
    <script type="text/javascript">
    alert('js doesnt work here');
    </script>
    That doesn't work. Syntax error. I try without the script tags = Syntax Error. I try without the semicolon =  Syntax Error. I try adding it to the standard.js and calling it from the slide = Syntax Error I try adding it to the <head> in myproject.htm and call from slide = Syntax Error.
    <script type="text/javascript">
    function test() {
        alert('js doesnt work here');
    </script>
    Why can I not get javascript to do anything at all? What is the correct syntax for the "Script_Window" ? Does it want the <script> tags? Does it want semicolons?
    Been working on this for 2 hours trying to get a simple alert to say hi.
    Or maybe it doesn't work with on enter/on exit events. I'll try buttons now, while I wait for a kind soul to hold my hand and teach me javascript.
    Thanks!

    Hello,
    I'm only a newbie with JavaScript, but when I put this in the script window in Captivate, it works after publishing and in Preview in Browser mode:
    alert("JS is working fine in Captivate");
    Sometimes knowing too much is blocking, it seems that Captivate is adding all the other stuff, since you are typing in the Script window for JS.
    BTW have a look at Jim Leichliter's blog, he is our JS-wizard:
    http://captivatedev.com/
    Look at the 'Tuts' part,
    Lilybiri
    PS you create a function, but are not calling that function or did I read it wrong?

  • How does "create and wire unwired cases" work? I can't get it to do anything....

    Ok, I have an event structure with a ton of events. 
    I've just added a value that goes through it...this value is a shift register on the outter loop.
    I see that when your right click the tunnel on the event...there is the switch to turn off "Use Default if Un-wired".
    I also see some options that appear to do what I want to do...and that is to wired all unwired connections on the other events with "Linkted Input Tunnels" -> "Create & Wire Unwired Cases".
    When I click this..the cursor turns to a new shape...but from here...I cannot figure how to get this to work...I've tried right clicking on the 'broken' tunnel at that end....I've tried left clicking in an event that is unwired....but nothing.
    Can someone help me here...I think this is what I want...but can't get it to work.
    Thank you in advance,
    cayenne
    Solved!
    Go to Solution.

    cayenne wrote:
    Ok, I have an event structure with a ton of events. 
    I've just added a value that goes through it...this value is a shift register on the outter loop.
    I see that when your right click the tunnel on the event...there is the switch to turn off "Use Default if Un-wired".
    I also see some options that appear to do what I want to do...and that is to wired all unwired connections on the other events with "Linkted Input Tunnels" -> "Create & Wire Unwired Cases".
    When I click this..the cursor turns to a new shape...but from here...I cannot figure how to get this to work...I've tried right clicking on the 'broken' tunnel at that end....I've tried left clicking in an event that is unwired....but nothing.
    Can someone help me here...I think this is what I want...but can't get it to work.
    Thank you in advance,
    cayenne
    This option is used when you have large number of case structures and the wireing terminal is same. If you want to understand those things do these things
    Create an Enum with 4 elements
    Create a state machine design pattern but wire only one case to the shift register and leave the other cases un wired
    Go to the unwired case at the right click the unwired terminal and select Create & Wire Unwired Cases you will get a wire bundle click that in the input terminal that connects the output
    Undo the previous one and go to the wired case and right click the termianl at the right side of the case structure and select the same Create & Wire Unwired Cases.
    I guess the explanation is clear
    The best solution is the one you find it by yourself

  • I Can't Get it to compile anything.

    Hi, I can't get it to compile. I'm using Windowsxp Pro and the New beta version of Java jsdk1.4.0-beta3. I set path and my classpath but when I go to compile it gives me this message "error: cannot read: BigDebt.java 1error" Can anyone help me I have been going at it for hours an nothing. Tried everything I can think of need outside help. Thanks

    set your environment variables correctly. You should add your folder (where you store your .java files) in the classpath.
    Try this if it works...
    javac -classpath <mydir> myfile.java
    if this succeeds, you will have to add <mydir> in you classpath.
    Reply if works or not.
    All the best.

Maybe you are looking for

  • Mail problems after upgrade

    I've just upgraded my OS from 10.4.11 to 10.5.6. (PowerPC G4, dual 867 MHz). Everything seems OK except Mail. It show my mailboxes, but no mail in any. "Get Mail" doesn't work. I've checked account settings--they're correct. Connection Doctor indicat

  • Set up a family with Apple Products

    What is the best way to set up a family with multiple apple products? Equipment: My wife and I each have iPhone v4s We have an AppleTV version 1 and an AppleTV version 2 iPad 2 NAS in the closet with iTunes server (which we don't utilize) iTunes inst

  • Only one Application can be created at a time?

    We are using enhanced model of SAP-WCM and are in the EHP6 version. We have additional applications, in addition to main application. We do not use Work permit. Our users are creating work approval, applications & WCDs, manually as well as automatica

  • Ghost thumbnails and No files on HD

    My iphoto images are suddenly appearing as blank gray ghosts. All the photo data appears to remain saved for each image, but the visual image itself is missing, with only a gray ghost image left behind. Neither the thumbnails nor the full size jpg sh

  • MM Subcontracting scenario.

    I have to map one scenario - 1. I am procuring one raw material from vendor. 2. I am not receiving material at my end, but transferring material to other 2nd vendor for 1 st operation on RM. 3. For 2nd oprtaion on RM it will go to 3rd vendor 4. After