Results 1 to 8 of 8
- 12-16-2009, 11:51 AM #1
Member
- Join Date
- Dec 2009
- Posts
- 5
- Rep Power
- 0
passing an object from one JDialog to Jframe
Hi ,
am a newbie to Swing .
I have an appliction consisting multiple components , I created a JFrame where I have a load button .
When i hit the load button , it opens a jdialog , where I have to fill in some crieteria for filtering a data out of db .
I have to send that filtered object to the JFrame again for loading it into the table which is present in 1st JFrame .
I am able to reteive that obj in jframe , but unable to paint the JFAME with new data .
Please help..
-
Hard to say what you're doing wrong without code.
You would extract data from the dialog's components just as you would for any OOP object. I'd give the class public getters.
Is the dialog modal? If so, then you retrieve data from the dialog after it returns. If it's not modal, then you may need to use an observable model or listen for its closing.
- 12-16-2009, 02:07 PM #3
Member
- Join Date
- Dec 2009
- Posts
- 5
- Rep Power
- 0
The JFrame's Load button actionlistener
loadButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae) {
SpecSelectorDialog selector = new SpecSelectorDialog(getFrame());
selector.setVisible(true);
_spec = selector.getSpecObj();
if (_spec != null)
setTable(_spec);
else
return;
}
});
where setTable is a method which takes _spec object as a param and sets the table cells in JFrame .
I am surprised to see that if I load the the spec object at the first time I hit load , it populates the table at first attempt
but if I select another crieteria , it is unable to repaint the JFrame , I mean it does not shows any difference than the previous screen .
- 12-16-2009, 02:11 PM #4
Member
- Join Date
- Dec 2009
- Posts
- 5
- Rep Power
- 0
I think that the JFame is not refresing
- 12-16-2009, 02:12 PM #5
What does your setTable(_spec) method do?
Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
The Ubiquitous Newbie Tips
- 12-16-2009, 02:27 PM #6
Member
- Join Date
- Dec 2009
- Posts
- 5
- Rep Power
- 0
public void setTable(Spec spec)
{
validate();
issuerTableModel = new IssuerTableModel(4,0);
initIssuerTable();
issuerTableModel.setTo(issuersTable,true);
issuerTableModel.refresh();
TableUtil.adjust(issuersTable);
repaint();
System.out.println(spec.getName());
Iterator<String> issuer = spec.getAllKeys();
System.out.println(issuer.toString());
int row = 0;
while(issuer.hasNext()) {
System.out.println("Adding row ");
issuerTableModel.addRow();
String key = issuer.next();
StringTokenizer keys = new StringTokenizer( key, ".");
Double spread = spec.getRunningSpread(key);
if (spread < 0)
{
issuerTableModel.setValueAt(row, 1, "N");
}
else
{
issuerTableModel.setValueAt(row, 1, "Y");
}
String token = keys.nextToken();
System.out.println(token);
System.out.println("--------------------------------");
issuerTableModel.setValueAt(row, 0 ,token );
token = keys.nextToken();
System.out.println(token);
issuerTableModel.setValueAt(row, 2, token);
issuerTableModel.setValueAt(row, 3,spread );
issuerTableModel.refresh();
TableUtil.adjust(issuersTable);
row ++;
}
nameText.setText(spec.getName());
}
- 12-16-2009, 02:45 PM #7
Member
- Join Date
- Dec 2009
- Posts
- 5
- Rep Power
- 0
I get all the values in the sysouts in the settable method but it is not refreshed in the JFrame
- 12-16-2009, 04:56 PM #8
Senior Member
- Join Date
- Aug 2009
- Location
- Pittsburgh, PA
- Posts
- 284
- Rep Power
- 4
Similar Threads
-
Communicate JFrame with JDialog
By BeRniTo in forum AWT / SwingReplies: 2Last Post: 08-31-2009, 02:07 PM -
Passing data from one JFrame to another JFrame
By tarami in forum New To JavaReplies: 3Last Post: 08-06-2009, 05:44 PM -
Unable to display JDialog from JFrame
By jv5 in forum NetBeansReplies: 2Last Post: 02-04-2009, 04:33 AM -
Returning data from a JFrame/JDialog?!
By Joe2003 in forum AWT / SwingReplies: 6Last Post: 01-08-2009, 12:14 AM -
problems with jDialog in a JFrame
By bbq in forum AWT / SwingReplies: 1Last Post: 07-05-2007, 04:14 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks