Is there a way to define 2 different areas using boundaries in a Java app?

Hi,
Im tryig to create a game for kids were they can learn how to write! In one of the games there will be a template of a letter, for example A, the A wii be hollow inside so that the kids can folow the outline! But if they go over a line i want the program to display a message telling them this and having to restart drawing from the mouse!
I know how to draw the lines fron the mouse i just dont kno if it is possible to define different areas according to the shape of a letter??
Hope you can help
RSH

This code will get you a java.awt.Shape representing the outline of any String.
import java.awt.Shape;
import java.awt.Graphics2D;
import java.awt.Font;
import java.awt.font.FontRenderContext;
//Whatever other code you need
//Getting shape of text, put somewhere you can get a Graphics from
FontRenderContext context = g2d.getFontRenderContext();        //where g2d is a Graphics2D
Font anyFont = new Font("Arial", Font.BOLD, 20);
String myText  = "ABCDEFG";
TextLayout textShaper = new TextLayout(myText, anyFont, context);
Shape outline = textShaper.getOutline(null);           
//you can pass a AffineTransform to getOutline( ) if you want some kind of transformation, probably be best
//if you used it to move (translate) the text outline so you can check to see if it contains the mouse pointer.With the Shape representing the outline of the text, you can call contains( ) on it, passing it a Point2D or the x and y locations of the mouse in double precision which returns true if the Shape contains the mouse.
I'm pretty sure that it should work.

Similar Messages

  • Footnotes - Is there a way to define different formats on one document?

    Hi all,
    To my knowledge, footnotes options is applied to the document and not to the text.
    So, there is no option to use both numbers and stars (*).
    So if I want a footnote to be 2, than ***, than 3, I'm unable to do so.
    Is this right?
    thank you
    shlomit

    Alas -- no. InDesign is lacking all but the very basics: no re-start (other than per page or section), no start at an arbitrary number, no switching of numbering style.
    Occasionally, I have to start with a * footnote, then continue with regular numbering. If the star footnote is on a page of its own, I can 'hide' the actual footnote number by setting its color to [None] and manually insert the star in the text and in the note itself. Then I set the next page to start a new section, so the next note will be '1' again.
    If the star note and the first regular note appear on the same page, I also manually insert the star but put its text inside the first footnote above its own text.
    Both are rather dirty tricks that could well be avoided with some additions to the footnote options ...
    [Edit] Actually, the correct answer on
    Is this right?
    would be "Alas -- yes".

  • Can I choose a backup-font for missing characters in a style? Or is there a way to select pink areas

    I have to layout tons of UTF 8 data from a MySQL database.
    There is one problem. The designer picked a font that does not contain the Japanese characters. But there is much inline-Japanese in the text.
    So the imported text has many pink areas (characters not present in font).
    So I search for any of the following options:
    Is there a way to define a fall-back font (like webbrowsers do). If you view UTF in TextEdit (mac) or in the browser, all weird characters are displayed using Osaka. Is there a way to let Indesign replace pink squares with Osaka?
    Is there a way to SELECT all pink squares, and apply a character-style to them? That way I can create a characterstyle with the Osaka font
    Is there a way to have InDesign parse some sort of markup-elements in plain text? I could tweak the MySQL output with PHP to wrap all strange symbols in a markup-item like [japanese]blabla[/japanese]. If that would be converted to characterstyle "Japanese" on import, I would be helped a lot as well.
    The font hack: is there a way to load all available characters in the designfont into Osaka and replace those characters and make Osaka2? Or would that result in a mess?
    I think some automation to get a character style on the pink areas is the best, as that allows to tweak font height and baseline shift to match the other font.
    Does anybody know one of the four or maybe a fifth way to tackle my problem?

    Thanks for standing in for me, Peter - we were hosting the extended family, I did nothing but cook for hours.
    Is there a way to have InDesign parse some sort of markup-elements in plain text? I could tweak the MySQL output with PHP to wrap all strange symbols in a markup-item like [japanese]blabla[/japanese]. If that would be converted to characterstyle "Japanese" on import, I would be helped a lot as well.
    This is what I'd do, honestly.  It depends on your available output-from-DB formats, and what you're placing/importing into ID. But if you're placing raw text (?) then you can't simply use Type -> Find Font, so the GREP solutions offered here are good ones.
    I think some automation to get a character style on the pink areas is the best, as that allows to tweak font height and baseline shift to match the other font.
    Note that the "baseline" in Japanese is not the same place as the baseline in Latin-script. Japanese doesn't really have a baseline - they operate with a completely separate set of typographical conventions - but the effect is that you should not line up the bottom of your Japanese glyphs with the Latin-script baseline. Set some bilingual text in a good font (Kozuka Mincho Pro, it came with ID, you probably already have it installed) and take a look.
    it is very important that you have the correct glyphs or you risk changing the meanings or making the author look like an idiot. If you don't read Japanese you would be well advised to have the document checked by someone who does to be sure it reads OK before it goes into the wild.
    Chances that you'll make something completely illegible are minimal when handling Japanese, but there are a very large number of reasons why you can't just flow Japanese into English-language ID and expect it to work. There are permissible places to wrap Japanese, and places where it's not permissible. The paragraph composer you'd be using if you are using English-language ID will happily break Japanese in the wrong place. This is analagous to bad hyphenation, but looks far more idiotic to the Japanese readership than bad hyphenation looks to an English-language readership (who probably wouldn't notice bad hyphenation unlesss they happen to be a design-savvy readership). Look into using something like Japanese Indesign or World Tools Pro or the TransPacific Digital Japanese-composer template files.

  • Is there a way to define a layer for dynamic objects?

    Hi all. Basically, I'm creating a number of dynamic text field objects in my Actionscript, but it looks like its being rendered on the wrong layer. I've written the actionscript in the first frame of my 3rd layer (which is masked), but the objects that are rendered dont appear to be affected by the masking effect (that does work with static objects). Is there a way to define programatically which layer an object is rendered in? Something like layerNo.stage.addChild(object)?

    first, you have the command 'addChildAt(child, index)'
    thought i'm not sure if that would solve your problem.  in order to mask dynamic text you have to embed its fond, by setting the textfield's property 'embedFonts' to true.

  • Is there a way to view different portions of a document at the same time?

    Is there a way to view different portions of a document at the same time?

    No. I suggest you leave feedback for the Pages team regarding this. You can find it under the Pages menu > Provide Pages Feedback. That takes you to the same page as this link.

  • When using apple remote app on ipad or iphone to control apple TV is there a way of selecting different airplay speakers?

    When using apple remote on ipdad or iphone to control apple TV is there a way to select different airplay speakers without having to control the menu on screen. Eg I want to listed to my music through apple tv (which is in the living room)  and beam it to my airplay speakers in my bedroom, at the moment I would have to go back into the living room to see my tv screen to select the bedroom airplay speakers, then go back upstairs to listen to the music. YOu should be able to select the speakers in app without looking at the TV screen. Hopefully that makes sense!?!

    Look at this.
    Tango Remote Control for iOS6-7 on the App Store on iTunes

  • Is there a way to know who are accessing our SAP instances.

    Hello Friends,
    We have 2 servers (one for ERP and another for XI). Is there a way to know who are all accessing our servers from outside ?
    Also, which are user IDs other than SAP* and j2ee_admin that has admin rights for which we have to change the password once a consultant leaves the company.
    Your suggestions and recommendations will be highly appreciated.
    Thanks
    Ram

    Hi Ram,
    We have 2 servers (one for ERP and another for XI). Is there a way to know who are all accessing our servers from outside ?
    SMGW --> Goto --> Logged on Clients
    Also, which are user IDs other than SAP* and j2ee_admin that has admin rights for which we have to change the password once a consultant leaves the company.
    SUIM --> User --> By Critical Combinations of Authorizations at Transaction Start
    Hope this will help.
    -Pinkle

  • Is there a way to define https proxy settings

    Other than system property setting, using jsse is there a way to define proxy settings. I am using Https connectivity.
    Thanks in advance.

    I'm not too sure I can follow your question. jsse is an extension used for j2se (included from 1.4.2 and up) and therefor has nothing to do with the Java EE SDK.
    But to answer your question a little: just use the java.net.Proxy class. The moment when you need to use https you can then use URL.openConnection() which can optionally take a proxy class as argument. So, for example:
    Proxy proxy = new Proxy(Proxy.Type.HTTP, new INetSocketAddress("proxy.intranet.lan", 3128));
    URL site = new URL("https://sunsolve.sun.com");
    HttpsURLConnection wcon = (HttpsURLConnection) site.openConnection(proxy);And then you can do with the connection object whatever you want, it'll fully utilize the proxy. For more information on this I suggest to check up on the API documentation.

  • Is there a way to define the ideal size of the java heap memory?

    Hello all!
    Is there a way to define the ideal size the java heap memory? I'm using a server with (IR,FR,WA) installed and i'm using the Windows Server 2008 R2 with 32GB of ram memory. I have other server with the same configuration using essbase. How can i set the heap memory? I have around 250 users (not simultaneous).
    Regards,
    Rafael Melo
    Edited by: Rafael Melo on Aug 17, 2012 5:40 AM

    For 2008 which is 64 bit you can have
    For FR in windows registry
    HKEY_LOCAL_MACHINE\SOFTWARE\Hyperion Solutions\Hyperion Reports\HyS9FRReport
    Xms and Xmx can have 1536 each.
    For workspace
    Start “Start Workspace Agent UI” service and open Configuration Management
    Console (CMC) via http://localhost:55000/cmc/index.jsp
    for
    Workspace Agent / Common Services Java Heap size you can have
    Xms and Xmx as 1024 each.

  • Is there any way to unlock iPhone besides using the slide?

    Is there any way to unlock iPhone besides using the slide? My vision impaired Dad is slowly learning to feel his way to the approximate position of the slide and learn how to flick his thumb to unlock the iphone. Is there any other way to unlock an iPhone from sleep?

    If you activate "Voiceover", your Dad can use the voiceover gestures to control the phone. These are different from normal gestures. For example, Unlock iPhone: Select the Unlock switch, then double-tap the screen.
    To learn about voiceover, see this: http://www.apple.com/iphone/how-to/#accessibility.using-voiceover

  • I just bought my first Iphone the 5S and when I turn on my bluetooth the ringtone for my text, calendar, etc. comes through my Bluetooth instead of the phone. Is there a way to have the tones use the phone while bluetooth is on?

    I just bought my first Iphone the 5S and when I turn on my bluetooth the ringtone for my text, calendar, etc. comes through my Bluetooth instead of the phone. Is there a way to have the tones use the phone while bluetooth is on?

    I would also like this issue addressed.
    I am using a Plantronics Voyager Pro+ and when it is connected to my iPhone 4, email and text sounds are not audible through the phone. The phone just vibrates when a new text or email is received.
    I don't really care if it plays through the headset, but it should at least play through the phone. I tested the headset from a BlackBerry and the alerts play fine.
    Message was edited by: picardsm

  • Is there any way to clone a machine using boot camp running WinXP. The Mac side is running Snow Leopard. I want to clone a newly set up machine on to a number of machines in a student lab. I am wanting to clone both particians

    Is there any way to clone a machine using boot camp running WinXP. The Mac side is running Snow Leopard. I want to clone a newly set up machine on to a number of machines in a student lab. I am wanting to clone both particians

    AFAIK, there's no app that'll clone the Mac and PC volumes so you can restore them. System Image Utility.app or Deploy Studio for Mac and Ghost for PC are needed. See these for starters:
    http://clc.its.psu.edu/Labs/Mac/Resources/blastimageconfig/
    http://blog.macadmincorner.com/
    http://lists.apple.com/archives/System-imaging/

  • Is there a way to see if someone used my computer when I was gone? Or tried to log in (unsuccessfully)

    is there a way to see if someone used my computer when I was gone? Or tried to log in (unsuccessfully)

    Launch your Console app (in Utilities folder) and look at all messages where you'll see everything your machine has done, complete with dates and time. Latest entries are at bottom of list.

  • Just switched from safari on my imac. when using search menu safari gave me the option to "find on this page," which was an incredible help while doing research. Is there any way to have this feature using firefox?

    Just switched from safari on my imac. When using search menu in safari I had the option to "find on this page," which was an incredible help while doing research and looking for specific phrases/words. Is there any way to have this feature using firefox?

    I think Safari has the same keyboard shortcut as Firefox "command+F" on a Mac or "Ctrl+F" on Windows.
    Look in the lower left corner for the Find. There are more likely to be differences in Find Next and Find Previous in the keyboard shortcuts, but continuing at the Find bar at the bottom doesn't matter what browser you use. There is an "X" there to dismiss the Find bar. In Windows the "Esc" key will dismiss the bar if you are within the find text entry area.
    Keyboard shortcuts:
    * [https://support.mozilla.com/en-US/kb/Keyboard%20shortcuts?s=keyboard&r=0&as=s Keyboard shortcuts | How to | Firefox Help], from Mozilla very limited number of shortcuts but will show correctly for your system
    * [http://dmcritchie.mvps.org/firefox/keyboard.htm Firefox and other Browser Keyboard Shortcuts (Comparison Table)], more comprehensive but is oriented to Windows users with some guidelines for Mac and Linux users.
    <br><small>Please mark "Solved" one answer that will best help others with a similar problem -- hope this was it.</small>

  • Is there a way to enable root user using terminal?

    is there a way to enable root user using terminal? i've tried in directory app but its not letting me log in under root since repairing permissions

    Hi
    If all you're seeing is bash-3.2# you are logged in as root. Type exit followed by a return. What do you see now?
    I think most of your questions could be answered with some judicious reading? Download as many admin manuals you can:
    http://www.apple.com/server/macosx/resources/
    Tony

Maybe you are looking for

  • SD- Sales Order - ATP check not working for few item in same sales order

    Hi Experts, Need help we activated ATP check but for few item i could not find confirmation qty after availability check. In same SO out of 4 items for schedule line it confirming qty for 2 item but  it's not confirming for remaining 2 items though s

  • Grid + Popup

    Is it possible to open documents (.doc, .xls, .pdf etc) in a new window (popup) when selected from a flash grid. I can open the document in the same window but that then requires the user to refresh the first page when they go back to the first page.

  • Connect iPod to Sony television

    How can I connect my iPod touch to my television

  • Extract two rows when two codes are stored in the same column

    I have a column like this American Indian or Alaska Options XCK,XON I want to be able to insert to records for this pidm (primary key) this is how it is in the table SZSCAPL_APPLICANT_ID     SZSCAPL_AMER_INDIAN_ALASKA_OPT 5666090                     

  • Change Log Report

    Hi Gurus, Is there any transaction that can give a sort of statistic/failure rate about the changes happened to purchase order raised?  I need the list of changes made between a time frame to that PO. In our organization POs are open for long years a