Cost Estimating Applet HELP PLEASE!!!!!!!!!

i need to develop an applet that calculates the choices that the user makes and the numeric input in the textfield...i have done a basic applet with a panel and 3 comboboxes that i need and the textfield. my problem is how to take the value that the user inputs from the textfield in order to calculate it with the other choices. in the begginng when i had the only the combo boxes was working fine..when i added the textfield something in the code smells..i provide anyone who wants to help with the code..thanx everyone for their time...
* Course Work Assignment - Applet Programming *
* Programmed by Christos Lappas *
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import javax.swing.JApplet;
import javax.swing.JComboBox;
import javax.swing.JFormattedTextField;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.border.TitledBorder;
* This is the main class that implements the "Pricer" applet.
public class Pricer extends JApplet {
// The standar colours available
private String[] colours = {"None","Red","White","Black"};
// Bonus colour available only for Cars and Boats
private String bonusColour = "Any other color";
// The standar items available
private String[] items = {"None","<50 tiles","100>50 tiles","100=<"};
// The base prices of these items
private double[] prices = {0,1.1,1.0,0.8};
// The sizes available
private String[] sizes = {"None","small","normal","large"};
// Initialize the combo-boxes
private JComboBox item = new JComboBox(items);
private JComboBox size = new JComboBox(sizes);
private JComboBox colour = new JComboBox(colours);
private int cols = 5;
private int tiles;
private JTextField notiles = new JTextField(cols);
// Initialize the price
private JLabel price = new JLabel("Please select a combination");
// Initialize the current values
private int curTeam = 0;
private int curItem = 0;
private int curColour = 0;
private int curSize = 0;
* The constructor method. Leaves everything to the init method.
public Pricer()
// do nothing
* Initialize the components and add them to the applet.
public void init()
// Set applet size and layout
this.setSize(new Dimension(400,250));
this.getContentPane().setLayout(new BorderLayout());
// Initialize the title
JLabel title = new JLabel("Tiles-U-Like Inc.");
title.setHorizontalAlignment(SwingConstants.CENTER);
title.setFont(new java.awt.Font("Comic Sans MS", 2, 16));
title.setMaximumSize(new Dimension(400,50));
title.setMinimumSize(new Dimension(400,50));
title.setPreferredSize(new Dimension(400,50));
// Initialize the price
price.setHorizontalAlignment(SwingConstants.CENTER);
price.setFont(new java.awt.Font("Comic Sans MS", 2, 14));
price.setMaximumSize(new Dimension(400,50));
price.setMinimumSize(new Dimension(400,50));
price.setPreferredSize(new Dimension(400,50));
// Initialize the optionPanel that will hold the combo-boxes
JPanel optionPanel = new JPanel();
TitledBorder border = new TitledBorder("Choose a combination to display it's value");
border.setTitleJustification(TitledBorder.CENTER);
optionPanel.setBorder(border);
optionPanel.setMaximumSize(new Dimension(594, 450));
optionPanel.setMinimumSize(new Dimension(394, 350));
optionPanel.setPreferredSize(new Dimension(400, 400));
// Create the Anonymous Class that will handle the item's actions
item.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e1) {
int itemIndex = item.getSelectedIndex();
if (itemIndex!=curItem) // If the selection was changed
curItem = itemIndex;
int team = ((itemIndex==1) || (itemIndex==5))?1:0;
if ((team != curTeam) && (itemIndex>0)) // If team changed
curTeam = team;
setColours(team); // Fix the colours
// Finally, calculate and display the price
// for the new combination
displayPrice();
// Create the Anonymous Class that will handle the size's actions
size.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e2) {
int sizeIndex = size.getSelectedIndex();
// If the selection was changed, calculate and display
// the price for the new combination
if (sizeIndex!=curSize)
curSize = sizeIndex;
displayPrice();
// Create the Anonymous Class that will handle the colour's actions
colour.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e2) {
int colourIndex = colour.getSelectedIndex();
// If the selection was changed, calculate and display
// the price for the new combination
if (colourIndex!=curColour)
curColour = colourIndex;
displayPrice();
//Class to handle tiles actions
notiles.addActionListener(new java.awt.event.ActionListener(){
               public void actionPerformed(ActionEvent e3) {
// Add the combo-boxes to the optionPanel
optionPanel.add(item);
optionPanel.add(size);
optionPanel.add(colour);
optionPanel.add(notiles);
// Add the components to the applet
this.getContentPane().add(title, "North");
this.getContentPane().add(optionPanel, "Center");
this.getContentPane().add(price, "South");
// This method determines the available colours
// depending on the curent team
private void setColours(int team)
if (team==1) colour.addItem(bonusColour);
else colour.removeItem(bonusColour);
// This method calculates and displays the price
private void displayPrice()
// If an invalid combination was selected,
// display the appropriate message
if ((curItem==0) || (curSize==0) || (curColour==0)|| (tiles==0))
price.setFont(new java.awt.Font("Comic Sans MS", 2, 14));
price.setText("Please select a valid combination");
else // valid combination
// Determine the base price, as well as the
// colour and size bias
double base = prices[curItem];
double colAdd=0, sizeAdd=0;
switch (curColour)
case 1: colAdd=1.25; break; // Red or Green
case 2: colAdd=1.0; break; // White
case 3: colAdd=1.50; break; // Black
case 4: colAdd=3.50; break; // Any other
switch (curSize)
case 1: sizeAdd=-6.75; break; // Small
case 2: sizeAdd=4.25; break; // Normal
case 3: sizeAdd=3.50; break; // Large
// Determine the total price
double totalPrice = Math.round(base + (base*colAdd) + (base*sizeAdd)+ (base*tiles));
// Set the font and print the result (rounded)
price.setFont(new java.awt.Font("Comic Sans MS", 1, 18));
price.setText(Math.round(totalPrice)+" pounds");
}

ok then..i want the applet to take the options from
the comboboxes and the number from the
textfield..multiplying them all together and display
the total price..originally the problem was stated
as: An applet is required that allows a potential
customer to obtain an estimate of the cost associated
with tiling a supplied square area of floor with
tiles of a specified size and colour.
...that is all for now..i can provide even more
detailed description..thanx..I don't need a more detailed of your homework, I need a more detailed description of your problem.

Similar Messages

  • Problem with JFile Chooser in applet. help please!!!

    i am making a button for an applet that starts a JFileChooser. it works ok when i start it with the applet viewer in eclipse, but when i put my applet in HTML code and start it in a web browser the JFileChooser Doesn't start. i can click the button but it is like it does nothing. i have read on the forums that it is becouse the browser security doesnt let it execute. so how can i make it work?
    here is the code for the button:
    private JButton getSlikaodberijButton() {
              if (slikaodberijButton == null) {
                   slikaodberijButton = new JButton();
                   slikaodberijButton.setBounds(new Rectangle(0, 0, 136, 28));
                   slikaodberijButton.setText("&#1048;&#1079;&#1073;&#1077;&#1088;&#1080;");
                   slikaodberijButton.addActionListener(new java.awt.event.ActionListener() {
                        public void actionPerformed(java.awt.event.ActionEvent e) {
                             JFileChooser dlg = new JFileChooser("&#1048;&#1079;&#1073;&#1077;&#1088;&#1080; &#1057;&#1083;&#1080;&#1082;&#1072;");
                             if (dlg.showDialog(getContentPane(), "&#1048;&#1079;&#1073;&#1077;&#1088;&#1080; &#1057;&#1083;&#1080;&#1082;&#1072;") ==
                             JFileChooser.APPROVE_OPTION){
                             strSlika = dlg.getSelectedFile().toString();
                             ImageIcon ico = new
                             ImageIcon(dlg.getSelectedFile().toString());
                             Image img = ico.getImage();
                             img = img.getScaledInstance(136, 124,Image.SCALE_SMOOTH);
                             ico = new ImageIcon(img);
                             slika=new ImageIcon(img);
                             previewjLabel.setIcon(ico);
              return slikaodberijButton;
         }

    i am making this applet for a school project. the code i have sent is the only thing that is making a problem in the applet. signing an applet seems like a very long process and i read from pkwooster's link that it involves buying a certificate or forging one, placing it on the client computer, and using a dozen of tools. is there a simple way to avoid this signing or a different method to choose a file from a local computer.

  • My I phone 4 fall from my hand and screen broke. Can I replace my I phone 4 from Apple Store ? How much it will cost in Dubai ? Please help with information.

    My I phone 4 fall from my hand and screen broke. Can I replace my I phone 4 from Apple Store ? How much it will cost in Dubai ? Please help me with the information.

    I'm assuming you can..now I don't know the prices for your area, you'll have to check around, I just did a quick web search and I'm pulling all sorts of prices up, I'd look into a repair facility near you and see what they can do for you :-) shouldn't be too expensive though! Good luck!

  • HT5019 Why can I not find a miniport to external monitor cable that works? I have bought for different types, two from Apple, cost me $300+ and still have no external monitor. Help, please.

    Why can I not find a miniport to external monitor cable that works? I have bought for different types, two from Apple, cost me $300+ and still have no external monitor. Help, please.

    What have you bought?
    What model Mac are you running?
    What input sources are available on the display you are connecting it to?

  • Shipment Cost Estimation Report

    Hi Experts,
    There is an existing report which is very helpful regarding most transportation details. You can pull information at the delivery or item level of all types of shipments in one place. We use this to review what shipments we need to process to cost documents and transport POs.
    Another report shows all of the information except information on what the actual cost calculations have been. A report is available which details the cost calculations but this report is not available until after the cost document has been created which is too late to assist in the shipment costing process. This T code is VI12  and it shows each cost type separated out based on the calculated rate.
    Using  T code VT02N from the shipment cost estimation button, this is the information we need to merge it in the existing report.
    Please can anyone advise on this situation how to do this enhancement.
    Do we need any other information from the client for this issue.
    Thanks for your help.
    With Regards,
    Ruby.

    Hello,
    Would VI11 answer your question, there are also additional fields in the ALV catalogue that can be added to the layout?
    Regards
    Waza

  • Difference in the Material variant  BOM Qty during Standard Cost estimation

    Hi SAP Experts,
    We are trying to estimate the cost for the material variant, but the BOM exploded
    during the cost estimation, the quantity differs slightly with the BOM exploded
    during CU50.
    What might be the reasons for difference.
    Please give your valuable Inputs.
    Thanks
    Best Regards
    Siva

    Dear Mr.Kumar,
    <b>For any material in the material master , for Price
    Control indicator in Accounting 1 View we can either
    maintain S or V.</b>
    <i>For In House Manufactured materials we maintain S
    (Standard price) & for Sub contracted or bought out
    items we maintain V(Moving Average price).</i>
    <b>During cost roll up & release as far I know we cant
    split like 70 & 30% and we can do the costing.</b>
    So either you have to use the moving average price for
    both inhouse & bought out.
    <b>Because 1 material cant have both standard price &
    Moving Average price.
    Because bought out item's doesnot have standard price.</b>
    If your vendor is ready to give the material(Finished
    product) using the same amount which you spend for
    producing inhouse,then no issue,you can use
    standard price.But Practically it doesn't occur.
    I hope this will help to clear your doubt.
    <b>If useful reward points.</b>
    Regards
    Mangal
    Message was edited by:
            Mangalraj

  • How to create Quotation from Ad hoc cost estimation of cProjects?

    Hi Guruu2019s
    Please help me in resolving the issue given below. I am able to get ad hoc cost estimation results in accounting screen, but not able to create a Quotation from Ad hoc cost estimation of cProjects.
    I am here with providing necessary steps to be followed. But these buttons are not available in my accounting screen.
    Prerequisites
    A reference quotation has been linked to the project under Structure  Object Links. An ad hoc cost estimate has been created for the project.
    Procedure
    1.     Choose the Accounting tab.
    2.     Choose link Ad Hoc Cost Estimate.
    3.     Enter client, user and password to log on to SAP ECC.
    The client, user and password must be entered if Single Sign On is not activated
    4.     On the Ad Hoc Cost Estimate screen, choose  .
    5.     On the Easy Cost Planning screen, choose  .
    6.     Choose  .
    7.     Choose Yes when you are prompted with u201CDo you really want to create the quotation?u201D
    8.     Write down the Quotation number :_______________
    9.     Choose  .
    Result
    Quotation in SAP ERP has been created.
    Please respond to this at the earliest. Points are given for your reply. I would be great if any one provides step by step procedure for IMG activities.  Thanks in advance.
    Thanks & Regards
    Suresh. J

    Hi Suresh,
    maybe you find the following link also useful:
    [http://help.sap.com/saphelp_ppm400/helpdata/en/index.htm]
    Navigation: Collaboration Projects -> Accounting Integration -> Preliminary Costing and Quotation Creation -> Ad Hoc Cost Estimate for cProjects  or Sales Pricing for cProjects
    From the page:
    The cost planning function is executed by Easy Cost Planning (ECP). The cost estimate is always created at project level and is always single-level. The organizational data relevant to costing (controlling area, company code, and master cost center for the derivation of the activity type under which the allocation is reported) is derived from the HR organizational unit specified in the project definition. The costs are calculated based on the rates for the resource, project role, or task. For more information, see Costing Logic.
    The revenues are calculated automatically if you have selected the option Use Cost/Revenue Rates from cProjects or Use Sales Pricing in SAP ERP as the revenue calculation type for the project type that you are using for the project. You make this selection in Customizing for Collaboration Projects, by choosing Connection to External Systems -> Accounting Integration -> Make General Settings. With the last option, the revenues are calculated with the dynamic item processor (DIP). For more information, see Sales Pricing for cProjects. Then you can also call up sales pricing from within the ad hoc cost estimate.
    You can archive the ad hoc cost estimate in SAP ECC (archiving object CO_ECP) if the project has the status To Be Archived.
    Technically, the ad hoc cost estimate is saved in SAP ECC with reference to the cProjects project number. When the project is transferred, it is recosted and the cost estimate stored for the account assignment object.
    Hoping this helps...
    Best regards,
    Thomas

  • Difference in the BOM Qty during Standard Cost estimation

    Hi SAP Experts,
    We are trying to estimate the cost for the material variant, but the BOM exploded during the cost estimation, the quantity differs slightly with the BOM exploded during CU50.
    What might be the reasons for difference.
    Please give your valuable Inputs.
    Thanks
    Best Regards
    Siva

    Dear Mr.Kumar,
    <b>For any material in the material master , for Price
    Control indicator in Accounting 1 View we can either
    maintain S or V.</b>
    <i>For In House Manufactured materials we maintain S
    (Standard price) & for Sub contracted or bought out
    items we maintain V(Moving Average price).</i>
    <b>During cost roll up & release as far I know we cant
    split like 70 & 30% and we can do the costing.</b>
    So either you have to use the moving average price for
    both inhouse & bought out.
    <b>Because 1 material cant have both standard price &
    Moving Average price.
    Because bought out item's doesnot have standard price.</b>
    If your vendor is ready to give the material(Finished
    product) using the same amount which you spend for
    producing inhouse,then no issue,you can use
    standard price.But Practically it doesn't occur.
    I hope this will help to clear your doubt.
    <b>If useful reward points.</b>
    Regards
    Mangal
    Message was edited by:
            Mangalraj

  • The split (i.e., 70% & 30%)during standard cost estimation (CK11)

    Dear All,
    A component(Y) in the BOM of X is manufactured in house (70%) & procured directly from vendor (30%).
    Can we have the split (i.e., 70% & 30%)during standard cost estimation (CK11)
    Based on the cost we deside to make or buy.
    Please explain the procedural steps in arriving at this solution.
    Regards,
    Kumar

    Dear Mr.Kumar,
    <b>For any material in the material master , for Price
    Control indicator in Accounting 1 View we can either
    maintain S or V.</b>
    <i>For In House Manufactured materials we maintain S
    (Standard price) & for Sub contracted or bought out
    items we maintain V(Moving Average price).</i>
    <b>During cost roll up & release as far I know we cant
    split like 70 & 30% and we can do the costing.</b>
    So either you have to use the moving average price for
    both inhouse & bought out.
    <b>Because 1 material cant have both standard price &
    Moving Average price.
    Because bought out item's doesnot have standard price.</b>
    If your vendor is ready to give the material(Finished
    product) using the same amount which you spend for
    producing inhouse,then no issue,you can use
    standard price.But Practically it doesn't occur.
    I hope this will help to clear your doubt.
    <b>If useful reward points.</b>
    Regards
    Mangal
    Message was edited by:
            Mangalraj

  • Mixed costing for cost estimated WITHOUT quantity structure

    Dear all experts
    Anyone can help me for this question u201CCan we use mixed costing for cost estimated WITHOUT quantity structure?u201D. If u201CYesu201D, please give me a hint how.
    Thank you for your help
    Noy

    Dear Ajay
    Thank you for your quick answer. So I will try to use  cost estimated WITH quantity structure instead.
    Thank so much
    Noy

  • Routing during Standard Cost Estimation

    Dear all,
    We are executing the Standard Costing using t_code CK11N for a finished product,,,for the same we have maintained BOM, but no routing has been created,,
    so, during execution of Standard Costing system is prompting a msg: No routing could be determined for material AUBF0018 (green indicator not an error msg), so if we try save the costing a success msg: "The cost estimate is being save" is being prompted,, but the standard cost did not get updated in material master.
    what would be the cause? Is routing essential prior to standard cost execution,,, as our Client says that without routing also they could excute/update the standard cost earlier,,, why this problem is occuring? is there any thing need to be defined in customization for routing not to consider during standard cost estimation,
    Please help us in this regard,
    thanks
    Kumar

    Dear Urendra,
    1.After executing the costing run with quantity structure in CK11N and saving the datas,it only saves the cost estimate.
    2.Marking and release should be done using CK24.First the same has to be marked and then using the same T Code you have to
    release it,only after this steps it get's updated in the material master.
    3.In your case you have done only CK11N and not CK24.
    4.Moreover the routing get's picked automatically by the costing variant that you use,in your case even though there is no
    routing,the systems throws the message before saving,but the status will be saved with errors.
    Check with this and revert back.
    Regards
    Mangalraj.S

  • TS3992 Hi, can someone help please - my iPhone hasn't been backed up since early August, now I can't seem to get it to back up to iCloud. I have 9GB of space, I have left it plugged in etc for 11hrs, but keep getting iPhone backup could not be complete th

    Hi, can someone help please - my iPhone hasn't been backed up since early August, now I can't seem to get it to back up to iCloud. I have 9GB of space, I have left it plugged in etc for 11hrs, but keep getting the same message " iPhone backup could not be completed" -what dies that mean.?

    Hi,
    I was facing issues with both backup and FB integration after the iOs 6 upgrade.  Before then I did not have any issues with the iCloud backup service, but after a few days, I noticed that it was continually stuck at the Estimating time for the backup and it never progressed.
    As any good techie would, I tackled the most pressing issue first . . . FB integration of course.
    I had read in a separate post about this solution so tried it . . .
    I deleted the original FB app and hard booted the phone.  I then went into settings and entered the data for FB integration.  Seconds later, I received a text message to my phone - already listed and verified in FB with a 6 digit code to re-enter instead of my password.  Seconds later I was verified and then prompted to download the FB app.  All backup and integrated.
    Then I went into the iCloud backup, turned it off . . . and deleted the last backup.  I then re-enabled backup . . . and although I thought I was going to face the same issue, after a few minutes, it moved on from Estimating time . . . to actually backing up.  It is now a small way through the backup and seems to estimate that it will take another two hours to complete.
    A good nights work.  Backup and integration all sewed up.  Good luck.
    Cheers
    Ian

  • HELP PLEASE HELP! urgent question with an easy answer!!!!

    Hello;
    I designed a JFrame game, that uses gif files as ImageIcons. The game works perfectly when I run it from console with the java.exe command.
    However; now I want to create a wraparound and run the JFrame in the Internet Explorer from an applet. So I created a new file that extends JApplet; this new file creates a new object of the JFrame-game's class and show()'s it.
    And I created an HTM file that runs the JApplet class. However, the internet explorer cannot open the applet because it has trouble loading the pictures (gif files). How can I load the pictures from my applet for my frame???
    I dont want to change the Java security file. I just want to make the images accessible by my applet. I cannot use commands like setImage in my applet because my JFrame sets the Images.
    (I repeat)My JApplet only invokes an object of my JFrame class and shows it.
    PLEASE HELP PLEASE PLEASE..
    Thanks..

    OK; let me tell you the whole thing. My pictures are in the same folder for sure.
    My JFrame reads pictures and assigns JButtons pictures. when I run the frame there are 16 buttons with the same picture, and when I click the buttons there is a listener in the JFrame that changes the pictures. Simply put, the JFrame has no trouble finding and loading the pictures.
    Then I created a JApplet as follows:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class MemoryApplet extends JApplet
    public void init ()
         GameFrame ce = new GameFrame ();
         ce.show ();
    GameFrame is the name of the JFrame class. Then when I try to open the applet using IE, it gives the following error:
    Exception: java.security.AccessControlException: (javax.io.FilePermission back.gif read)
    back.gif is one of the gif files that are used in GameFrame

  • DS for Cost estimation(COGM)

    Hi Friends,
    In ECC, cost estimation (ck40n) - cost of goods mfg(COGM) stored. I would like to bring all 6 components(material cost, labor, subcontract, depreci,other over heads..) incurred per unit . I would like to bring rates info to BI system.
    Data stored in ECC tables KEPH & KEKO.
    What datasources are helpful to bring rates to BI ?
    Thanks,
    naresh

    created database view based on 2 tables.
    Next created custom datasource and enhanced datasource with cost fields via append str.
    Added exit code to populate costs fields.

  • HELP PLEASE!!! EMERGENCY!!

    So I was updating my iTouch, and when I unplugged it when I thought it was done, it had the symbol to plug it back into the computer. I knew it was done updating though, so I turned it off and then turned it back on. When it was finished restarting, it still had the same symbol, so I plugged it back into my computer. It wanted to back up my media, but I clicked cancel. Then I "ejected" my iPod. I started browsing through my iTouch, instantly realizing that every single one of my apps, songs, and podcasts were deleted!!! Somehow, my iPod was wiped!! My iTunes account still has the complete purchase history, so if I contact someone, can I PLEASE PLEASE PLEASE get my media back? It cost me a lot of money to buy the first time, and I seriously would not like to repurchase every single app and song. HELP PLEASE!!!

    Tacos--
    Your apps can be downloaded again; those should be in your purchase records.
    Music...not so much. There's copyright issues there; this is why one should back up one's music every so often. (and pictures, and other important documents.)
    You might try plugging the iPod back in and letting it synch...and waiting until it's done and it says it's done, and seeing how that goes.
    Doc

Maybe you are looking for

  • Itunes won't open unless I disconnect the network/internet, why?

    My Itunes won't open (after clicking the icon and seeing it running in task manager) until I disconnect the internet connection.  How do I fix this?  I have the latest version of Itunes and Quicktime installed.

  • Which is better: One or multiple iPhoto libraries?

    I recently had a huge scare with my HD crashing and losing about 3500 photos since I had last backed up in Sept 2010 (yes, I take 3000+ photos in 2 months Long story short, my huge iPhoto library was close to 400GBs, and with my iMac HD having only 5

  • FM or BAPI for Group Dependency

    hi experts, i need to create Dependency with Dependency group through Report program. T-Code CU01. please help me to find out any BAPI or FM for the same. Thanks in advance, Amol

  • Pie chart control action

    Hi  I am using  SSRS 2008 R2. Is it possible to control the rotation of the fields in the 2-D pie chart clockwise/anticlockwise? Any help on this would be appreciated.

  • Will surround sound run on core audio+ Digi 002 rack ?

    I have used logic express on my set up but want to buy Logic studio for the surround sound capabilities. I heard from a friend that Logic 8 needs a pro-tools HD TDM to run the surround stuff. The 002 rack (firewire) i use in logic goes through core a