Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Am I doing it rite? Using netbeans GUI builder

  1. #1
    Junior Member erm3r's Avatar
    Join Date
    Sep 2011
    Location
    Miami
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Am I doing it rite? Using netbeans GUI builder

    So I'm basically new to Java. I have c++ experience but there are slight differences. Right now I'm trying to create a simple version of a complex idea. I don't know why I put myself into these positions but I really want to learn and I feel like diving in is the best way to go about it. For some reason the program is not working and I think it has something to do with the fact that I'm a n00b. Can someone please help a sister out? Thanks in advance.

    I'd also like your opinions on the GUI automated code builder for netbeans? Do you think I should go old school while I am learning the syntax or are things like this the way of the future?

    package ermersestimating;
    /**
     *
     * @author Krystyna
     */
    public class Estimating {
        private String jobName;
        private String supplier;
        private String pipeType;
        private String pipeSize;
        private int quantity;
        private double unitPrice;
        private double totalPrice;
     
        public Estimating(String jobName, String supplier, String pipeType, String pipeSize, int quantity, double unitPrice, double totalPrice) {
            this.jobName = jobName;
            this.supplier = supplier;
            this.pipeType = pipeType;
            this.pipeSize = pipeSize;
            this.quantity = quantity;
            this.unitPrice = unitPrice;
            this.totalPrice = totalPrice;
        }
     
        public String getJobName() {
            return jobName;
        }
     
        public void setJobName(String jobName) {
            this.jobName = jobName;
        }
     
        public String getPipeSize() {
            return pipeSize;
        }
     
        public void setPipeSize(String pipeSize) {
            this.pipeSize = pipeSize;
        }
     
        public String getPipeType() {
            return pipeType;
        }
     
        public void setPipeType(String pipeType) {
            this.pipeType = pipeType;
        }
     
        public int getQuantity() {
            return quantity;
        }
     
        public void setQuantity(int quantity) {
            this.quantity = quantity;
        }
     
        public String getSupplier() {
            return supplier;
        }
     
        public void setSupplier(String supplier) {
            this.supplier = supplier;
        }
     
        public double getTotalPrice() {
            return totalPrice;
        }
     
        public void setTotalPrice(double totalPrice) {
            this.totalPrice = totalPrice;
        }
     
        public double getUnitPrice() {
            return unitPrice;
        }
     
        public void setUnitPrice(double unitPrice) {
            this.unitPrice = unitPrice;
        }
     
        @Override
        public String toString() {
            return "Job Name: " + jobName + " Supplier: " + supplier 
                    + " Pipe Type: " + pipeType + " Pipe Size:" + pipeSize +
                    " Quantity: " + quantity + " Unit Price: " + unitPrice + 
                    " TotalPrice: " + (unitPrice*quantity) ;
        }
     
     
     
     
     
      public static void main(String [] args){
     
     
      }
     
    }

      @Action
        public void getEstimate() throws IOException {
     
     
     
    [B]        //the call below is causing the following error:constructor can not be applied to given types.. found: no arguments reason: actual and formal argument lists differ in length[/B]
                Estimating Estimate = new Estimating();
     
            double cPipe;
            double gPipe;
            double pPipe;
     
            //sets Job name
            Estimate.setJobName(jTextField_Name.getText());
     
            //if copper radio button has focus 
            while(jRadioButton_Copper.hasFocus()){
     
                //price for length of copper pipe
                cPipe = 15.00;
     
                //if statement to determine which supplier is selected
                if(jCheckBox_Ferg.isSelected()){
     
                Estimate.setSupplier("Ferguson");
                Estimate.setPipeType("Copper");
                double fergMultiplier = .15;
                double f = (cPipe * fergMultiplier);
                double fPrice = (f + cPipe);
                //sets unit price
                Estimate.setUnitPrice(fPrice);
     
     
            } else if (jCheckBox_Lion.isSelected()){
     
                Estimate.setSupplier("Lion");
                Estimate.setPipeType("Copper");
                double lionMultiplier = .20;
                double l = (cPipe * lionMultiplier);
                double lPrice = l + cPipe;
     
                //sets unit price
                Estimate.setUnitPrice(lPrice);
     
     
            } else if (jCheckBox_Hughes.isSelected()){
     
                Estimate.setSupplier("Hughes");
                Estimate.setPipeType("Copper");
                double hughesMultiplier = .14;
                double h = (cPipe * hughesMultiplier);
                double hPrice = h + cPipe;
     
                //sets unit price
                Estimate.setUnitPrice(hPrice);
            }
     
     
                //if galvanized button has focus
                while(jRadioButton_Galv.hasFocus()){
     
                gPipe = 20.00;
     
                if(jCheckBox_Ferg.isSelected()){
     
                Estimate.setSupplier("Ferguson");
                Estimate.setPipeType("Galvanized");
                double fergMultiplier = .22;
                double f = (gPipe * fergMultiplier);
                double fPrice = (f + gPipe);
     
                //sets unit price
                Estimate.setUnitPrice(fPrice);
     
     
            } else if (jCheckBox_Lion.isSelected()){
     
                Estimate.setSupplier("Lion");
                Estimate.setPipeType("Galvanized");
                double lionMultiplier = .23;
                double l = (gPipe * lionMultiplier);
                double lPrice = l + gPipe;
     
                //sets unit price
                Estimate.setUnitPrice(lPrice);
     
     
            } else if (jCheckBox_Hughes.isSelected()){
     
                Estimate.setSupplier("Hughes");
                Estimate.setPipeType("Copper");
                double hughesMultiplier = .26;
                double h = (gPipe * hughesMultiplier);
                double hPrice = h + gPipe;
     
                //sets unit price
                Estimate.setUnitPrice(hPrice);
            }
            }
                //if PVC button has focus
                while(jRadioButton_Pvc.hasFocus()){
     
                pPipe = 10.00;
     
                if(jCheckBox_Ferg.isSelected()){
     
                Estimate.setSupplier("Ferguson");
                Estimate.setPipeType("PVC");
                double fergMultiplier = .12;
                double f = (pPipe * fergMultiplier);
                double fPrice = (f + pPipe);
     
                //sets unit price
                Estimate.setUnitPrice(fPrice);
     
     
            } else if (jCheckBox_Lion.isSelected()){
     
                Estimate.setSupplier("Lion");
                Estimate.setPipeType("Galvanized");
                double lionMultiplier = .09;
                double l = (pPipe * lionMultiplier);
                double lPrice = l + pPipe;
     
                //sets unit price
                Estimate.setUnitPrice(lPrice);
     
     
            } else if (jCheckBox_Hughes.isSelected()){
     
                Estimate.setSupplier("Hughes");
                Estimate.setPipeType("Copper");
                double hughesMultiplier = .11;
                double h = (pPipe * hughesMultiplier);
                double hPrice = h + pPipe;
     
                //sets unit price
                Estimate.setUnitPrice(hPrice);
            }
            }
     
            // gets quantity value
            int quantity = ((Integer)jSpinner_Quantity.getValue()).intValue();
               Estimate.setQuantity(quantity);
     
               //gets size of pipe
            String size = ((String)jComboBox_Size.getSelectedItem());
                Estimate.setPipeSize(size); 
     
                   try 
            {
                //writes to file
                FileWriter p = new FileWriter("quote.txt", true);
     
                p.append(Estimate.toString());
                p.close();
     
                jTextField_Name.setText("");
     
     
     
     
            } catch (FileNotFoundException ex) 
            {
                Logger.getLogger(Estimating.class.getName()).log(Level.SEVERE, null, ex);
            }
            }          
        }
     
    //appends data to textArea
        @Action
        public void retrieve() throws FileNotFoundException 
        {    
            FileReader fr = new FileReader("quote.txt");
            Scanner s = new Scanner(fr);
            while (s.hasNext())    
            jTextArea_Quote.append( "\n" + s.nextLine());
        }
     
    //clears out textArea for the quote tab
        @Action
        public void reset() {
            jTextArea_Quote.setText("");
        }
     
    //clears the textfield and resets checkboxes/radiobutton to default.
        @Action
        public void clearMain() {
            jTextField_Name.setText("");
            jCheckBox_Ferg.setSelected(true);
            jCheckBox_Hughes.setSelected(false);
            jCheckBox_Lion.setSelected(false);
            jComboBox_Size.setSelectedItem(0);
            jSpinner_Quantity.setValue(0);
            jRadioButton_Copper.setSelected(true);
     
     
        }


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,372
    Thanks
    184
    Thanked 836 Times in 779 Posts
    Blog Entries
    5

    Default Re: Am I doing it rite? Using netbeans GUI builder

    For some reason the program is not working
    How is it not working? What do you want it to do? The following link might be of use to increase the probably of getting useful responses:
    How to Help Yourself Get Help
    And for what its worth, I would recommend ditching the GUI builder. For newcomers it can end up causing more problems than it is worth, but your mileage may vary.

Similar Threads

  1. [SOLVED] difference between String Concatenation and String -Buffer/Builder .append(<value>)
    By chronoz13 in forum Java Theory & Questions
    Replies: 5
    Last Post: September 3rd, 2011, 09:16 AM
  2. [SOLVED] NetBeans GUI Builder image paintint
    By Kakashi in forum Java IDEs
    Replies: 2
    Last Post: June 15th, 2011, 09:06 AM
  3. Netbeans 6.8
    By selmaky in forum Java IDEs
    Replies: 1
    Last Post: May 14th, 2011, 04:08 PM
  4. How do I change Look and Feel in Window Builder?
    By Zorobay in forum AWT / Java Swing
    Replies: 1
    Last Post: May 3rd, 2011, 10:08 PM
  5. Process Builder Issue
    By javameanslife in forum What's Wrong With My Code?
    Replies: 0
    Last Post: January 20th, 2010, 09:13 PM