Switch to full style
Java2 codes,problems ,discussions and solutions are here
Post a reply

instantiating java classes

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



Re: instantiating classes

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 .

Re: instantiating classes

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
}

Post a reply
  Related Posts  to : instantiating java classes
 Wrapper classes use in java     -  
 java wrapper classes     -  
 Nested classes(inner class) in java     -  
 java.util classes and interfaces support event handling     -  
 about classes     -  
 How to create and use classes in C++     -  
 Abstract Classes in jsp     -  
 how do i create the classes XX and YY?     -  
 inherited in the derived classes     -  
 Add and Remove CSS classes to html tag dynamically     -