Solved

How to make the application fix on the desktop.

Posted on 2013-07-01
5
238 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
[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
  • 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
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 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…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

623 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