Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-13-2009, 11:49 AM
Member
 
Join Date: Aug 2009
Location: Costa Brava
Posts: 4
Rep Power: 0
jicxicmic is on a distinguished road
Default 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 english

Last edited by jicxicmic; 11-13-2009 at 12:25 PM.
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 11-13-2009, 12:36 PM
Member
 
Join Date: Nov 2009
Posts: 1
Rep Power: 0
sudquoslop is on a distinguished road
Default
I think this is enough .....
I do agree with you. Those are the most effective way
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 11-13-2009, 02:06 PM
Member
 
Join Date: Aug 2009
Location: Costa Brava
Posts: 4
Rep Power: 0
jicxicmic is on a distinguished road
Default
I've found the trick, here is the summary, of course need to Try/Catch.

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);
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
window.open problem praveenkumar14 NetBeans 2 10-12-2009 12:18 PM
Different Files Open in File -> Open Workspace mgm2010 JCreator 1 04-22-2009 06:22 PM
Any workarounds for JPasswordField in JDialog bug? dtmansy Advanced Java 3 02-10-2009 09:12 PM
setLocation on a JDialog is ignored ScottVal AWT / Swing 7 01-13-2009 08:35 AM
help with jdialog leonard AWT / Swing 1 08-05-2007 06:37 AM


All times are GMT +2. The time now is 05:52 PM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org