Board index » jbuilder » Doing away with default code of JBuilder, possible?

Doing away with default code of JBuilder, possible?


2007-12-23 12:34:58 AM
jbuilder19
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.
 
 

Re:Doing away with default code of JBuilder, possible?

Daniel wrote:
Quote
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?
Absolutely. There's nothing in the code generated by JBuilder that is
anything special or that will be broken by its removal.
--
Kevin Dean [TeamB]
Dolphin Data Development Ltd.
www.datadevelopment.com/
Please see Borland's newsgroup guidelines at
info.borland.com/newsgroups/guide.html
 

Re:Doing away with default code of JBuilder, possible?

Hello guys,
When there's a compile error in JBuilder Foundation 2005, how do I view what the error message is?Can't seem to locate it under History tab so how to know what to correct. Thanks in advance for your answer.
 

{smallsort}

Re:Doing away with default code of JBuilder, possible?

Daniel wrote:
Quote
Hello guys,

When there's a compile error in JBuilder Foundation 2005, how do I view what the error message is?Can't seem to locate it under History tab so how to know what to correct. Thanks in advance for your answer.
I would create a non GUI project and use that as a basis for your code.
Since your code is only doing a simple non AWT or Swing GUI (command
interface only), you do not need any GUI includes.
 

Re:Doing away with default code of JBuilder, possible?

Daniel wrote:
Quote
Hello guys,

When there's a compile error in JBuilder Foundation 2005, how do I
view what the error message is?Can't seem to locate it under History
tab so how to know what to correct. Thanks in advance for your
answer.
You probably closed the Messages Pane, or resized it so it is not visible.
Try View | Panes and make certain Messages is selected.
If that does not help, try View | Workspaces | Reset Workspace.
(That last is in JB2006, if not in JB2005, let me know, and I'll dig up
how to do that manually)
--
Regards,
Lori Olson [TeamB]
------------
Save yourself some time and search the newsgroups and the
other available community resources before posting your
next question.
Google Advanced Newsgroup Search
www.google.ca/advanced_group_search
Other Ruby Resources:
onestepback.org/articles/usingruby/resources.html
Other Rails Resources:
www.rubyonrails.com/
 

Re:Doing away with default code of JBuilder, possible?

Daniel wrote:
Quote
When there's a compile error in JBuilder Foundation 2005, how do I
view what the error message is?Can't seem to locate it under
History tab so how to know what to correct.
The "History" tab gives you a list of revisions, not errors.
Open up the Help>Help Topics, switch to the "Index" tab,
and type "compiler". Select "errors" in the list under
"compiler" in the left-hand pane's list. When the
page shows in the right-hand pane, you should see
"Error messages" as the section title. It might be
good to right-click and choose "Synchronize with Table of
Contents" so that you can get a sense of where in the
manual this topic is located. Topics immediately above
it may also come in handy, in the process of learning
how to use JBuilder.
(I'm basing this info on JBuilder 2006 -- I no longer
have JBuilder 2005 installed on this system.)
--
Paul Furbacher (TeamB)
Save time, search the archives:
info.borland.com/newsgroups/ngsearch.html
Is it in Joi Ellis's Faq-O-Matic?
www.visi.com/~gyles19/fom-serve/cache/1.html
Finally, please send responses to the newsgroup only.
That means, do not send email directly to me.
Thank you.