Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 237
  • Last Modified:

What happen when a JFrame in a class is declared as static?

What complications if i m to declare this frame as static?
Is it a bad taste(bad programming) to declare a JFrame in a class as static.

Background information
---------------------------
If I had a class called, ReservationForm. In it, I declared a JFrame frame1 to setup a JFrame components with some the swing components.

The reason I declared the frame in ReservationForm class as static as I wanted to remove the frame1 ONLY after user has click on a submit button in another JFrame (call frame2).

What I did:
I wrote a method - public void close() in frame1. I can only dispose this frame1 when user click a submit button in frame2. Immediately after disposing frame1, it display the frame1 again with data in the JTable updated.

0
coffee_bean
Asked:
coffee_bean
1 Solution
 
sciuriwareCommented:
Not very much.
Usually a JFrame stands as long as the application.
If you want to drop it, put the static reference to null after you disposed of it.
So ,nothing special about a static reference.
<*>
0

Featured Post

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.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now