Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to make the application fix on the desktop.

Posted on 2013-07-01
5
Medium Priority
?
241 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 1000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
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

971 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