Percent Calculation Assistance Needed

What would be the best way, performance wise, to set a calculation that returns the percentage of a budget that is spent, even if the budget is set to 0?
Using just spend/budget as a custom item doesn't work, since sometimes the budget is 0.
As info, the spend is a summation of several invoices but the budget is not a summation. Should I be using the calculation of SUM(Spend), instead of using the default aggregate of SUM?
Budget is setup with a default aggregate of detail. Should that be changed?

Actually, you have two separate issues to deal with (ignoring the performance for now... we'll work on that later if necessary ;-):
1) two measures to compare, with different levels of aggregations and
2) divide by zero problem.
Savest way to solve 1) is to create a calculation with something like SUM(spend) OVER (PARTITION BY ... data-items-you-want-to-aggretate-on i.e. month, department ORDER BY same-items).
This makes sure that 'spend' always aggregates to the level you want. Disadvantage is that the calculation needs to be adjusted if you want another level of detail.
Now 2), you have to include an explicit "work around" for this. For example: CASE WHEN budget IS NOT NULL (or <> 0 - depends on contents of column budget) THEN (budget/sum(spend) - calculation you just created)/100 ELSE xxx. You decide how to handle the case where budget is zero, what should be after the ELSE. Should variance (result) be shown as 100% or 0% or ...?
Succes!

Similar Messages

  • My BB9810 refuse to load OS7.1 software on my phone after the download has completed. My phone has freezed/stucked since morning. Pls urgent help/assistant needed as I can not access/use my phone for over 24hrs now.

    My BB9810 refuse to load OS7.1 software on my phone after the download has completed. My phone has freezed/stucked since morning. Pls  urgent help/assistant needed as I can not access/use my phone for over 24hrs now.

    Hi there,
    Use the method described in the link below to get back up and running:
    http://supportforums.blackberry.com/t5/Device-software-for-BlackBerry/How-To-Reload-Your-Operating-S...
    I hope this info helps!
    If you want to thank someone for their comment, do so by clicking the Thumbs Up icon.
    If your issue is resolved, don't forget to click the Solution button on the resolution!

  • Percent calculation

    I have a form where I need to add the dollar amounts for projected small business spend and large business spend. (which is entered by the user) Then, actual cumulative smal and large spend is also entered by the user.
    I need to know how to write the script for calculating the percentage of cumulative spend in relation to projected spend.
    cumulative spend = % of projected spend
    Projected spend = 200.00
    50.00 is what % of 200.00
    Here is the code I tried:
    if(TotalCurrent ne 0) then
    (SmallActual / TotalCurrent) * 100
    else
    null
    endif
    Here is the error:
    Script failed (language is formcalc; context is
    xfa[0].form[0].topmostSubform[0].Page1[0].SmallActual[0])
    script=endif
    Error: syntax error near token 'endif' on line1, column 5.
    Any help is appreciated. I am new to this program.

    Hi, Lony,
    Whenever you have a problem, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say what version of Oracle you're using.
    Are you saying you now ahave a query that produces that output, except for the percent column?
    It looks like the total of all percents is about 18. How did you get that number, and not 100?
    RATIO_TO_REPORT compares a number to the total in the query, giving you a number between 0 and 1. Just multiply it by 100 to get a number between 0 and 100.

  • Trouble with Accumulation and percent calculation

    I'm fairly new to programming so please be gentle guys because I know this may seem like a stupid question. In this simple polling program I have written, I can not seem to get my number of votes to accumulate nor the percent to calculate and display correctly.
    Could some one please tell me what I'm doing wrong and possibly lend me some tips for future programs. 
       static void Main(string[] args)
                string[] candidates = new string[5] { "Hillary Clinton", "Barack Obama", "John McCain", "Ralph Nader", "None of these are my favorite" };
                double totalVote = 0,
                votePercent = 0;
                int choice1 = 0,
                    choice2 = 0,
                    choice3 = 0,
                    choice4 = 0,
                    choice5 = 0, numOfVotes = 0, VoteSelect = 0;
                char altPoll;
                do
                    Console.WriteLine("Opinion Poll with Functions\n\n");
                    Console.WriteLine("***********OPINION POLL***********");
                    for (int i = 0; i < 5; i++)
                        Console.WriteLine(candidates[i]);
                    Console.Write("\nPlease choose your favorite candidate based on its corresponding number=> ");
                    VoteSelect = (Convert.ToInt32(Console.ReadLine()));
                    Console.WriteLine("\nQuestion....\n");
                    Console.Write("Would you like to do this again (y/n): ");
                    altPoll = (Convert.ToChar(Console.ReadLine()));
                while (altPoll == 'y' || altPoll == 'Y');
                if (altPoll == 'n' || altPoll == 'N')
                    if (VoteSelect == 1)
                        numOfVotes += choice1++;
                    if (VoteSelect == 2)
                        numOfVotes += choice2++;
                    if (VoteSelect == 3)
                        numOfVotes += choice3++;
                    if (VoteSelect == 4)
                        numOfVotes += choice4++;
                    if (VoteSelect == 5)
                        numOfVotes += choice5++;
                    totalVote += numOfVotes;
                    votePercent = VoteSelect/ totalVote;
                Console.WriteLine("\nCANDIDATE\t\tVOTES\t\tPERCENTAGE");
                Console.WriteLine("____________________________________________________");
                Console.WriteLine("Hilary Clinton \t\t  {0} \t\t{1:P}",choice1,votePercent);
                Console.WriteLine("Barack Obama   \t\t  {0} \t\t{1:P}",choice2,votePercent);
                Console.WriteLine("John McCain    \t\t  {0} \t\t{1:P}",choice3,votePercent);
                Console.WriteLine("Ralph Nader    \t\t  {0} \t\t{1:P}",choice4,votePercent);
                Console.WriteLine("Not Offered    \t\t  {0} \t\t{1:P}",choice5,votePercent);

    Hi Billy,
    What you're doing wrong is that in the do/while loop, you're not calculating anything. You do the calculations once the user has said they're done, but you're only capturing one choice in your do/while loop, consequently, their last choice is the only one
    used in your calculations.
    You should put some of the calculations in a separate method, and call it from within your do/while loop. Also, use a switch/case:
    static void SumSelections()
    totalVote++;
    switch (VoteSelect)
    case 1:
    choice1++;
    break;
    case 2:
    choice2++;
    break;
    case 3:
    choice3++;
    break;
    case 4:
    choice4++;
    break;
    case 5:
    choice5++;
    break;
    default:
    totalVote--;
    break;
    Then, your do/while becomes this:
    do
    Console.WriteLine("Opinion Poll with Functions\n\n");
    Console.WriteLine("***********OPINION POLL***********");
    for (int i = 0; i < 5; i++)
    Console.WriteLine(candidates[i]);
    Console.Write("\nPlease choose your favorite candidate based on its corresponding number=> ");
    VoteSelect = (Convert.ToInt32(Console.ReadLine()));
    SumSelections(); // I added this
    Console.WriteLine("\nQuestion....\n");
    Console.Write("Would you like to do this again (y/n): ");
    altPoll = (Convert.ToChar(Console.ReadLine()));
    while (altPoll == 'y' || altPoll == 'Y');
    And after the do/while (you won't need to check for 'n' or 'N'), just do this:
    Console.WriteLine("\nCANDIDATE\t\tVOTES\t\tPERCENTAGE");
    Console.WriteLine("____________________________________________________");
    Console.WriteLine("Hilary Clinton \t\t {0} \t\t{1:P}",choice1, (double)(choice1/totalVote));
    Console.WriteLine("Barack Obama \t\t {0} \t\t{1:P}",choice2, (double)(choice2/totalVote));
    Console.WriteLine("John McCain \t\t {0} \t\t{1:P}",choice3, (double)(choice3/totalVote));
    Console.WriteLine("Ralph Nader \t\t {0} \t\t{1:P}",choice4, (double)(choice4/totalVote));
    Console.WriteLine("Not Offered \t\t {0} \t\t{1:P}",choice5, (double)(choice5/totalVote));
    UPDATE: I've got the double cast wrong, Magnus has it correct (cast each to double before dividing).
    ~~Bonnie DeWitt [C# MVP]
    http://geek-goddess-bonnie.blogspot.com

  • Can't get ATV working with Onkyo TX-SR605-URGENT ASSISTANCE NEEDED!!

    I'm hoping someone will be able to give me some advice, as I've now spent way too much time trying to figure out what's going wrong. I've just purchased the Onkyo receiver, which in itself is an extremely daunting piece of equipment after my very straightforward Rotel stereo amp!
    I have only 1 HDMI connection available on my 32" Panasonic LCD TV & have, to date, had my ATV connected to it. With my ATV also connected to my amp (via RCA cable), I've been happily viewing/listening to all my iTunes content this way. I understand from reading elsewhere in this forum that I should be able to maintain my HDMI connection to ATV, connect into the receiver using optical, and by so doing, obtain the same results (if not better, thanks to the optical connection) as was previously the case. So far, I've been unable to do this. The only way I've been able to get any audio happening through the speakers is by reconnecting the RCA cable. The optical cable I purchased by the way is a good quality one so I doubt this is where the problem lies - although I guess it's possible.
    The 1st problem I encountered when endeavouring to set the system up was that I was unable to get any onscreen information, as I couldn't find an AV input that responded to the receiver's 'setup instructions'. I assumed this would come via the TV's HDMI AV option, given the ATV is the means of connecting to the TV & that's connected via HDMI, but no joy. However, I did some of the basic setup w/o the onscreen visuals, and proceeded to see if I could access my iTunes content with the connections I referred to earlier. As I said before ... no go w/o the RCA cable connected and even then, no sound through the speakers if I reverted to just watching the TV.
    I'm driving myself crazy here, and am now at the point where I can see no value in continuing to read & re-read the Onkyo manual. Although I can accept that it's likely to take me some time to learn how to properly drive this beast and get the most out of it, I don't think (from what I've read elsewhere here) that it should be this hard to get what I'm wanting up and running.
    Please HELP and save my sanity!
    [Thanks in advance to anyone who comes to the rescue ]

    jrmccoy, thank you so much! I have never used an optical connection until now, & so was not aware of the necessity to get the 'snap' happening in order to get a good connection. With some trepidation, I applied the required force to the connection to the ATV - sure enough, it 'snapped' in. I tried to get the receiver connection to snap as well, but had no luck there - it seems to be a very 'sloppy' rather than tight connection that slips out with very little effort. However, after pushing really hard on the cable & getting no better connection, I gave up & tried it as was. The result was that , yipee, I now have it all working as I'd anticipated it should. The only thing I still don't have, is the TV sound coming through the speakers - I thought that with the ATV providing the conduit between the TV & the receiver, I wouldn't need any other connection from the receiver to the TV. I suspect now that that was an incorrect assumption! Thought it was all a bit too easy ... sigh.
    Once again Apple Discussions have come to my rescue - I honestly don't know what I'd do without the assistance of all you generous people out there with so much & such wide-ranging knowledge!

  • How to do percent calculations based on a value

    Hello,
    I'm trying to figure out how to send workflow notifications to only 40% of a selected group..
    For example - We have a survey that is sent out once a user completes our Infopath form - right now the survey goes out to 100% of the users..
    In the future, we would like the survey to ONLY be sent to 1 in 4 users that complete the form - so 40% of all the users that complete will be sent the survey upon completion..
    I know I need to use calculated fields but not sure which formula will work and how to incorporate within our current workflow.
    Any suggestions or how-to's would be appreciated since I'm pretty new to workflows.
    Thanks
    -Andrew

    Hi Andrew,
    You cannot determine 40% of total people who completed the survey randomly.
    If you are using SPD workflow, then this looks tough to do as you have to first find out the total number of Completions (assume 100). (SPDW does not have a way to count the number of items in list. If you can create custom workflow in VS then you can
    use SharePoint API with the list ID and get the count:   myList.Items.Count). Then divide that number by 4 (assume 40). If this is decimal then round it up.  Find the names of top 40 or bottom 40 responses. You cannot randomize 40
    items from the list.
    In my opinion, you need to have fixed algorithm to create workflow out of this. Hope other's can pitch in and provide some inputs.
    Regards, Kapil ***Please mark answer as Helpful or Answered after consideration***

  • PDF form field calculation help needed

    I need to make some simple calculations on a pdf form and need some help.
    I have a form field for number of guests.
    A field for a set cost for various tickets (there are 3 levels of ticket prices) (I might not need this field).
    A subtotal of the guests attending and ticket price.
    A grand total of the subtotals.
    I can't figure out how to either put in a fixed cost in a form field or input a calculation so that the number of tickets is muliplied by a fixed number and gives me a subtotal.
    Thanks.

    Ok. I finally got the calculations to work. But..... when I save and open in Reader, they don't work. Go back to Pro, they don't work there now either. They also don't show up under the Set Field Order Calculations. To reset them, i have to erase the calculations, save, redo the calculations. Preview the form and everything works — calculations happen and i get a total.
    Adobe Reader usage rights are enabled.
    Why is this so hard?
    I found this thread http://forums.adobe.com/message/1152890#1152890 about it. Is this bug still going on since 2009?
    Ok. Apparently you have to enable reader rights after the form is done. It seems to work now. What a pain.

  • Urgent Assistance needed on this

    Hi, I am fairly new to Java and this assignment is way over my knowledge, if anyone able to assist me on the whole coding, that would be great. Thanks all.
    I am thinking on using array and the file heading on hardware.dat can be omitted.
    Task-
    Imagine that you are an owner of a hardware store and need to keep an inventory that can tell you what different kind of tools you have how many of each you have on hand and cost of each one.
    Now do the following:
    (1) Write a program (Tool.java) that,
    (1.1) Initializes (and creates) a file ?hardware.dat?
    (1.2) lets you input that data concerning each tool, i.e. the program must ask the user for input and each of the user input is written back in the file.
    The file must have the following format:
    Record# Tool Name Qty Cost per item (A$)
    1 Electric Sander 18 35.99
    2 Hammer 128 10.00
    3 Jigsaw 16 14.25
    4 Lawn mower 10 79.50
    5 Power saw 8 89.99
    6 Screwdriver 236 4.99
    7 Sledgehammer 32 19.75
    8 Wrench 65 6.48
    (1.3) Exception handling that must be taken into account-
    (1.3.1) User must not input incorrect data
    (1.3.2) Cost of the item must be a number
    (2) Write another program (ListToolDetails.java) that,
    (2.1) lets you list all the tools, i.e. it will read the data from ?hardware.dat? in a proper manner (you can choose the display format), File name should not be hard coded.
    (2.2) lets you delete a record for a tool, as an example- you can delete all the details pertaining to the tool ? Wrench. Once you delete the information, records must be updated in the ?dat? file.
    (2.3) List the total price(rounded to two decimal places) of each tool, as an example, the total price of all the Hammers is A$128 * 10 = A$1280.00
    (2.4) Exception handling that must be taken into account-
    (2.3.1) In case user inputs an incorrect file name
    (2.3.2) In case user inputs incorrect Tool name (when the user wants to delete something)
    Bonus Task
    This task deals with the inclusion of Javadoc comments and generation of documentation pages.
    Task-
    Your task is to add meaningful javadoc comments in all the programs and generate HTML documentation pages.

    Hi, I am fairly new to Java and this assignment is
    way over my knowledge, if anyone able to assist me on
    the whole coding, that would be great. Thanks all.
    I am thinking on using array and the file heading on
    hardware.dat can be omitted.
    Task-
    Imagine that you are an owner of a hardware store and
    need to keep an inventory that can tell you what
    different kind of tools you have how many of each you
    have on hand and cost of each one.
    Now do the following:
    (1) Write a program (Tool.java) that,
    (1.1) Initializes (and creates) a file
    ?hardware.dat?
    (1.2) lets you input that data concerning each tool,
    i.e. the program must ask the user for input and each
    of the user input is written back in the file.
    The file must have the following format:
    Record# Tool Name Qty Cost per item (A$)
    1 Electric Sander 18 35.99
    2 Hammer 128 10.00
    3 Jigsaw 16 14.25
    4 Lawn mower 10 79.50
    5 Power saw 8 89.99
    6 Screwdriver 236 4.99
    7 Sledgehammer 32 19.75
    8 Wrench 65 6.48
    (1.3) Exception handling that must be taken into
    account-
    (1.3.1) User must not input incorrect data
    (1.3.2) Cost of the item must be a number
    (2) Write another program (ListToolDetails.java)
    that,
    (2.1) lets you list all the tools, i.e. it will read
    the data from ?hardware.dat? in a proper manner (you
    can choose the display format), File name should not
    be hard coded.
    (2.2) lets you delete a record for a tool, as an
    example- you can delete all the details pertaining to
    the tool ? Wrench. Once you delete the information,
    records must be updated in the ?dat? file.
    (2.3) List the total price(rounded to two decimal
    places) of each tool, as an example, the total price
    of all the Hammers is A$128 * 10 = A$1280.00
    (2.4) Exception handling that must be taken into
    account-
    (2.3.1) In case user inputs an incorrect file name
    (2.3.2) In case user inputs incorrect Tool name (when
    the user wants to delete something)
    Bonus Task
    This task deals with the inclusion of Javadoc
    comments and generation of documentation pages.
    Task-
    Your task is to add meaningful javadoc comments in
    all the programs and generate HTML documentation
    pages.First of all , If its your assignment you are ment to do it your self !!
    if u have a problem understanding stuff ask your tutor or prof.
    they are paid to teach u this stuff....
    second : break the problem in to small task as suggested before, it will help u understand the stuff better
    Last thing : No one here is gona do your home work for u
    so better start doing some research and if u have an implementation or a logic problem then post them here, sure people will help.
    now from what i read i think u need to start looking up on
    1) get data from the user : u need some thing like bufferedreader
    2) validate the input : check with the upper and lower bounds
    3) File handing : research on how to write to a file there are a milion pages there on the web teaching you this stuff

  • Calculation fields need to hide $0 and 0% fields when null

    Adobe Live Cycle Designer 8.0
    I have my Before DIR% calculated by dividing (TotalDebts/TotalIncome*100) and have it show up as a percentage (ie 26% OR  31% instead of .26 or .31). I need it to show up blank if there isnt anything going on. Same for "After DIR" and "% Unsec to Inc". I also have another from with the same exact problem but it calculates a $0. How would make these 0's show up blank when no calculation is currenlty happening?  I am trying to get them to show up as blank so if needed I could print out the form and hand write it and NOT have the 0% show up.

    If you set the Pattern display on the calculated cell to allow zeros and/or null then if both of the numericFields are 0, then the calculated cell is blank; not 0. Just select the calculated cell that has the 0, then in the Object tab select the Field tab, and there should be a "Patterns" button you can click. Select "Display" from the drop down box after hitting "Patterns", and then check the fields "Allow Empty" and/or "Allow Zero". Should not display the 0 once you have those set.

  • Calculations Help Needed

    Here is the situation:
    I am doing a quick "play around" between Pages/Word, Numbers/Excel and Keynote/Powerpoint.
    This is to refresh my memory to windows, since I am going into a short-term (5 - 7 or 8 years) of IT.
    I need help with calculating the average time of sunrise for one week, using two sheets.
    The times given are 5:40am, 5:41am, ........ 5:46am. The cells: B5 - B11 (Sunrise Column for week 1). The name for this sheet is "Weekly".
    The equation is going to be place in cell B5 of sheet named "Monthly" representing the average time of sunrise for that week.
    In excell, I understand "Weekly!B3" refers to cell B3 on worksheet "Weekly".
    How would I do this in numbers? (I will figure out how to do it in Excell.)
    Thanks again guys (and ladies)!

    In fact, the problem is not the one which you described.
    The way to reference a cell or a range of cell is perfectly described in iWork Formula and Functions User Guide in which every user may get it.
    The important thing to know is that in NumbersLand, 5:40am isn't a time value but a date_time one.
    In the tables above, I deliberately choose to insert time values entered at different dates so, the formula inserted in Monthly :: B5
    =AVERAGE(Weekly :: B5:B11)
    return an exact result which doesn't match what we are wanting to get.
    This is why I used the auxiliary column C
    In Weekly :: C5, the formula is :
    =TIMEVALUE(B)
    Apply Fill Down to insert the formula in rows below.
    The formula returns the time value using the unit day.
    In Monthly // C5, the formula is :
    =AVERAGE(Weekly :: C5:C11)
    but I guess that you don't wish to get the result in this format.
    In Monthly // D5, the formula is :
    =DURATION(0,AVERAGE(Weekly :: C5:C11))
    You may edit the format of this duration cell as you want.
    An alternate formula would be :
    =TIME(,AVERAGE(Weekly :: C5:C11)*24*60,)
    But CAUTION, one more time, as you may see, the cell will contain a date component.
    Yvan KOENIG (VALLAURIS, France) vendredi 27 mai 2011 12:20:15
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.7
    Please : Search for questions similar to your own before submitting them to the community
    To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

  • Assistant needs access to boss's calendar on Exchange on her iphone

    I have a dilemma.
    The assistant already has access to her boss's calendar on her Outlook 2007 on Exchange 2010. But not on her iphone. She has her calendar but cannot get to her boss's calendar.  How can I make this work?
    We are using Air-Watch MDM to enroll and manage the iPhones.
    Thanks,

    We are also using AirWatch in my company and have been asked a similar question for some assistants.  Let me first state that while it is possible - there are numerous cautions to doing this!
    If the assistant's phone is properly enrolled and they receive their data from Exchange, you can manually create another Exchange account on their iPhone for their manager and select what deliverables they would like to sync. AirWatch's SEG (Secure Email Gateway) will use the compliance of her/his iPhone to passthrough to Exchange any valid account on that device.  Unlike Outlook/Exchange - there is no view only for the assistant, they will have full control of that mailbox - this gets confusing with things like calendar - because they will get notifications for both meetings and the pop-ups do not indicate which account they are for.  (there is some setting changes you can make to set the assistants calendar as the default, but I have not seen notifications on/off per calendar account - only the calendar as a whole).
    When we tested this, we are not using certificates to sync the passwords (that's another discussion), so everytime the manager changes their AD password (which we sync with their Outlook password), they would have to go and manually change it on the assistants phone.
    In short - it is possible to have multiple accounts on an enrolled device, but the additional ones will need to be manually created (since the EAS payload pulls the Enrolled Information from the AirWatch agent for email setup), they will have full access to that mail account and can get confusing on the calendar side.

  • Learning java - assistance needed

    Good morning everyone!
    I've been beating my head against the table trying to figure out what I'm doing wrong here, and my wife pointed out that I should maybe..I dunno, ask for help?
    Here's the situation:
    I'm designing a cell phone keypad with a text field above and a separate clear button to the right of the 12 button keypad. Buttons 1-0, and * and #.
    Heres the first of two problems:
    My GridLayout is propagating as a FlowLayout I think, either that or it's just ignoring me altogether.
    I need to know what mistake I'm making, but the three manuals I've been going through aren't helping me much.
    Here's the second and final problem:
    My button pressing escapades are having no impact on my textfield. This is definitely a case of can't see the forest for the trees. I know it's an obvious mistake, but I'm getting a bit frustrated so I'm missing it.
    And here's my code below, if there are optimizations possible, my pride will not be hurt if you suggest them.
    Thank you for your time folks, and thanks for all the assistance you've unknowingly given me before.
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    public class KeyPadTwo extends JPanel
         JTextField numbers;
         JButton b1, b2, b3, b4, b5, b6, b7, b8, b9, b0, ba, bb, clear;
         JPanel textPanel, clearPanel, buttonPanel;
         public KeyPadTwo ()
              JPanel contentPane = new JPanel(new BorderLayout());
              JPanel textPanel = new JPanel();
              textPanel.setLayout(new BorderLayout());
              JTextField numbers = new JTextField(20);
              add(numbers);
              contentPane.add(textPanel, BorderLayout.NORTH);
              JPanel buttonPanel = new JPanel(new GridLayout(3,3));
              buttonPanel.setBackground (Color.darkGray);
              JButton b1 = new JButton("1");
              JButton b2 = new JButton("2");
              JButton b3 = new JButton("3");
              JButton b4 = new JButton("4");
              JButton b5 = new JButton("5");
              JButton b6 = new JButton("6");
              JButton b7 = new JButton("7");
              JButton b8 = new JButton("8");
              JButton b9 = new JButton("9");
              JButton b0 = new JButton("0");
              JButton ba = new JButton("*");
              JButton bb = new JButton("#");
              add(b1);
              add(b2);
              add(b3);
              add(b5);
              add(b6);
              add(b7);
              add(b8);
              add(b9);
              add(b0);
              add(ba);
              add(bb);
              ButtonListener digitListener = new ButtonListener();
              b1.addActionListener (digitListener);
              b2.addActionListener (digitListener);
              b3.addActionListener (digitListener);
              b5.addActionListener (digitListener);
              b6.addActionListener (digitListener);
              b7.addActionListener (digitListener);
              b8.addActionListener (digitListener);
              b9.addActionListener (digitListener);
              b0.addActionListener (digitListener);
              ba.addActionListener (digitListener);
              bb.addActionListener (digitListener);
              contentPane.add(buttonPanel, BorderLayout.CENTER);
              JPanel clearPanel = new JPanel(new GridLayout(0,1));          
              JButton clear = new JButton("C");
              add(clear);
              ClearListener clearListener = new ClearListener();
              clear.addActionListener(clearListener);
              contentPane.add(clearPanel, BorderLayout.EAST);
          private class ButtonListener implements ActionListener
              public void actionPerformed(ActionEvent e)
                   Object source = e.getSource();
                   String result;
                   result = "";
                   if(source == b1)
                        result = numbers + "1";
                   else if (source == b2)
                        result = numbers + "2";
                   else if (source == b3)
                        result = numbers + "3";
                   else if (source == b4)
                        result = numbers + "4";
                   else if (source == b5)
                        result = numbers + "5";
                   else if (source == b6)
                        result = numbers + "6";
                   else if (source == b7)
                        result = numbers + "7";
                   else if (source == b8)
                        result = numbers + "8";
                   else if (source == b9)
                        result = numbers + "9";
                   else if (source == b0)
                        result = numbers + "0";
                   else if (source == ba)
                        result = numbers + "#";
                   else if (source == bb)
                        result = numbers + "*";
          private class ClearListener implements ActionListener
              public void actionPerformed(ActionEvent c)
                   numbers.setText(" ");
         public static void main(String[] args) {
            JFrame frame = new JFrame("KeyPad Demo");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          KeyPadTwo kp = new KeyPadTwo();
              frame.getContentPane().setLayout(new BorderLayout());
              frame.getContentPane().add(kp, BorderLayout.CENTER);
          frame.setSize(250, 200);
          frame.setVisible(true);
         

    Onker wrote:
    Am I adding the buttons incorrectly? I've never done nested panels for an assignment before, at least not with multiple layout types.The best way I've found to test complex layouts is to test each component in isolation. For instance if I wanted to test a gridlayout, I'd create a small app that creates nothing but this:
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    public class MainPanel extends JPanel
      private String[] btnStrings =
        "A", "B", "C", "D", "E", "F", "G", "H", "I", "*", "Z", "#"
      private JPanel buttonPanel = new JPanel();
      public MainPanel()
        buttonPanel.setLayout(new GridLayout(0, 3));
        ButtonListener buttonlistener = new ButtonListener();
        for (int i = 0; i < btnStrings.length; i++)
          JButton button = new JButton(btnStrings);
    button.addActionListener(buttonlistener);
    buttonPanel.add(button);
    this.add(buttonPanel); // this is redundant here, but placed here to impress that buttonPanel must be added to the MainPanel to be seen
    private class ButtonListener implements ActionListener
    public void actionPerformed(ActionEvent e)
    String btnString = e.getActionCommand();
    System.out.println("Button pressed: " + btnString);
    private static void createAndShowUI()
    JFrame frame = new JFrame("ButtonPanel");
    frame.getContentPane().add(new MainPanel());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
    public static void main(String[] args)
    java.awt.EventQueue.invokeLater(new Runnable()
    public void run()
    createAndShowUI();
    And then when working, I'd incorporate it into the greater program.
    Edited by: Encephalopathic on Jun 22, 2008 10:57 AM

  • Urgent assistance needed on textfields/labels please!!

    I have been trying for days to add labels and textFields to my applet and can only manage to display one.
    My assignment instructions suggest I use makeTextField method and call the setEditable method from the makeTextField method to avoid repetition of code.
    The following is my code...I must have this done in the next couple of days so if someone could please please give me some assistance it would be really appreciated....also, thoughts on my layout would be great as well...i cant seem to set up my buttons in the correct order.
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.Applet;
    public class Registry4b extends Applet implements ActionListener {
    public void init() {
    backgroundColor = new Color(200,255,255);
    this.setLayout(new FlowLayout(FlowLayout.CENTER,4,1));
    makeButtons();
    row1 = makePanel(new FlowLayout(FlowLayout.LEFT,4,2),backgroundColor);
    row1.add(clearB);
    row1.add(studFindB);
    row1.add(studForB);
    row1.add(courB);
    row2 = makePanel(new FlowLayout(FlowLayout.LEFT,4,2),backgroundColor);
    row2.add(studBackB);
    row2.add(courFindB);
    row2.add(courForB);
    row2.add(studB);
    row3 = makePanel(new FlowLayout(FlowLayout.LEFT,4,2),backgroundColor);
    row3.add(courBackB);
    add(row1);
    add(row2);
    add(row3);
    Panel p = new Panel(new BorderLayout());
    Label studID = new Label("STUDENT ID");
    TextField entry = new TextField(" ");
    p.add(studID,BorderLayout.WEST);
    p.add(entry,BorderLayout.CENTER);
    Label firstTF = new Label("FIRST NAME");
    makePanel(new BorderLayout(2,2),backgroundColor);
    add("West",courBackB);
    add("East",studB);
    makePanel(new BorderLayout(2,2),backgroundColor);
    add("North",p);
    add("South",courForB);
    makePanel(new BorderLayout(2,2),backgroundColor);
    add("North",courFindB);
    add("South",studBackB);
    makePanel(new BorderLayout(2,2),backgroundColor);
    add("West",p);
    add("East",studForB);
    setBackground(backgroundColor);
    clearB.addActionListener(this);
    courBackB.addActionListener(this);
    studB.addActionListener(this);
    courForB.addActionListener(this);
    courFindB.addActionListener(this);
    studBackB.addActionListener(this);
    courB.addActionListener(this);
    studForB.addActionListener(this);
    studFindB.addActionListener(this);
    private Label makeLabel(String label) {
    Label label1 = new Label(label,Label.RIGHT);
    label1.setFont(new Font("Courier",Font.BOLD,10));
    return label1;
    public void start() {
    appletWidth = 8*4+row1.getSize().width;
    appletHeight = 8*(2+courBackB.getSize().height);
    public void paint(Graphics g) {
    setSize(appletWidth,appletHeight);
    validate();
    public void actionPerformed(ActionEvent e) {
    String s = (String)e.getActionCommand();
    private Button makeButton(String label, Color color, Font font) {
    Button b = new Button(label);
    b.setBackground(color);
    b.setFont(font);
    return b;
    private Panel makePanel(LayoutManager lm, Color c) {
    Panel p = new Panel();
    p.setLayout(lm);
    p.setBackground(c);
    return p;
    private void makeButtons() {
    Font f = new Font("Courier", Font.BOLD, 10);
    Color grey = new Color(255,100,100);
    clearB = makeButton("CLEAR",grey,f);
    studB = makeButton(" STUDENTS ",grey,f);
    studForB = makeButton("->",grey,f);
    studFindB = makeButton("FIND",grey,f);
    courFindB = makeButton("FIND",grey,f);
    studBackB = makeButton("<-",grey,f);
    courB = makeButton(" COURSES ",grey,f);
    courBackB = makeButton("<-",grey,f);
    courForB = makeButton("->",grey,f);
    TextField addressTF = new TextField("ADDRESS", 10);
    static final String initialString = " ";
    String Filler = " ";
    Panel row1, row2, row3, p1;
    int appletWidth, appletHeight;
    Button clearB, studForB, studFindB, courFindB,
    studBackB,courB, courBackB, studB, courForB;
    Color backgroundColor;
    thanks in advance for anything someone can do for me

    I haven't tried your code, but since you use a layout manager, you shouldnt need to think about setting the size for the applet.
    And I think when you call the method makePanel the last 4 times, you want to use the returned panel to add your components on. Right now you add everything directly to the panel and never use the panels you create.
    And you also reuse some of your components more than once (like e.g. courBackB). You need to create a new button everytime, otherwise if you try to add the same button twice, the second one will not be displayed.
    Try to add the components one by one and check it is displayed before you add the next one.
    If you want to check what components and their sizes etc, you have on your applet, here is a little trick. Get the focus on your applet and press ctrl+shift+F1. If you run the applet in a browser, you will get something in the java console that displays all your GUI components and a description of them. So
    It might help you.
    Also take a look of the Java Tutorial for the AWT. You can download it from
         http://java.sun.com/docs/books/tutorial/information/download.html
    called tut-OLDui.zip.

  • Assistance needed with new monitor and printing from LR3

    I just purchased a new IPS monitor.  I have calibrated it using the HP Display assistant that came with it.  It is an HP ZR 22w.  I saved my calibration as a preset  - however - this is not appearing as a profile when I try to select it in the print module.  the checkbox for "include display profiles" is ticked.  If I allow the printer to manage - the pictures are much warmer than on the IPS display.  My printer is a canon mg6120 and I am running windows 7.  I would appreciate any assistance that anyone can provide.  Thank you

    I think the "HP Display assistant" is a software tool, is that right? 
    Ideally with Lightroom, you should use a hardware calibration/profiling tool (Spyder, Eye One, Color Munki etc).  In particular, you need a monitor profile that contains colour space information.  I had a look through the HP Display Assistant user manual, and it appears the software does calibration but it probably doesn't put colour space info in the profile.  It'll be better than nothing, but a hardware tool is better. 
    However:
    I saved my calibration as a preset  - however - this is not appearing as a profile when I try to select it in the print module.  the checkbox for "include display profiles" is ticked.  If I allow the printer to manage - the pictures are much warmer than on the IPS display.  My printer is a canon mg6120 and I am running windows 7
    This is not what you want to do!  The profile that the HP Display Assistant creates is for the monitor, and only for the monitor.  It gets the right white point and tone curve for the monitor.  What you need in the profile drop-down in LR print module is a printer profile, not a monitor profile (except on very special circumstances). 
    I'm not familiar with the MG6120, but when I googled "profiles for canon mg6120" I got a lot of hits, so I assume profiles are available.  It's quite likely that some came with the printer driver, and were installed with the printer software.  When you select "profile" in LR print module (you may well have to go to "Other..." to see them all) then there should be profiles for the printer - possible lots of them - one or more for each paper type.  If they're not there, see the Canon documentation (or google it) to find out how to load them.   
    If you can't find any profiles for the printer, then try using sRGB (or probably it's "sRGB IEC...").  Without colour management, your printer will probably expect sRGB images, so this should be roughly right, but a specific profile for the printer is better.  This is one of those very special circumstances when something other than a printer profile (and sRGB isn't a printer profile) may be better than nothing.

  • Possible San Francisco Bay Area Assistance Needed

    Hello,
    I'm in a bit of a jam and it's possible (about 50/50) that I may need a bit of assistance in the Bay Area next Thursday or Friday.
    Apple is likely going to replace the motherboard on my Mac Pro this week.  Unfortunate.  It is covered under Apple Care, but the delay impacts my April 19 deadline for my film.
    I have about 24 gig of video data from a Sandisk UDMA 32 gig card that I would like to offload so that I can shoot my final footage next weekend.  I have a 32 gig thumbdrive we can transfer it to.
    The footage was shot on a Canon 5D and I would like to borrow someone's PrPro software here in the Bay Area, if necessary.
    Alternatively, I could Fed ex the card and pay for return fedex as well.
    Thanks for considering this.
    Matt Dubuque
    100 Trees

    Thanks Hunt.
    Looks like I better go out and purchase a copy of the hilarious book "My First Movie" an interview with 20 famous directors about the fiascoes and adventures that accompanied their first film:
    http://www.amazon.com/My-First-Movie-Celebrated-Directors/dp/0142002208/ref=sr_1_1?s=books &ie=UTF8&qid=1300283440&sr=1-1
    I backed up my media, but didn't have a spare MacPro when its motherboard went down!
    Matt

Maybe you are looking for

  • "Ghostly Partition" after un-installing Boot Camp

    I used Boot Camp Assistant to delete the Boot Camp partition in which I had Window 7. I did it after re-installing Windows 7 in a Virtual Machine in Parallels. Although Boot Camp Assistant erased the partition, it couldn't return the Mac HD to a sing

  • Lacie disk mini won't mount

    I just bought a intel core duo iMac and hooked up my lacie disk mini via USB to access my itunes library and other files only to get a message saying that no disk mini was found. Both Disk Utility and Norton see the external hard drive and scan it wi

  • Running Oracle on Dell 2850 against sunFire 440

    Is there any reliable comparison about running Oracle (9i or 10g) on a sunFire 440 as compared to Dell 2850 or 6650 PowerEdge (2 way Xeon #Ghz) running Linux? I have seen many benchamrks but they are mostly obsolete, not on these models, and not DB r

  • Contradicting messages in PS7 Install logs

    Hi - I'm trying to install PS7 on a sparc (v440) solaris 10 platform with plenty of disk space and fully patched. I'm getting strange contradictory errors. The file /var/sadm/install/logs/Java_Enterprise_System_Summary_Report_install.<date> shows : I

  • Hello World Service Error

    I�m trying to compile the HelloWorld Service example using ant tools, but i have this problem: generate-server: edit-config: [wscompile] modeler error: failed to parse document at "C:\jwsdp-1.3\jaxrpc\samp les\HelloWorld/C:\jwsdp-1.3\jaxrpc\samples\H