How can I CACULATE the current X,Y coordinate?

Hi Veterans,
When I was using method Graphics.drawString(String str, int x, int y) to display the string on the specified (x, y), how can I calculate the current x at the end of the string when i finished, given the font size is available
any help is appreciated!

Well Im sure if you searched the sun sight you could find a getX() method....but this works too
public void paint() {
Graphics2D g2D = (Graphics)g
int x=5;
int y=7;
g2D.drawString("Hello",x,y);
System.out.println(x +" is the x position");
System.out.println(y + " is the y position");
This is direct code for the paint() method of an applet paintComponent() if your in a JFrame

Similar Messages

  • I want to update iCloud account with new apple id but don't know password for old apple id.  Plus can no longer receive email at old apple id.  How can I delete the current iCloud account on my iPhone if the previously stated conditions exist?

    I want to update iCloud account with new apple id but don't know password for old apple id.  Plus can no longer receive email at old apple id.  How can I delete the current iCloud account on my iPhone if the previously stated conditions exist?

    If the old ID is yours, and if it is an earlier version of your current ID, go to https://appleid.apple.com, click Manage my Apple ID and sign in with your current iCloud ID.  Click edit next to the primary email account, change it back to your old email address and save the change.  Then edit the name of the account to change it back to your old email address.  You can now use your current password to turn off Find My iDevice, even though it prompts you for the password for your old account ID. Then save any photo stream photos that you wish to keep to your camera roll.  When finished go to Settings>iCloud, tap Delete Account and choose Delete from My iDevice when prompted (your iCloud data will still be in iCloud).  Next, go back to https://appleid.apple.com and change your primary email address and iCloud ID name back to the way it was.  Now you can go to Settings>iCloud and sign in with your current iCloud ID and password.

  • How can I return the current Date in Java?

    I am new to Java, and basically I want to know how I can return the current date as a variable, so for example, I have declared the following date variable
    private java.util.Date currentDate;How can I return the current date, do I have to write a method? To be more specific, I need to write a setMethod, that simply returns the current Date in Java.
    Please point me in the right direction.
    Thanks,

    If all you want is a date for printing or displaying, the easiest way is to use Date as shown below. If you need something more complex, look at the Calendar API.
    import java.util.Date;
    class DateEx
         public static void main(String args[])
              Date now = new Date();
              System.out.println(now);          
    }

  • How can I get the current user an  resource context  in a portal JSPDynPag

    How can I get the current user (com.sapportals.portal.security.usermanagement.IUser?)an the resource context  in a portal component (JSPDynPage)?
    Thanks.

    Hi Jon,
    Here is the code to get the current user and resource context in your JSPDynPage:
    IPortalComponentRequest  currentRequest  = (IPortalComponentRequest)pageContext.getAttribute(javax.servlet.jsp.PageContext.REQUEST);
    com.sapportals.portal.security.usermanagement.IUser contextUser = (com.sapportals.portal.security.usermanagement.IUser) currentRequest.getUser().getUser();
    ResourceContext resourceContext = new ResourceContext(contextUser);
    Greetings,
    Praveen Gudapati
    p.s. points are always welcome for helpful answers

  • CS3 - Place Word document: How can I select the current preset?

    Hi
    In my Plugin I like to place a word document into a text frame. To do this I want select a defined preset before.
    How can I do that?
    How can I select the current preset for the placement (import)?
    Thanks for the support
    Hans

    Hi,
    I had posted a similar query few days back to place excel file in text frame. And I found out that, it is not possible to specify formatting option for any of microsoft document when using Indesign SDK.
    But we can do this by running script.
    If you are able to specify the formatting option through script, write code to get script object & execute this script through Indesign SDK.
    I was able to specify formatting option, sheet number, range etc through this.
    Hope this helps.
    Rajani

  • How can I make the current row in a different color  in  ADF Table 10.1.3

    Hi all
    in JDeveloper 10.1.3 ADF Table ,
    How can I make the current row in a different color ?
    thanks

    And what exactly would "the component" be?
    I tried the af:outputText, but it just creates a <span> around the value of the cell, and if I try the af:column it just won't use it at all!
    Any suggestions?

  • How can I check  the current cost and budget in SAP?

    Dear experts,
         How can I check  the current cost and budget in SAP for the PR approval?
    Table:COEP, COBK, COSS COSP can not find below information:Tender_budget,Working_budget,reconciliation,Additional,Adjustment,variation
    Best regards,
    Merry

    Dear expert,
         I need below information:Project_id,Cost_code,Nature_code,Section_code,Work_type,Work_code,Cost_type,Suffix,item_desc,Tender_budget,Working_budget,reconciliation,Additional,Adjustment,variation
    Can you tell me which table and filed can find them?
    Many thanks.
    best regards,
    Merry

  • How can I replace the current contacts list and put in my own

    How can I replace the current contacts list and put in my own?  My son's name and contact list appear, inadvertently loaded when he used the iPad.  I have an iPad mini, fully updated to iOS 7.0.4.

    He must have signed into his icloud account using your device.  You need to disconnect the device from that account and then sign in using your account ID.
    Go to Settings>icloud, scroll to bottom of screen and tap Delete Account.  Then log in using a different ID.

  • I want to transfer my fcp to my new macbook.how can i unstall the current one and activate on the another. i just wonder i can't see any serial number on it!!

    i want to transfer my fcp to my new macbook.how can i unstall the current one and activate on the another. i just wonder i can't see any serial number on it!!

    Yes.
    It's always useful to keep a backup copy as well in case things go wrong.
    It's much quicker than having to download again.
    You can keep it on hard drives, memory sticks or cards, DVDs etc.

  • How can I show the current value of a substitution variable in FR?

    Hello,
    I want to paste the current month in a text box using a substitution variable in my report. How can I use the Curmth sub-var in a text box? Which function would I use to paste the substitution variable. Thank you.
    -- Adi
    Edit:
    The Sub-Var is not used anywhere in the report but it is in the database that the report accesses.
    Edited by: Aditya26 on Apr 12, 2012 8:42 AM

    I think you can only reference items on the actual report.
    It might be easier to pull the subvar into the report (on a hidden column/row) and then you can reference the cell.
    Cheers, Iain

  • I bought a used computer and I am currently upgrading to Mavericks.  How can I erase the current password from the seller?

    I just bought a used computer and i am currently updating this computer to Mavericks upgrade for free.  How can I wipe it clean, and also how can I reset the password from the sellers password?

    You really have to start with the MBP as it came out of the box.  Read these directions;
    http://www.thesafemac.com/how-to-prepare-your-mac-for-sale/
    You then will have to create your own password and account.
    Ciao.

  • How can i get the current number of word in paragraph?

    I have cursor set on some word in Para. And i'd like to make italic all words before it. How can i get the number of current word in collection Words in mInd.Selection.Item(1)?

    Hi Dmitry1776,
    Try something like this:
    Set myInsertionPoint = myInDesign.Selection.Item(1)
    Set myStory = myInsertionPoint.ParentStory
    Set myStartCharacter = myStory.Characters.Item(myInsertionPoint.Paragraphs.Item(1).Index)
    Set myCharacter = myStory.Characters.Item(myInsertionPoint.Index)
    Set myEndCharacter = myStory.Characters.Item(myCharacter.Words.Item(1).Index - 1)
    Set myText = myInsertionPoint.ParentStory.Texts.ItemByRange(myStartCharacter, myEndCharacter).Item(1)
    ...at this point, myText is a range of text from the start of the paragraph to just before the text containing the insertion point.
    Thanks,
    Ole

  • How can I find the currently logined domain name on Windows??

    Dear,
    I've a program that query some user account information from A.D.
    But I don't want to hard code anything.
    I've read some previous post about using LDAP, and using DNS queries to found all LDAP server of A.D.
    But how can I get the A.D. domain name in Java?
    for example
    ldcp://_ldap._tcp.xxxx.yyyy
    I want to get "xxxx.yyyy" from the logined user account. It is possible in Java.

    You coud use the NTSystem class to derive the NetBIOS domain name, however without doing some gymnastics it isn't easy to derive the fully qualified domain name. import java.io.*;
    import com.sun.security.auth.module.NTSystem;
    class NTDomain {
         public static void main(String[] args) {
              NTSystem system = new NTSystem();
              String domain = system.getDomain();
              System.out.println("Domain: " + domain);
    }The only other alternatives could be to check the domain suffix of the user principal that was authenticated via Kerberos ....
    lc = new LoginContext(searchkrb5.class.getName(),new SampleCallbackHandler());
         lc.login();
         catch (LoginException le) {
              System.out.println("Logon failed: " + le);
              System.exit(-1);
         System.out.println("Authenticated via GSS-API");
            System.out.println("User: " + lc.getSubject().getPrincipals().toString); however I think that you still have to specifify the Kerberos realm in the apps configuration file.
    Another alternative could be to make assumptions about the machines hostname, however one day an assumption will always be proven wrong, (eg. The machine's DNS domain name does not need to match the Active Directory domain).
    Unless there is a Java API to read the Windows registry or extract Kerberos ticket information from the WIndows Kerberos ticket cache, you may be kind of stuck.

  • How can I get the X and Y coordinates of an object in Xcode, ApplescriptObjc?

    How can I get the value of a specified object's X and Y coordinates in Xcode, using ApplescriptObjc? I'm hoping for something like:
    myObject's currentPosition()
    // Which would return {150, 100} for the X and Y of that object.

    Actually this is straight from basic physics
    Assuming that the x and y values you get using that AppleScript/Objective-C code is accurate, to move the object you would do
    set x to x + dx * speed
    set y to y + dx * speed
    with dx and dy being an integer with a value of -1 or 1 which indicates the direction the object is moving. Remember the origin in OS X is the middle of the frame or screen with positive x and y values moving to the upper right quadrant, and negative x and y values moving to the lower left. Your basic Cartesian coordinate system. Speed is also an interger and models the speed of the object.
    Once you've set x and y to their new values you would write  them back to the object.
    This is so I can find how much distance (in pixels) is being travelled when I animate an object to move from one position to another, to apply it to my desired velocity (of pixels per second), to find out how long the object should take to move.
    This part has got me stumped.
    To make an object move you need to change its x and y coordinates. To get smooth animation you need to change them on a regular schedule at a rate fast enough to avoid jerky motion. Given the refresh rate of most monitors and other factors a rate of 60 times per second gives good results. Between each tick of the clock you change the x and y coordinates by some amount, the size of the amount will model speed. Add a small change and the object moves slowly, add a big amount and the object moves quickly. Keep the amount of change constant and the object will move at a constant speed. Increase (or decrease) the amount of change between each tick and the object will accelerate (or decelerate)

  • How can I get the current time in Xcelsius?

    I'm reading in an XML feed containing dates/times, and I'd like to do a calculation to see how old it is -- but I can't seem to access the current time in Xcelsius (=now() doesn't work -- it only calculates once, when the model is loaded).
    I can get around that (a bit awkwardly) with a timer, but I'd also like to know what the user's current time zone is... Any ideas?

    Hi,
    Maybe you could use a web service to return the required information - you can feed the timezone to the web service.
    Have a look at this:
    http://www.earthtools.org/webservices.htm#timezone
    http://markitup.com/WebServices/TimeZones.asmx?op=CurrentDateTime
    Best regards,
    Jacob

Maybe you are looking for

  • 4200v2 looses wireless connection after 24hrs

    Hello All I upgraded my Linksys from 160n router to 4200V2 router.  I configured 3 wireless Linksys webcams and they work fine. After 24hrs they i cannnot connect the via HTTP and webcames IP addresses disapear from the DHCP client table.  If reboot

  • HT201272 hi. im have a HUGE trouble with a album i preordered.

    .this is very frustrating. it says on the album when i go into the itunes store that i purchased it. but it is nowhere to be found on my itunes. please help

  • I own more than 5 computers

    In each room in my household I have a computer hooked up to the screen to watch video and play music. With 3 computers hooked into my tv's 2 laptops and one desktop thats 6 computers and the itunes store only allows 5. Currently I have to deauthorize

  • 30¢ per track for the privilege to upgrade them, seriously

    I am getting this right. No matter what the price (what you paid vs. what it is now) I have to pay 30¢ PER TRACK to get DRM-free and 256k? When I purchased an album it was $9.99 at 128k and DRM'd. Now the same album is $9.99 at 256 and is DRM-free bu

  • Vectorial map viewer

    Hello, I'm looking for a MIDP library to view vectorial map (viewer). I found out the open source tiny SVG library for SVG format. Does anybody knows if there are other tools handling other map formats than the SVG one? (e.g. Flash) Thank you and Reg