Solved

How to make the application fix on the desktop.

Posted on 2013-07-01
5
232 Views
Last Modified: 2013-07-18
I want to make my java based window form to appear in such a way so that it occupies whole window, and user is not able to minimize or close the application unless he enters his username and password.
0
Comment
Question by:searchsanjaysharma
  • 2
  • 2
5 Comments
 
LVL 35

Expert Comment

by:girionis
ID: 39292892
I am not sure if you can do this with Java, you can have a full screen application but the user would still be able to close the windows by pressing control + F4 for instance.

For a full screen windows you can use the full screen exclusive mode API, or set the preferred size to the size of the screen.

You can also set the default close operation (setDefaultCloseOperation) on the jframe to do nothing on close, so the user won't be able to close the windows on pressing the x button.
0
 
LVL 16

Accepted Solution

by:
Valeri earned 500 total points
ID: 39297379
As I told you in my previous answer the only way to do this with JFrame is to remove the three buttons
frame.setUndecorated(true);
that's the only way to avoid minimize and close! The app will be maximized by default.
So:
1. You can prevent "close" by Alt+F4 and by right click and select close with setDefaultCloseOperation and cancelation of close.
2. Switch to other applications by using "Alt+Tab" could be prevented with
frame.setAlwaysOnTop(true);
3. Maximaizing of the undecorated frame could be done by :
frame.setExtendedState(JFrame.MAXIMIZED_BOTH);

So, when the user enters username and password corectly you can close or iconify the app.
Hope it will help you, but you never listen to my comments. All of them are writen having in mind that you are writing app responsible to lock the PS's in Internet club or something like that...?! If it's not the case ignore my comment!

Here is the class:

import javax.swing.JFrame;
public class RemoveJFrameTitleBar {
      public static void main(String[]args){
            //Create a JFrame
            JFrame frame=new JFrame();
            //Method setUndecorated(true) will eliminate JFrame title bar
            frame.setUndecorated(true);
            frame.setAlwaysOnTop(true);
            frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
            frame.setVisible(true);            
      }
}
0
 
LVL 35

Expert Comment

by:girionis
ID: 39299675
I still believe you cannot do this with Java. The user will still be able to close it if (s)he starts the task manager. The closest you can get is what Valeri suggested.
0
 
LVL 16

Expert Comment

by:Valeri
ID: 39299821
ah, yes! girionis is right!
task manager also must be disabled before that, with administrator account.
see how:

http://www.windowsnetworking.com/kbase/WindowsTips/WindowsXP/UserTips/Customization/EnableDisableTaskManagerinWindowsXPHomePro.html

also valid for windows 7
0
 

Author Closing Comment

by:searchsanjaysharma
ID: 39336606
tx
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
The viewer will learn how to implement Singleton Design Pattern in Java.

912 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now