File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Creating a Class Object from the Input from a JTextField. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Creating a Class Object from the Input from a JTextField." Watch "Creating a Class Object from the Input from a JTextField." New topic
Author

Creating a Class Object from the Input from a JTextField.

Ryan Perlman
Greenhorn

Joined: Oct 31, 2001
Posts: 23
Instead of going:
MyClass ryan = new MyClass();
can you take the Input from a JTextField and Use it for the Object name of MyClass?
If So where should I continue to look, or what other option do I have.
Ryan Perlman
Having fun while I am learning
Rob Ross
Bartender

Joined: Jan 07, 2002
Posts: 2205
Yes, look at
Class.forName("classname"). This returns a Class object of the type in the argument.
Class myClass = Class.forName("classname")
;
then
Object myNewObject = myClass.newInstance().

Rob


Rob
SCJP 1.4
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Creating a Class Object from the Input from a JTextField.
 
Similar Threads
Get data from jtext field
Passing Customized objects
code generation/bytecode modification
How to add JtextField to JOptionPane
reading data from Jtextfield on jpanel on jframe