Dear All!! I suffer a trouble in UI design. I got several frames in the project, nearly finished the function in each single frame, but i cannot link them together. for example: First frame1 = new First(); CheckIn frame2 = new CheckIn();
void jButton1_actionPerformed(ActionEvent e) {???} what can i write into {???} to implement "press button in First frame then go to CheckIn frame?"
See the following code: ------------ jButton1_actionPerformed(ActionEvent e) { frame1.setVisible(false); //hide the First frame frame2.setVisible(true); //go to CheckIn frame }
new troubles. I cannot invoke frame2 in frame2.setVisible(true); I define Second frame2 = new Second(); in Main class. is there any good idea? BTW, did someone know any examples abt multi-frames in JAVA?
You can move some of the logic into a special class, often called a controller.
This starts to separate one frame from knowing anything about the other. Does that make enough sense to help?
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Welcome to Javaranch! We don't have too many rules around here but we do have a Naming Policy. Please adjust your display name to meet these requirements. You can change your display name by clicking here
Thanks for your cooporation.
Watchya got in that poodle gun? Anything for me? Or this tiny ad?
a bit of art, as a gift, that will fit in a stocking