0

I want to hide the Windows taskbar with Java. How can I do this? My compiler is Eclipse with JDK 7. I have tried using setSize() to go to full resolution, but the taskbar goes in front of it.

InfiniTech
  • 13
  • 1
  • 2
  • 6
  • If you are using a `JWindow`, `yourWindow.setAlwaysOnTop(true)` should work – BackSlash Oct 17 '13 at 19:04
  • Do you mean that you want your app to be full screen, or do you want to literally modify the visibility of the Windows Taskbar? And to be clear, you mean the taskbar, the one at the bottom of the screen with your currently running programs and the start button, not the window bar, right? – Gray Oct 17 '13 at 19:07

3 Answers3

0

Java operates within the JVM. The Windows Taskbar is outside of JVM and tied to the machine's operating system.

In order to operate at that level, my guess would be to tie into the WinAPI's, but i have never tried this.

JNA might help.

ddavison
  • 28,221
  • 15
  • 85
  • 110
  • I don't think I agree with the way you phrased this. The taskbar is outside of the JVM, sure, but so are all sorts of things like File IO and that happens all the time. – Gray Oct 17 '13 at 19:12
  • @Gray Yes, but they are handled by the JVM. advanced functions like these have to be done with JNI/JNA – BackSlash Oct 17 '13 at 19:14
  • @BackSlash But if that counts as being handled by the JVM, doesn't that imply that anything you can do in Java, even if you use JNI/JNA is handled by the JVM? Not trying to be argumentative, I just found this wording very confusing. – Gray Oct 17 '13 at 19:20
  • @Gray AFAIK, No, because the JVM in that case is just _calling_ functions stored in the native libraries written with JNI/JNA. With JNI/JNA the JVM handles the _communication_ between java and the native libraries you written, not the _operations_ that the library does. – BackSlash Oct 17 '13 at 19:23
  • @BackSlash Not sure I fully understand the distinction, but I appreciate your explanation. I feel we may be getting off-topic here, so I will cede to your knowledge, since I am out of my element a bit with the inner-workings of Java. If you think the wording is clear, then that works for me. – Gray Oct 17 '13 at 19:39
0

Use Full-Screen Exclusive Mode. It is an API that:

..allows the programmer to suspend the windowing system so that drawing can be done directly to the screen.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
0

Yes, you can by using JNA, adopted from technet forums some help from a JNA FindWindow question and reading the JNA source code for Win32:

Warning: This isn't the same as auto-hide. To get it back, you'll need to invoke ShowWindow again, but with SW_SHOW.

private static int SW_HIDE = 0;
private static int SW_SHOW = 1;
public static void main(String... args) throws Exception {
    WinDef.HWND shellTray = User32.INSTANCE.FindWindow("Shell_TrayWnd", "");
    User32.INSTANCE.ShowWindow(shellTray, SW_HIDE);
}

See also: SHAppBarMessage and AutoHide

tresf
  • 7,103
  • 6
  • 40
  • 101