🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #130

Doing away with default code of JBuilder, possible?

#130
From: Daniel
Date: Sat, 22 Dec 2007 16:34
96 lines
4086 bytes
Dear fellow developers,

I am using Borland JBuilder 2005 Foundation. When a new project is created, default code generated by JBuilder appeared within the window.(that has the tab of Design, which allows you to work with Interface design but I don't need that yet) 

package assign1;

import java.awt.Toolkit;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import java.awt.Dimension;

public class calculator1 {
    boolean packFrame = false;

    /**Construct and show the application.*/
    public calculator1() {
        Frame1 frame = new Frame1();
// Validate frames that have preset sizes
// Pack frames that have useful preferred size info, e.g. from their layout
        if (packFrame) {
            frame.pack();
        } else {
            frame.validate();
        }

        // Center the window
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        Dimension frameSize = frame.getSize();
        if (frameSize.height > screenSize.height) {
            frameSize.height = screenSize.height;
        }
        if (frameSize.width > screenSize.width) {
            frameSize.width = screenSize.width;
        }
frame.setLocation((screenSize.width - frameSize.width) / 2,
                          (screenSize.height - frameSize.height) / 2);
        frame.setVisible(true);
        try {
            jbInit();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    /**
     * Application entry point.
     *
     * @param args String[]
     */
    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                try {
                    UIManager.setLookAndFeel(UIManager.
                                             getSystemLookAndFeelClassName());
                } catch (Exception exception) {
                    exception.printStackTrace();
                }

            }
        });
    }

    private void jbInit() throws Exception {
    }
}
 
If I don't want to design the interface and just want to compile my code and check if it works, can I delete all the code above and replace it with my code?

I don't know how now to work with just simple compiling and syntax-checking because of these default code that appears in JBuilder. I wanted for instance from an array of double digits to calculate their average. This doesn't involve any user interface. What do I do with the original JBuilder code generated by it?

My code are as follows:

package tutorial1;

public class Frames1{

    public static void main(String[] args) {
        double scores[] = {76.0, 84.5, 92.5, 88.0, 96.0};
        double avg;
        double sum = 0;

        for (int i = 0; i < scores.length; i++) {
            sum += scores[i];
        }
        avg = sum / scores.length;

        System.out.println("The average of the scores is: " + avg);
        System.out.println("The fourth element of the array is: " + scores[3]);
        System.out.println("The length of the scores array is: " +
                           scores.length);
    }
}

Thank you in advance for your help.
Technical Details
Message-ID: <476d4ac2$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: f74b3,2a9dfa2966423589,start
X-Google-Attributes: gidf74b3,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Daniel " <dantsg@gmail.com>
Sender: "Daniel " <dantsg@gmail.com>
Reply-To: "Daniel " <dantsg@gmail.com>
Subject: Doing away with default code of JBuilder, possible?
Newsgroups: borland.public.jbuilder.java.language
X-User-Info: 82.72.42.113     
NNTP-Posting-Host: 207.105.83.66
Message-ID: <476d4ac2$1@newsgroups.borland.com>
Date: 22 Dec 2007 09:34:58 -0700
X-Trace: newsgroups.borland.com 1198344898 207.105.83.66 (22 Dec 2007 09:34:58 -0700)
Lines: 96
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail