Results 1 to 3 of 3
Thread: Open jDialog problem
- 11-13-2009, 10:49 AM #1
Member
- Join Date
- Aug 2009
- Location
- Costa Brava
- Posts
- 5
- Rep Power
- 0
Open jDialog problem
Hi,
I have a jDialog that I use to search over several tables depending on parameters. So I can instantiate to search customer, departments, etc.
Now I want to add a new parameter to be able to add a button that opens the maintenance JDialog for the selected table, so if I instantiate the search jDialog to look for customers, when I press the button open the customers table jDialog,
if I'm looking for departments, open the departments table jDialog.
I think the best way should be pass the class to search dialog and from there instantiate the class, but my problem is I couldn't instantiate a class with two parameters the owner of window and the modal. Any knows how to do ?, I'm trying to avoid to have a hardcoded list of table dialogs nor pass and instantiated JDialog that most of the times wouldn't be used.
and easy view that I want is this
Class.forName(maintenancedialogname).newInstance(o wner,modal);
PD:sorry for my poor englishLast edited by jicxicmic; 11-13-2009 at 11:25 AM.
- 11-13-2009, 11:36 AM #2
Member
- Join Date
- Nov 2009
- Posts
- 1
- Rep Power
- 0
I think this is enough .....
I do agree with you. Those are the most effective way
- 11-13-2009, 01:06 PM #3
Member
- Join Date
- Aug 2009
- Location
- Costa Brava
- Posts
- 5
- Rep Power
- 0
I've found the trick, here is the summary, of course need to Try/Catch.
Java Code://assign to a variable the class of JDialog Class<? extends JDialog> mant = MyJDialog.class; //look for the constructor of the parameters I need Constructor<? extends JDialog> manteniment = mant.getConstructor(Frame.class, Boolean.TYPE); // instantiate the JDialog JDialog dialeg = manteniment.newInstance(MyApp.getMainFrame(), true);
Similar Threads
-
Any workarounds for JPasswordField in JDialog bug?
By dtmansy in forum Advanced JavaReplies: 5Last Post: 02-23-2010, 11:56 PM -
window.open problem
By praveenkumar14 in forum NetBeansReplies: 2Last Post: 10-12-2009, 11:18 AM -
Different Files Open in File -> Open Workspace
By mgm2010 in forum JCreatorReplies: 0Last Post: 04-11-2009, 02:14 PM -
setLocation on a JDialog is ignored
By ScottVal in forum AWT / SwingReplies: 7Last Post: 01-13-2009, 07:35 AM -
help with jdialog
By leonard in forum AWT / SwingReplies: 1Last Post: 08-05-2007, 05:37 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks