How find shape containing all pixels in string drawn at angle?

I've drawn a string on a JPanel at an angle using the code below. I want the mouse to turn into a hand when hovering over it but I don't know how to find the shape that an angled string comprises. (I can do it if it's written horizontally). How would I calculate that?
double theta = Math.toRadians( angle );
AffineTransform transform = AffineTransform.getRotateInstance( theta );
( ( Graphics2D ) graphics ).setTransform( transform );
graphics.drawString( text, x, y );

For the String you can create a Rectangle where the String is contained when it has no rotation. After that you can create Area (see java.awt.geom.Area) from the Rectangle and use transform() method of area to get a rotated one. Then just use contains() method.
Regards,
Stas

Similar Messages

  • How can I list all folders that contain files with a specific file extension? I want a list that shows the parent folders of all files with a .nef extension.

    not the total path to the folder containing the files but rather just a parent folder one level up of the files.
    So file.nef that's in folder 1 that's in folder 2 that's in folder 3... I just want to list folder 1, not 2 or 3 (unless they contain files themselves in their level)

    find $HOME -iname '*.nef' 2>/dev/null | awk -F '/'   'seen[$(NF-1)]++ == 0 { print $(NF-1) }'
    This will print just one occurrence of directory
    The 'find' command files ALL *.nef files under your home directory (aka Folder)
    The 2>/dev/null throws away any error messages from things like "permissions denied" on a protected file or directory
    The 'awk' command extracts the parent directory and keeps track of whether it has displayed that directory before
    -F '/' tells awk to split fields using the / character
    NF is an awk variable that contains the number of fields in the current record
    NF-1 specifies the parent directory field, as in the last field is the file name and minus one if the parent directory
    $(NF-1) extracts the parent directory
    seen[] is a context addressable array variable (I choose the name 'seen'). That means I can use text strings as lookup keys.  The array is dynamic, so the first time I reference an element, if it doesn't exist, it is created with a nul value.
    seen[$(NF-1)] accesses the array element associated with the parent directory.
    seen[$(NF-1)]++ The ++ increments the element stored in the array associated with the parent directory key AFTER the value has been fetched for processing.  That is to say the original value is preserved (short term) and the value in the array is incremented by 1 for the next time it is accessed.
    the == 0 compares the fetched value (which occurred before it was incremented) against 0.  The first time a unique parent directory is used to access the array, a new element will be created and its value will be returned as 0 for the seen[$(NF-1)] == 0 comparison.
    On the first usage of a unique parent directory the comparison will be TRUE, so the { print $(NF-1) } action will be performed.
    After the first use of a unique parent directory name, the seen[$(NF-1)] access will return a value greater than 0, so the comparison will be FALSE and thus the { print $(NF-1)] } action will NOT be performed.
    Thus we get just one unique parent directory name no matter how many *.nef files are found.  Of course you get only one unique name, even if there are several same named sub-directories but in different paths
    You could put this into an Automator workflow using the "Run Shell Script" actions.

  • How to find the total length of the string drawed in a rect?

    Hello Everybody,
    I am drawing a string in on one rect using drawInRect method. This drawInRect method gives us a return value as size of the rect. I need length of the string that is did draw in that rect, but didn't find any api to do this.
    Can anyone tell me , how find the length of the string which we did draw in rect?
    Any help regarding this issue , is highly appreciable.
    Thanks,
    Pandit

    Hi Adreas,
    First of all, very thanks for the response.
    Actually , I am looking for other thing. Using drawInRect method I am drawing contentString in self.rect like below.
    //code
    [contentString drawInRect:self.rect withFont:[UIFont fontWithName:@"Verdana" size:14.0] lineBreakMode:UILineBreakModeWordWrap alignment:UITextAlignmentLeft];
    //End
    My contentString is much larger string, so I am not able to draw it in rect(length: 320.0 height: 460.0) completely. My rect is showing only a part of a contentString. So I need to get that part of string which did draw in the rect, so that I can process my contentString to get the remaining string to draw it a next rect.
    The above code statement is returning me the CGSIZE , it is giving the size of the rect but not giving any information of the string which get draw in that rect.Do you have any idea how to do this?
    Any information on this is highly appreciable.
    Thanks,
    Pandit

  • How to create a folder (in unified folders) which contains all the messages of inboxes and outboxes

    Hi, i've searched without success how to create a folder (in unified folders) which contains all the messages of inboxes and outboxes (as it exists in Windows Live Mail).
    For me, it would be very useful to search in only one folder when i try to find something in sent and received mails.
    Thank's

    This is what Unified Folders does. I'm not sure what exactly you're trying to achieve.
    http://kb.mozillazine.org/Global_Inbox#Unified_Folders
    You might take a look at this article.
    https://support.mozilla.org/en-US/kb/global-search

  • How to find MATCH count for #  in a String

    Hi all,
    How to find MATCH count for #  in a String.
    Ex:  6170#0400-0002-00#API3PT#AL#AUST#DEVE#KG#100.00#100.00#100.00#0.00##10.20
    Regards,
    Balavardhan.K

    >
    balavardhan k wrote:
    > I have used below syntax to find count but it is not returning the value and SY-SUBRC  = 4.
    >
    >
    > Data : l_text type string.
    >
    > l_text = '6170#0400-0002-00#API3PT#AL#AUST#DEVE#KG#100.00#100.00#100.00#0.00##10.20'.
    >
    >
    > FIND ALL OCCURRENCES OF '#' IN L_TEXT MATCH COUNT mcnt .
    Then it's not a # but possible a horizontal tab-sign.
    Do a find on cl_abap_char_utilities=>horizontal_tab instead.
    Edited by: Maen Anachronos on Nov 23, 2010 2:48 PM

  • I find 'plugin-container.exe' takes up 68-91% of my CPU and effectively hangs my machine; how can I avoid this, from happening?

    I find 'plugin-container.exe' takes up 68-91% of my CPU and effectively hangs my machine; how can I avoid this, from happening?

    You can disable the plug-in container for one or two plug-ins, or for all the plug-ins it works for. <br />
    http://kb.mozillazine.org/Plugin-container_and_out-of-process_plugins

  • I'm sure this is a setting fix, but can't find it-.  All of my windows for mac programs open when I turn on my computer, such that I have to close each one individually to get to my desk top.  How do I adjust so none of them open unless I choose to?

    I'm sure this is a setting fix, but can't find it….  All of my windows for mac programs open when I turn on my computer, such that I have to close each one individually to get to my desk top.  How do I adjust so none of them open unless I choose to?

    Remove the check in the box "Reopen windows when logging back in":

  • I unfortunately just got my IPhone 4s stolen.I thought I had the find my iPhone enabled but I didn't because I cannot locate the phone when I sign in ICloud.How can I erase all data on the phone so the thief can't access my personal information.

    I unfortunately just got my IPhone 4s stolen.I thought I had the find my iPhone enabled but I didn't because I cannot locate the phone when I sign in ICloud.I have a password on the phone but i'm not sure if I turned on the option where the phone resets if you incorrectly put the password more than ten time. I immediately called my phone company (Verizon) and reported the phone stolen.So I know whoever took the phone cannot place calls or use the phone. But can they still access my data on the phone if they manage to unlock the phone?  If so how can I erase all data on the phone so the thief can't access my personal information? is there any other way other than Find my IPhone to wipe off the data on the phone? I really don't want my personal information such as pictures, text messages, notes and social networks profile available to a stranger!!? Help please!!!

        Hello thewrongway,
    I'm sorry to hear about your phone!  I understand the need for an active device. You are able to activate an old device and process an insurance claim for your iPhone 4s within 60days from the incident date.  Keep in mind if the old phone is not a smartphone and you currently have unlimited data that feature will fall off.  If you have a tier data plan no changes will be made.  Please let me know if you have any additional questions.  Thank you.   
    TominqueBo
    VZW Support
    Follow us on Twitter at @VZWSupport

  • How can I query all the members of a group using querbuilder?  I cannot find any related properties

    How can I query all the members of a group using querbuilder?  I cannot find any related properties describing members under /home/groups/s/sample_group in jcr repository.

    Hi,
    FieldPoint Explorer is no longer used to configure FieldPoint systems. However, I do not think that the configuring your system in FieldPoint Explorer is causing the error.
    FieldPoint systems are now setup in Measurement and Automation Explorer (MAX).  Information on setting up FieldPoint systems in MAX can be found in the MAX help under: Installed Products>> FieldPoint. Also, I recommend upgrading to the latest FieldPoint driver and version of MAX.  The FieldPoint VI's will be slightly different when you upgrade, so there is a good chance that this will eliminate the error.
    Regards,
    Hal L.

  • How do i find and move all files across multiple disks

    I just purchased a 2010 Mac Pro and wanted to set it up with a clean install of Mavericks.  I installed a new SSD as my boot disk and did a clean install of Mavericks on it.   All good so far.
    Now from my previous Macs I have several disks (internal and external) that have pictures, music and movies spread all over the place.
    I want to know how I can search all of the drives for all of a specific file type (i.e, JPEG or MP3) and then move those files to a new folder.  Once I have all of the files of a specific type in a single folder I can create a new library in iPhoto or iTunes using those files.
    I tried AraxisFDF and it worked well for finding the files but when it moves the files it saves then in their original file structure (i.e, volume/folder/folder/folder/file) which places the files in multiple folders again.
    Any ideas?
    Thanks.

    You can clone the respective HDDs using Disk Utility>Restore or Carbon Copy Cloner.  That will guarantee that you have all images and movies backed up.
    Ciao

  • How Do i Find out where all My Memory is Being Used and to reduce it

    How do i Find out where all my Memory is Being used and whats the best way to reduce it.
    Cheers Madmax.14

    Try DupeGuru to find duplicate files.
    Omni Disk Sweeper is good and so is Grand Perspective
    Chris

  • How to Change Finder Settings in All Windows?

    Hi All,
    Similar to the original post found here:  Re: How to Change View Options for ALL Finder Windows?
    I'm trying to change my finder settings across all finder windows... I tried the solution posted in the above thread but get this message in terminal.  I'm not all that computer savvy when it comes to terminal so not sure what it means... Perhaps someone knows of a different and/or better solution?
    Any help would be much appreciated, thanks and take care!
    Dave

    Yup got it back after waiting, followed the remaining directions, but didn't work for me... not sure why?  Upon rebooting folders do not change after I readjust settings and click 'use as default'.... strange... I even tried that other line of code another person posted later on in the previous thread. 

  • How do I re-download my iphoto library if I can no longer find iphoto on my desktop or in my finder without loosing all of my photos?

    How do I re-download my iphoto library if I can no longer find iphoto on my desktop or in my finder without loosing all of my photos?

    How did you install it in the first place? If it came with your Mac, and the Mac didn't come with Lion installed, then reinstall iLife from the Applications disc that was in the box. If you no longer have that disc, you'll have to order a replacement from Apple customer service. Either that, or restore the iPhoto application from your backups.
    If you got iPhoto from the App Store, you can download it again by launching the App Store application.

  • How to Find out the all  tables in module wise ?

    Dear Friends,
    1.How to Find out the all  tables in module wise ?
       what are the total number of table in SAP ?
    2. how to find out all existing functions in SAP ?
    Thanks and regards,
    Subasha Chandra Sahoo.

    Hi,
    You will get the module wise list from:
    http://www.sourceveda.com/SAPReference.htm
    http://www.sourceveda.com/
    Regards...

  • I dont have any icons except computers and settings.  how do i find istore with all my previous purchased content?

    i dont have any icons except computers and settings.  how do i find istore with all my previous purchased content?

    That is the result when the Apple TV has lost the Internet connection.

Maybe you are looking for

  • Is it possible to see two libraries via home sharing on a single ipad at the same time?

    I have an iMac with an itunes library (and unique Apple ID) and a MacBook Pro with a different itunes library (and different Apple ID).  I would like to see both libraries at the same time on my iPad.  So far, I have only been able to figure out how

  • Saving text generated by script as an html file

    Hi I have designed a script that generates text which I would like to save as an html file called 'index.html' on my desktop. Is it possible to do this using TextEdit or some other application? Thanks Nick

  • CUP - Customizing Security & Roles

    Hello, Using the GRC AC 5.3 Security Guide, we've been customizing our front-end CUP roles to fit our needs. We're having trouble customizing one particular area, however. Example: When an approver (AEApprover role) or administrator (AEAdmin role) lo

  • Lightroom and other applications not showing in Adobe Application Manager

    I have just installed the Adobe Application Manager several applications aren't list, for example lightroom. I have read that it might be due to my system spec, however I doubt that. My system specs are as follows: OS: Windows 8 Pro CPU: Core i7-362Q

  • Redo log transfer

    How can I be sure that, my redo transport services has been enable and LGWR is transferring on another machine?? source: ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=DS02.BD.NET LGWR ASYNC OPTIONAL NOREGISTER VALID_FOR=(ALL_LOGFILES,PRIMARY_ROLE)' SC