Board index » jbuilder » Use frame

Use frame


2004-04-14 03:43:23 AM
jbuilder21
Hi,
I have a frame with some dbswing objects, like JdbTextField or JdbComboBox,
and I want to open another frame with a JdbTable showing some data from
another table, then the user can choice a record from table and return this
to the first frame.
How can I do this ???
I dont want use only JdbComboBox, my tables are very large and my users need
to do a search for record that they want.
Robson
ps.: sorry my English
 
 

Re:Use frame

When the user presses the OK button on the called frame (the one where they
do the lookup), call back to the main frame and populate it with the data.
--
Check out our latest white papers at
www.datadevelopment.com/papers/index.html
BladeNET Scores With Borland Enterprise Tools
Team Development with JBuilder and Borland Enterprise Server
Dolphin Data Development Ltd.
www.datadevelopment.com/
"Robson" < XXXX@XXXXX.COM >wrote in message
Quote
Hi,
I have a frame with some dbswing objects, like JdbTextField or
JdbComboBox,
and I want to open another frame with a JdbTable showing some data from
another table, then the user can choice a record from table and return
this
to the first frame.
How can I do this ???
I dont want use only JdbComboBox, my tables are very large and my users
need
to do a search for record that they want.


Robson

ps.: sorry my English


 

Re:Use frame

Robson wrote:
Quote
Hi,
I have a frame with some dbswing objects, like JdbTextField or JdbComboBox,
and I want to open another frame with a JdbTable showing some data from
another table, then the user can choice a record from table and return this
to the first frame.
How can I do this ???
I dont want use only JdbComboBox, my tables are very large and my users need
to do a search for record that they want.


Robson

ps.: sorry my English


This was answered in another group. Please don't multipost, it is
against the newgroup rules.
support.borland.com/newsgroups/guidelines.asp
--
Regards,
Lori Olson (TeamB)
------------
Save yourself, and everyone else, some time and search the
newsgroups and the FAQ-O-Matic before posting your next
question.
Google Advanced Newsgroup Search
www.google.ca/advanced_group_search
Other Newsgroup Searches:
www.borland.com/newsgroups/ngsearch.html
Joi Ellis's FAQ-O-Matic:
www.visi.com/~gyles19/fom-serve/cache/1.html
 

{smallsort}

Re:Use frame

ok, but I want use this frame to populate some different frames, how can I
do the reference to the frame that called this second frame ?
can I use "parent" or "super" ?
thanks,
Robson
 

Re:Use frame

Robson wrote:
Quote
ok, but I want use this frame to populate some different frames, how can I
do the reference to the frame that called this second frame ?
can I use "parent" or "super" ?

thanks,
Robson
Not sure I am following exactly what you wish to do, but it sounds like
you want to do some type of lookup Frame from your Main Data Frame. Is this
correct?
Example
public void okButton_actionPerformed(ActionEvent e) {
Frame2 frame2= new Frame2();
CenterFrame(frame2); //this is some custom code to center a Frame
frame2.setVisible();
}
Frame 2 is called, and you select an item in a JdbTable. You want to send
this data back to Frame1.
void jDbTableData_mousePressed(MouseEvent e) {
if(e.getClickCount()==2) {
frame1.setID(jDbTableData.getDataSet().getInt("ID"));
}
}
}
Is this the idea?
Ok, to make the Frame1 or MainFrame callable, without creating a new
instance, you need to make the Frame1 or MainFrame contain a static method
and return an instance of the MainFrame or Frame1.
Example
public class MainFrame extends JFrame() {
private static MainFrame mainFrame;
private int id=0;
}
public static void main(String args[]) {
mainFrame= new MainFrame();
//all other code
}
//now create a callable static method to return mainFrame
public MainFrame getMainFrame() {
return mainFrame();
}
public setID(int id) {
this.id=id;
}
}
Now the Frame2 code modified to reference this MainFrame
void jDbTableData_mousePressed(MouseEvent e) {
if(e.getClickCount()==2) {
MainFrame.getMainFrame().setID(jDbTableData.getDataSet().getInt("ID"));
}
}
Hope this helps.
 

Re:Use frame

What you can do is pass the relevant data set and column name into a method
of the lookup dialog:
public class LookupDialog extends JDialog {
// ...
public void doLookup(DataSet dataSet, String columnName) {
pack();
show();
dataSet.setString(columnName,
lookupDataSet.getColumn("lookupColumnName"));
}
}
You can parameterize this as much as you want, including selecting the table
you want to lookup, the column name you want to populate from, and so on.
--
Check out our latest white papers at
www.datadevelopment.com/papers/index.html
BladeNET Scores With Borland Enterprise Tools
Team Development with JBuilder and Borland Enterprise Server
Dolphin Data Development Ltd.
www.datadevelopment.com/
"Robson" < XXXX@XXXXX.COM >wrote in message
Quote
ok, but I want use this frame to populate some different frames, how can I
do the reference to the frame that called this second frame ?
can I use "parent" or "super" ?

thanks,
Robson


 

Re:Use frame

ok, it works, but and if I open the second frame from other frame ?
how can I do the reference to the last frame ?
can I do this ?
 

Re:Use frame

You can do as much of that as you wish by passing the parameter down the
line. Store the calling frame in a member variable, pass that member
variable to the next frame, and so on.
--
Check out our latest white papers at
www.datadevelopment.com/papers/index.html
BladeNET Scores With Borland Enterprise Tools
Team Development with JBuilder and Borland Enterprise Server
Dolphin Data Development Ltd.
www.datadevelopment.com/
"Robson" < XXXX@XXXXX.COM >wrote in message
Quote
ok, it works, but and if I open the second frame from other frame ?
how can I do the reference to the last frame ?
can I do this ?