?
Solved

Problem with JFrames

Posted on 2003-02-24
7
Medium Priority
?
190 Views
Last Modified: 2010-03-31
I made an application. In this application I have an Jframe that shows all customers in a table. When the users double clicks an customer the program opens a new JFrame with the customer details.

My problem is that the first JFrame stays accessible. How to solve????

0
Comment
Question by:RdeLange
  • 5
  • 2
7 Comments
 
LVL 18

Expert Comment

by:bobbit31
ID: 8010924
make the frame with the customer details a modal JDialog:

from your initial form:
CustomerInfoDialog cid = new CustomerInfoDialog(this, "Customer Info", true);
cid.show();


public class CustomerInfoDialog extends JDialog {
   public CustomerInfoDialog(Frame owner, String title, boolean modal) {
        super(owner, title, modal);

        // add your components
   }
}

}

0
 

Author Comment

by:RdeLange
ID: 8010961
Why using a dialog? Isn't a JFrame better? Because the user has to fill in a lots of fields.

0
 
LVL 18

Expert Comment

by:bobbit31
ID: 8011031
you can put whatever components you want on a JDialog.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 18

Expert Comment

by:bobbit31
ID: 8011043
another thing you might want to try is:

when opening second frame call
parentFrame.disable();

when closing second frame:
parentFrame.enable();
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 8011053
oops, make that:
parentFrame.setEnabled(false);
and
parentFrame.setEnabled(true);
0
 

Author Comment

by:RdeLange
ID: 8012248
Yes, thats seems logic to me. I tried this but I see that my data on the first screen doesn't contain the updated data from the second screen.

How can I update that data?
0
 
LVL 18

Accepted Solution

by:
bobbit31 earned 150 total points
ID: 8012626
set it back to enabled before updating
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses
Course of the Month12 days, 19 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question