Fri Nov 12, 2010 6:22 am
instantiating java classes
How do i instantiate a class in my gui code? For example i have a pay class that will be used in my gui code, how do i implement it?
Thanks
Fri Nov 12, 2010 10:23 am
all datatypes in java are classes and can be up casted to root class OBJECT .You can extend GUI classes ( like JFrame ,JPanel , JButton ) lets say MyFrame (Which extends JFrame) and use an object instance from your class inside it .
Thu Nov 18, 2010 12:09 pm
When a number of objects are created from the same class blueprint, they each have their own distinct copies of instance variables. In the case of the Bicycle class, the instance variables are cadence, gear, and speed. Each Bicycle object has its own values for these variables, stored in different memory locations.
Use of the static keyword to create fields and methods that belong to the class, rather than to an instance of the class.
You can extend JFrame by,
public class MyFrame extends JFrame {
//Your code
}
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.