I have an application which runs in fullscreen mode but I want to make it so when the user presses Alt-Tab, Windows key + Tab or Ctrl+Alt+Delete, nothing happens.
I have tried doing requestFocus() every frame so if the user tabs out, it tabs back in but it doesn't do anything. Also JFrame.setAlwaysOnTop() doesn't make it always on top if the user tabs out. So how would I prevent the user from tabbing out?
Thanks.
It's possible to disable some key combinations - is it is possible to disable the windows keys using java
But, you cannot disable or override alt+ctrl+delete.
You shouldn't generally disable these key combinations though even if you can. If a user wants to alt+tab, let them. Otherwise you'll have some angry and fleeting users.
Related
I built a Swing application that works with an MSAccess database. I have various buttons to click when clicked--they will disconnect and unlock the database.
Sadly, this is only in a perfect world where users will actually use those buttons and not the little red "x" on the upper right. When some users click that, the database stays locked with a file extension '.ldb' for those of you unfamiliar with MSAccess.
I need to avoid that. Is there any function that I can implement? Like a timeout? I looked up the
DriverManager.setLoginTimeout(10);
method, but that seems to be for login attempts. Is there something for my criteria?
Thanks.
PS: Sadly, i can't use any other database.
Sadly, this is only in a perfect world where users will actually use those buttons and not the little red "x" on the upper right.
See Closing an Application. You can create an Action that can be invoked when you use a button, menu item or when the user clicks on the "X" (close) button.
Simply configure what happens when the "x" is pressed using a WindowListener.
This is done easily using two methods for the JFrame (frame, in the examples below) that displays everything:
1. frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); // by default pressing the "x" will do nothing.
2. frame.addWindowListener(new WindowAdapter() { // However, when the "x" is pressed...
public void windowClosing(WindowEvent e) { // this method is called,
... // and you write the body here to allow your program to respond appropriately
}
});
Eventually you'll want to call frame.dispose() to finally close the window.
You can implement additional methods in the body of theWindowAdapter inner class to respond to different window events... see the WindowAdapter interface for methods that can be implemented.
1- The KB5002099 patch deployed in Client computers recently, introduce a bug as a side effect of a security fix.
Here in the link is the description of this patch -> https://support.microsoft.com/en-us/topic/description-of-the-security-update-for-office-2016-december-14-2021-kb5002099-10670400-427f-4819-8de6-abd11e73100b
Inside this description, you will find the Know issue of this update, and the solution (KB4484211) How to get and install the update
Databases on network share can't be accessed by multiple users in Office 2016 (KB4484211) (microsoft.com)
2- Select download update for Office 2016, This update is available only for manual download and installation from the Microsoft Download Center.
https://support.microsoft.com/en-us/topic/databases-on-network-share-can-t-be-accessed-by-multiple-users-in-office-2016-kb4484211-88a51f7f-f7dd-2d9c-0b96-b7fca0867a4f
I don't always want it up, I'm on a laptop screen so it'd be nice to have the vertical screen real estate for the code, and then to enable the console only when I want it. I know I can toggle it on, but it only seems to work for toggling it on, triggering the shortcut again won't hide it.
You could bind the Minimize Active View or Editor command in Preferences > General > Keys to any key combination you want, and if you do it the Console, it will minimize it. However when you do this, it will minimize all the views that share docking space with the Console. You can bring it up again with Alt+Shift+Q,C but this will show the Console as a floating view, it won't maximize the dock to it's original position. Hit Esc in this floating Console and it will go away.
If you can live with this, then it's probably OK.
Another way would be to maximize the Code view with Ctrl+M, in case you want to focus just on the code.
You can define different perspectives for that purpose.
See How To Add Perspectives In Eclipse
You can add or edit existing shortcuts in Preferences > General > Keys (or press Ctrl+3, type Keys and select)... type in console to filter out all the irrelevant shortcuts.
Here's an article with more details, and a video :)
http://eclipse.dzone.com/articles/how-manage-keyboard-shortcuts
My company uses a web-based application that has long forms that the user fills out. Some of these forms save as you go (so that you can close the window and come back to it), but others can only be saved when they're completely filled out. We receive daily calls from users who "accidentally" clicked the close button on their IE window. Don't ask me how this happens, but the calls are constant since the system was implemented. I've been tasked with finding a solution.
I was initially asked if there was a way to remove the X entirely, but I don't think there is. So my idea is to somehow provide a prompt for users when they click the X, reminding them that their work may not be saved, or at the very least confirming that they want to close the window. Since I can't modify the application website in any way, I'd embed it in an HTML file that included code for detecting when the window was about to close. My questions are:
Is this possible?
How would I do this?
Is there a better way?
By the way, I'm an application developer so I understand programming concepts, but I've never, ever done any web development.
Thanks in advance!
You can prompt the user by returning a string from your onBeforeUnload event handler. The browser will add its own message before and after the string you return as well as place the "OK" and "Cancel" buttons.
window.addEventListener('beforeunload',
function() {
return 'Are you sure you want to close this window with unsaved changes?';
},
false);
You won't have any way of knowing if the user cancelled but this will prompt them to confirm that they want to close the window.
I think you're looking for this: http://msdn.microsoft.com/en-us/library/ms536907%28VS.85%29.aspx
function closeIt()
{
return "Any string value here forces a dialog box to \n" +
"appear before closing the window.";
}
window.onbeforeunload = closeIt;
See also: https://developer.mozilla.org/en/DOM/window.onbeforeunload
I writing an application which controls another application by using the keyboard only. To more concrete, the application simulates key presses and mouse clicks when a certain key is pressed on the keyboard. For example, pressing on the 'x' key simulates a mouse click on the [X] in the rop right corner, followed by a little sleep of 2 seconds and an 'enter' to confirm the exit dialog. Pretty easy. I am developing this application in Java.
Sending a key press or a mouse click is very easy with java.awt.Robot. I am facing one little problem. Say I have configured a key which will click somewhere on the screen. The problem is that consecutive key presses aren't catched anymore, as my application lost its focus caused by the mouse click outside it's window.
My question now is: what is the best way to be sure that my main application keeps the focus? Is there a way to focus my application again after the key presses and mouse clicks are sent out? Is there a better way?
Thanks in advance.
If your application lost the focus. because you or your Robot clicked to somwhere else, the Robot must click on the application again before sending a new key. In c/c++ you could force the focus to the application (a non-trivial task), not in Java!
You might want to take a look at Component.requestFocus() to see if can do what you want.
Be aware however that window focusing has very platform dependent behaviour, so you will probably need to do quite a bit of testing to ensure that your code does what you want in all circumstances.
I managed a way to prevent applications from losing all focus in Java.
By placing a WindowFocusListener on the frame (or dialog) and calling setVisible(false) followed by setVisible(true) in windowLostFocus the component will re-appear as soon as it is dissapears (not the prettiest solution but it does work).
By then calling component.requestFocus() your robot should be able to continue where it left off
Is it possible to press keypad programmatically so that number for the key pressed shows on the screen? See the screenshot below for more explanation please:
Details:
Nokia N70
CLDC 1.1
MIDP 2.0
How you approach it will depend on what you want to achieve.
You can quite easily simulate pressing keys on a Canvas, by calling your Canvas's keyPressed(), keyReleased() and keyRepeated() methods directly.
This could be good for testing a canvas-based game, ensuring a given state is entered when certain keys are pressed on the canvas.
However, this won't allow you to control any form-based interaction, or native prompts. So you can't start the MIDlet, navigate through a LCDUI Form or List, accept a native security prompt, or edit a native TextBox. You'd need to use an emulator and some form of test scripting framework which simulates keypresses, such as Eggplant.
if you want to mimicking the keypressed process, just call the keypressed with the int of key as argument, for example keyPressed(-8);
Or are you trying to display the key number in the screen ?