locking a pc using keyEvents [duplicate] - java

This question already has answers here:
Cannot press Window+L using robot in Java
(3 answers)
Closed 9 years ago.
I want to lock my pc when my java application runs, so I used Robot class to implement a combination of two keys: windows logo key + L. But it didn't work!
here is my code:
Robot a=new Robot();
a.keyPress(KeyEvent.VK_WINDOWS);
a.keyPress(KeyEvent.VK_L);
Can anyone help me please?

You can use this code snippet in your listener class to lock screen in windows machines.
Runtime.getRuntime().exec("rundll32.exe user32.dll, LockWorkStation");

Related

How to access keyboard running on any other software in java? [duplicate]

This question already has answers here:
Java System-Wide Keyboard Shortcut
(7 answers)
How to capture global key presses in java
(2 answers)
How would I change this JNA Hook to listen to a specific key versus all keys?
(1 answer)
Closed 9 days ago.
How can I add keyboard listener which is focus on any other software (in java)? I want to make a program that can play any game (for abstract game) itself, for that I will store these keyboard data and save it. After that my program will be able to play the game itself (using Robot class).
I had created a window that can store these keyboard values, but the window that I created and game cannot be focus on keyboard at the same time.

How to create this layer on my app to teach users? [duplicate]

This question already has answers here:
How do I create the semi-transparent grey tutorial overlay in Android?
(5 answers)
Closed 7 years ago.
I want create layer like below to teach users if you click on some position you can use some service.sorry I don't know what is it that I search on the web
Easily achieved with ShowcaseView: https://github.com/amlcurran/ShowcaseView

Is there a way to tell if a JFrame is "Maximised" (MS Windows) [duplicate]

This question already has answers here:
JFrame in full screen Java
(14 answers)
Closed 9 years ago.
I've been Java applications on OS X, and haven't had the opportunity to fully test in different places.
There are 2 different JFrames. The second is loaded exactly in place of the first one, and as such needs to have its size and location set to the same as the first.
This works fine, but I noticed a lot of Windows users seem to maximise the first window. When the second JFrame loads, it has the same size, but is not "maximised".
Maximised windows in the MS Windows world have a slightly different state and are treated differently by the OS.
How can I tell if a JFrame is Maximised, and how can I maximise one myself?
frame.setExtendedState( f.getExtendedState()|JFrame.MAXIMIZED_BOTH );

Java tile map loader [duplicate]

This question already has an answer here:
Closed 11 years ago.
Possible Duplicate:
Android custom control to display map tiles
I'm new with java and I'm wondering. How would I make a tile map loader in it? Can someone point me in the right direction with tutorials or something please? Thanks!
I assume you mean you want to create a slippy map application with Android. I'm not aware of any tutorials in this area. But there are plenty of open-source projects you can learn from here. Here's a simple one you can start with: MapDroid.

What simple Eclipse tricks do you know? [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Hidden features of Eclipse
I've just discovered that if you type sysout then hold ctrl and press space it changes to System.out.println()
you can also indent the code properly.
select the code you want to format and press ctrl +shift+ 'F'
this will indent your data properly.

Categories