georgesakiki / ift215-georges

project
0 stars 0 forks source link

error in design coding #5

Open georgesakiki opened 9 years ago

georgesakiki commented 9 years ago

what's the error in : public carSeller() { initComponents(); this.setWindowsRelativeTo(this); manualButton.setSelected(true); rootPane.setDefaultButton(SUBMITBUT); this.setTitle("Car Seller"); }

georgesakiki commented 9 years ago

i have another error in : carSeller cs = new carSeller(ProductionYear,Windows,AC,Engine); jLabel1.setText(Integer.toString(cs.getPrice()));

eddyghabachlcu commented 9 years ago

please commit and synch

georgesakiki commented 9 years ago

it's in last commit about 3 hours ago

eddyghabachlcu commented 9 years ago

Replace: this.setWindowsRelativeTo(this); With: this.setLocationRelativeTo(this);

eddyghabachlcu commented 9 years ago

When you call a constructor you have to respect 2 things: 1- Parameters must be of the same type (for example you are using production year as integer in JFrame and string in class and that's wrong....) 2- You must call the constructor with the same order of parameters (if the constructor takes (int a, String b) you must call it using (int c, String d) where c refers to a and d refers to d).

Also you are not declaring an instance of the class. You are declaring a new instance of the JFrame! CarSeller1 is your class so you must use: CarSeller1 cs = new CarSeller1(constructor parameters);

georgesakiki commented 9 years ago

okey thank you

georgesakiki commented 9 years ago

when i have windows , they was electrical or manual button so i want to press into one of them not the 2 in the same time.. what i have to do??

eddyghabachlcu commented 9 years ago

you add a radio group form the palette to the form and you connect the radio buttons to it from their proprieties.

Deputy001 commented 1 year ago

It looks like the method carSeller is missing a return type. In Java, all methods must have a return type specified, unless they are constructors. In that case, the name of the method should match the name of the class and have no return type.

Here's how the carSeller method should be written:

public class CarSeller { public CarSeller() { initComponents(); this.setWindowsRelativeTo(this); manualButton.setSelected(true); rootPane.setDefaultButton(SUBMITBUT); this.setTitle("Car Seller"); } }

Note that the method has no return type and the class name is CarSeller (with an uppercase "C") to match the method name.