![]() JButton btnBerechnung = new JButton("Gehalt") ītnBerechnung. JLabel lblErgebnis = new JLabel("Ergebnis") tFont(new Font("Dialog", Font.PLAIN, 12)) JLabel lblBesoldung = new JLabel("Besoldung:") JLabel lblStunden = new JLabel("Stunden:") Public void setNachname(String nachname) )) ĬtFont(new Font("Dialog", Font.PLAIN, 12)) ĬtBounds(10, 361, 100, 20) ![]() The default constructor's job is to call the super class constructor and initialize all instance variables. It is essentially a non-parameterized constructor, i.e. Public Personen(Object anrede, String vorname, String nachname, double alter, Object klasse, String ort, String strasse, String plz, Object gbt, When we do not explicitly define a constructor for a class, then java creates a default constructor for the class. How do I solve this problem pls I need help. I don't really know what that means, but after that message, various other messages underneath linked me to the line where I created a new object with the parameterized constructor. But at the very moment I wanted to create an object from the GUI this message popped up:Įxception in thread "AWT-EventQueue-0" JTextFields were no problem as well as the buttons and the JRadioButton is still a mistery to me.Īt first everything seemed to be working just fine cause Eclipse didn't show any errors in the text. JComboBoxes can only give back the value "Object" so I needed to change the type from the attribute from String to Object and it did work out. The program prompts the user to enter two integer values, which are stored in variables a. In the main method, a new Scanner object is created to read input. (I will put the code below) To create a object, I had to use the parameterized constructor and the first challange began. The ParametrizedConstructorDemo class extends the sup1 class and has a constructor that calls the sup1 constructor by passing two integer parameters. Back to the current project I designed a GUI with multiple JComboBoxes, JTextFields, JButtons and a JRadioButton. I wanted to use a parameterized constructor and it did work in a different project, the only problem there was that I needed to initiate a new object for every method I wrote. So I created a new project ment to be used as a registration form to store students and teachers. After learning how to combine a parameterized constructor from an abstract class with inheriting classes and how to design a GUI, I started thinking about putting both together, I'm releativley new to Java and I'm trying to learn more and more about programming every day.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |