?
Solved

How to fix a window i.e Frame

Posted on 2013-06-20
5
Medium Priority
?
323 Views
Last Modified: 2013-06-21
I have a Frame where there are 3 buttons.
When i click on Button 1, Frame1 get opened.
and similarly on other buttons.

How to lock Frame1 so that the user is not able to get into the other frames. As he may shift between windows.
or how to lock the current window or frame.
0
Comment
Question by:searchsanjaysharma
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 16

Expert Comment

by:krakatoa
ID: 39261869
You'll probably have to implement an event listener, so when the frame gets the focus, you can neuter it.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 39261919
Generally speaking, there should only be one Frame/JFrame per application. Additional windows should usually be dialog types. If you make your additional windows extend JDialog instead, set them to modal, and they won't be able to open more than one at a time
http://docs.oracle.com/javase/6/docs/api/java/awt/Dialog.html#setModal(boolean)
0
 
LVL 16

Accepted Solution

by:
krakatoa earned 1000 total points
ID: 39262244
What you can also consider is adding :

f.setFocusableWindowState(false);

Open in new window


where f is the JFrame instance of course.
0
 

Author Closing Comment

by:searchsanjaysharma
ID: 39265059
tx
0
 
LVL 16

Expert Comment

by:krakatoa
ID: 39265270
Ok - not a great solution at all mine, as you know. And as CEHJ said, and I forgot to say, the best way is to use Dialogs for more modal flexibility. If it's not too late, you should consider that.
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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month9 days, 8 hours left to enroll

762 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