GetWidth() not a positive number?

I'm adding a circle to a jpanel and am trying to determine the panel's size to make sure the circle is within the panel:
<code>
int width,height;
width = getWidth();
height = getHeight();
Random startPoint;
startPoint = new Random();
coordX=startPoint.nextInt(width); <<
coordY=startPoint.nextInt(height); <<
g.fillOval(coordX,coordY,sizeX,sizeY);
</code>
This passes compile bu generates an IllegalArgumentException: n must be positive on at the marked lines. What am I doing wrong?
Thanks
MVP

I caught the exception and printed out the width height values - they're 0.
Q: a panel set into the center of a borderlayout has a size, right?
getContentPane().add(pnlPlaypen,BorderLayout.CENTER);
In the PlayPanel class:
<code>
     public PlayPanel()
          setBackground(Color.BLACK);
          clrCurrent=Color.blue;
          startPoint = new Random();
          sizeX=20;
          sizeY=20;
          width = getWidth();
          height = getHeight();
</code>
Doesn't the panel get generated with the size to fill center?
Confused,
MVP

Similar Messages

  • How can I should the position number in sequence via ppom_old or ppome

    Our user creates the position number via ppom_old and get the position number from this screen.  The position number has been shown on sequence.   However, something seems collapse.  Do you guys know how I can show insequence again?

    It is based on Priority (Edit-> Priorirty)
    Use                                                                               
    Sequence Priority of Objects
         The Priority  field is optional. It is used to determine the sequence in  
         which objects are presented in Simple Maintenance and Structural          
         Graphics.                                                                               
    When multiple objects are located on the same hierarchical level of a     
         structure, these must be ordered in a specific sequence from left to      
         right (or from top to bottom).                                                                               
    This is done by assigning alphanumeric priority values, where the value   
         1 is the highest (far left or top) and 99 the lowest priority (far right  
         or bottom).                                                                               
    If you specify no priority, the system places objects according to their  
         object IDs.                                                                               
    Priority When Defining Evaluation Paths                                                                               
    It is only necessary to prioritize evaluation paths as an exception.    
         Generally, you should use '*', so that all relationships are read.                                                                               
    Use the Priority  field to define evaluation paths if you want only     
         objects which are assigned a certain priority (see above) to be         
         considered in an evaluation path.                                                                               
    Note                                                                               
    You can find more information on the meaning of the priority field with 
         reference to evaluation paths in the online IMG documentation for       
         'Maintain evaluation paths'.                                                                               
    Priority for Responsibilities                                                                               
    If you are using responsibilities for role resolution in Workflow, you  
         Example: There are various responsibilities for a standard role for       
         processing orders, grouped, for example according to order value (one     
         responsibility for orders up to a certain value, another for orders with  
         a greater order value).                                                                               
    Assuming that orders for a particular customer are always to be           
         processed with the same responsibility (and therefore by the same         
         agent), you can access it via another responsibility with a higher        
         priority that contains the customer name as the only criterion. The       
         responsibility (-ies) with lower priority, and therefore the order        
         value, is then no longer taken into account during agent determination.                                                                               
    Use only numeric values here, and note that, logically, the               
         responsibility with the highest numberic value in this field has the      
         highest priority.                                                                               
    Procedure                                                                               
    1.  Sequence Priority of Objects                                          
             In Create mode, assign a priority to the objects you wish to rank.    
             To do so, assign an alphanumeric value (1, 2, 3... or A, B, C...) to  
             each object.                                                          
    2.  Priority When Defining Evaluation Paths                             
        In the Priority field, enter the priority or priorities for objects 
        that should be considered in evaluation paths. Enter "*" if you want
        to have no restriction.                                                                               
    3.  Priority for Responsibilities                                       
        Maintain the priority directly in the detail screen for the         
        responsibility or in the overview screen for the responsibilities   
        for the rule. Note that you must use numeric values here. On the    
        overview screen, the system sorts the responsibilities in descending
        order of priority.

  • With the Position Number can we find other positions in the Org Unit

    Hi,
    With a particular position number can we find other postion in the same Org. Unit.
    The other postion is not a reporting postion of others.
    I repeat if I give a postion number which is not a reprting manager position but still I would Like to find the other position in the Org. Unit.
    Or which Evaluation path is used for it.
    Thanx in Advance.
    Regards,
    IFF

    Hi,
    In the present scenario I just know only the postion of the employee,
    I just want to know the  evaluation path wrt position by which I can find all the positions associated with the same org unit  wrt to the known position.
    I just want to pass Otype  as S positon  in the FM RH_STRUCT_GET , and get the all positions associated with Org. unit wrt to known position.Please let me know the evaluation path.
    Regards,
    IFF

  • Same position number in BBP_PD

    Hi All,
    We are in SRM 7.0, during SC creation process, if an existing line item is copy pasted and clicked on Order.
    It gives error message ' Position number available 2 times'
    In BBP_PD the same position number is there.
    How to overcome this error message.
    Rgds,
    Madhan

    Hi Madham,
    The following notes should resolve this issue for you :
    1396862: Duplicate Line number generated during Copy of SC.
    1396694: Duplicate Line number generated during Copy of SC Items.
    1394664: Paste after copy/cut inserts items at lead selection
    I hope this helps,
    Kind Regards,
    Lisa

  • Role level mitigating controls not affecting position level reports

    Hi,
    Here's the problem we're having with mitigating controls:
    When I assign a mitigating control to a role, it correctly mitigates the risk when we perform a role level SoD analysis.  However, when we perform a position level analysis, the same role shows up again in the report as not mitigated.  Anyone else running into this issue?  We are on CC5.2 with SP4.  Is this fixed in later SPs?
    Simple Example:
    Role ABC has conflicting tcodes FBV0 and FBVB.  We applied a mitigating control to this role and it doesn't show up anymore on the role level reports.
    When running the position level SoD analysis, position number 50010000 contains role ABC and the same conflict shows up again even though the conflict is entirely within Role ABC and not with other roles that are in position 50010000.
    Thanks,
    Robert

    All,
    I opened a customer message with SAP and it seems that this issue is a limitation with CC 5.2  Mitigating at the role level will will not follow through to the position level reports.  However, it seems that it will follow through to the user level as long as you have configured it under the Configuration->Additional Options tab.  There is a setting there that will allow rule level mitigating controls to take affect at the user level.
    Thanks,
    Robert

  • How to send really Chinese word, not the string "&# number " to web browser

    Each Chinese word on page sending to web browser is translated to a string in form "&#<number>" by default, it's a problem when Chinese word is included in url. How to specify sending really Chinese word, not the string "&#<number>" to web browser?

    Thanks that seems to make much more sense, still having some troubles though.
    Ok so now the majority of it seems to be working and it seems to be sending the String just fine. And I'm having it send the String to the BufferedWriter "out" and then using the newLine() method to send a carriage return but the BufferedReader on "in" seems to not detect the carriage return.
    I have it doing a readLine() so that (as I understand it) it should be blocking, waiting until an end of line character so I assume each call of newLine() should have it pick up something but a quick breakpoint shows that it never stops blocking on readLine().
    I assume the connection is fine because the application running as server uses the socket object returned by the accept() method.
    Is there something I've perhaps misunderstood about the BufferedReader's readLine() method?
    Here's the new version of my netbeans project:
    http://rapidshare.com/files/371224512/KerazehDood.rar
    Also on a different line of questioning, I'm just wondering about socket convention.
    I was thinking it'd be useful in a game similar to what I'm attempting to make to not only send player position information but also client keypress information, I was just wondering, if you're doing something like that would it be frowned upon to use two separate ports? I think it would make the implementation far more legible and easy to structure but wasn't sure if applications usually try to stick to only one port or not.
    Thanks.
    Edited by: ThePermster on Apr 2, 2010 10:54 AM

  • Dividing a positive number (499926843) by 8 gives me a negative number?????

    Hi,
    I am dividing the positive number 499926843 by 8, and this is giving me the negative number -36944069. It doesn't seem like a precision issue, since 499926843 is less than 2^32. What is going on here?
    Thanks,
    C.

    I am dividing the positive number 499926843 by 8No, you're not.
    You.re dividing (endX-startX+1)*(endY-startY+1)*bands*cellDepth by 8,
    and the intermediate product of the multiplication is 3,999,414,744 which is too large for an int.
    Either change the calculation to (endX-startX+1)*(endY-startY+1)*bands*(cellDepth/8)
    or change to longs.

  • Restart number is not in the check file or is not a From-number

    HI!
    I had  posted  payment Document  but i  got below error while  reprint  check from  FBZ5
    Restart number is not in the check file or is not a From-number
    "Message no. FS562"
    on that base, I had  check below  settinng 
    1) I  had check  Cheque no  register . It's  proper in series.
    2)Tcd:FBZP -> Pmt methods in country -> select your country
       and payment method 'C'. If 'Bank details' is checked on, then bank
       details of vendor master is mandatory for that payment.
    Awaiting for reply soon,
    thanking you,
    Rupang shah

    Hi,
    Commonly it will come for below situations:
    1. Client decided to use this check lots for manual payment & this checks already used, so this type of checks system not allowed to take reprint.
    2. You can only reprint checks created with F110, FBZ4, F-58 or FBZ5  (this checks have been printed by the system)
    Check the Payment method wise checks it is already issued / not PAYR - RZAWE
    system not allowed to reprint already exist in PAYR table checks.
    if you already use one check with payment method C now you want to use the same lot for payment method X then system not allow to print.
    Regards,
    Viswa

  • Interval 01 was not created for number range object HRTEM_REFN

    Dear expert!
    Now, I'm getting some issues in Training and event management module.
    - The first, I created business event
    - Second, I process to book for business event by tcode: PSV1 --> book --> book/payment info --> activity allocation.
    But when I was booking, the system displayed error: "Interval 01 was not created for number range object HRTEM_REFN"
    Help me, please!
    Best regards, Huy!

    Go to the customization as below
    Training and event mgt>Basic settings>Number range maintanence>Define number ranges for External operation
    and maintain number ranges as 01 Internal
    Hope ur problem will solve
    with regards
    partha

  • Why is my iPhone sending iMessages through my apple ID and not my phone number?

    So this question is actually about my friends iPhone 4... She and I text on a daily basis and we use iMessages. As of two days ago, every time I sent her an iMessage, it would fail and I would have to send it as a text message. Well we finally figured out it was because her iMessages were turned off (probably by her 2 year old daughter.) So she turned them back on and she sent me an imessage. But when she sent the imessage and I received it, I received the message from her apple id, not her phone number which is what I normally receive her messages from. Her and I can't figure out how to change it back to her phone number.. Any ideas?
    Thanks for the help.
    (She

    Have your friend go to Settings>Messages>Send and Receive and make sure that her phone number is checked. She can also remove the checkmark by her Apple ID email if desired.

  • I have a new iPad with wifi. When I send messages I can see my sons and my husbands but not my phone number.  We all have an iPad and all use the same apple ID as iPad the bill.  How can I remove their numbers and add mine?

    I have a new iPad with wifi. When I send messages I can see my sons and my husbands but not my phone number.  We all have an iPad and all use the same apple ID as iPad the bill.  How can I remove their numbers and add mine?

    Add another e-mail account to your messages, so people could reach you on that e-mail from messages. As soon as you are online (if you have wifi only iPad) you are able to send and receive messages. i.e. your son can send you a messages from his iPhone addressing it to your (that additional) e-mail address.

  • Itunes will not play a number of songs in my library as they were purchased a long while ago using an email address and ISP that I no longer use. Any ideas?

    Itunes will not play a number of songs in my library as they were purchased a long while ago using an email address and ISP that I no longer use. When I try and play them I get the message "this computer is not authorised to play this song, authorise your computer now".  Any ideas?

    Hello, quckvic. 
    Thank you for visiting Apple Support Communities. 
    You will need to reset your Apple ID password via the steps in the first article below.  Take a look at the option that refers to answering the security questions.  Since you do not have access to the email account and if you are unable to answer the security questions, see the second article. 
    If you forgot your Apple ID password
    http://support.apple.com/en-us/HT201487
    Contact Apple for help with Apple ID account security
    http://support.apple.com/kb/HT5699
    Cheers,
    Jason H.

  • When I press on a land line number, the phone does not call the number, but comes up with a screen to send a text to it.  How do I get my phone to default to phoneing a landline?

    When I press on a land line number, the phone does not call the number, but comes up with a screen to send a text to it.  How do I get my phone to default to phoneing a landline?  When I press a mobile number in contacts, the phone automatically phones the number.  I do not mind this as I hardly ever send texts, but I would like to have the option of what to do.  This seems such an obvious issue but I can not solve it even with much web searching.  Thanks!

    I can't delete my question, so I'll just say that you press on the type of number written in the box to the left of the box you typye the number into.  Dumb or what? 

  • When I send a text to another phone, it shows up on the other phone as coming from email address and not from phone number.

    I just came over from Sprint 4 days ago and had my number ported over. When I send a text to another number, it shows up on the other phone as coming from email address and not my phone number. For example, if the recipient of the text has me in the contacts as "Tom", the text comes to them displaying my email address instead of "Tom".

        cfm007,
    Welcome to our family. We want you to be able to enjoy all the services we provide and we definitely need to address this. Do you receive/make calls without problems? Are you able to receive messages with your contacts' number? Are you using iMessages? If so, go to Settings>Messages>Send&Receive>only your phone number should be enabled.
    AdaS_VZW
    Follow us on Twitter at @VZWSupport 

  • HT4528 How can I see if a picture was sent from my phone? I am not sure the number it was sent to, it may have been an i-phone. I just want to know if someone sent themselves a pic from my phone....

    How can I see if a picture was sent from my iPhone? I am not sure the number the picture(s) was sent to..and whether or not it was an iPhone...I just want to know if someone sent themselves pics from my phone. Aside from a court order to obtain data message info, any ideas? Any info is greatly appreciated.

    by email?
    by mms?

Maybe you are looking for

  • Error in send message to A large number of audience

    I want to send a message to A large number of audience but I get an error This error << Messaging is sending a large number of SMS messages. Do you want to allow this app to continue sending messages? >> Deny ....... Allow Please Help me

  • Overset text will not go into the text box that is part of the master for the next page

    I am trying to (first time user) set up a simple trade-paperback sized book with some photos.  Have set up several masters for chapter title pages, chapter inner pages, etc.  When I copy text out of Word into InDesign, (copy/paste) the text overset b

  • Dell LCD TV/Display shows only in 60Hz, can i get a higher Rate?

    i noticed when i plguued in my dell tv/display, the max rez and refresh rate is 1360x768 60Hz. is there any way i can increase the refresh rate and resolution?

  • What is a normal % level for the kernel_task?

    Hi I am still having extreme kernal_task problems with Mavericks 9.2. I wanted to ask people without the problem what there kernal_task was in the Activity Monitor app to compare. With nothing running on the computer it varies between 1% and 10%. I t

  • N8 Software Update

    About a week ago I updated my software for my Nokia N8. I loved the new UI. However, my girlfriend can't receive my text messages anymore. When I text her, it comes through as block symbols on her phone. She went to Verizon and switched out her phone