Full screen mode in java application - java

I would like to make an app that have a button that make the app full screen when clicked and then change to normal when the button is clicked second time. The JDK is 1.7 and I know it support application in full screen mode. I tried in many ways but not succeed. Please, is there someone who could help me?
EDIT1: I would like to make my app enter and exit "Video Mode Fullscreen". I cannot enter fullscreen on runtime as changing setUndecorated to true on runtime has no effect on appearance.

One way to do this is to use the setExtendedState and to set it to MAXIMIZED_BOTH as described in this question. It also shows another method to put your Swing Application in real "Video-Mode Fullscreen", if thats what you need.

Related

Dark mode/Splash activity follows the system . Android Studio

I'm developing an app. I have implemented dark mode by creating colors-night file , using a switch and appCompatDelegate. I have written some code so that the app doesn't follow the system when phone's dark mode is on . And it works properly. Yet, the Splash screen does not obey and appears dark-colored when phone's dark mode is on(while the app continues light). I know this happens because the system reads the night resources before launching. (I figured it out since disabling dark mode in the onCreate method in SpashActivity or in Application does not work(and did some research) ). Adding "forceDark = false" on xmls doesnt work either. Does anyone know how to fix this?
I know it would be better to leave it this way since it is user's preference but i want on the first use, the user to see my company's colors and logo and then, choose the dark theme. Which, i also cant find how to change. I mean change dynamically splash activity's color depending on the sharedPreferences. (as i said before, doesnt work).
Thank you in advance :slight_smile:

Eclipse runs javafx program with weird settings / weird screen / or misalignment

On two different laptops, when I run my javafx application on eclipse-- the background and objects that is loaded onto the screen is not where they are suppose to be positioned. For example, the ImageView background is supposed to be centered and fill the screen, but instead it appears immediately to the bottom-right. Only when I resize the screen (doesn't matter how big) but the background and objects automatically reposition themselves where they should be. I believe a possible cause is my eclipse settings, except they're all defaulted. I don't think it's something wrong with my code, because when I run the same code, the same program on a different desktop and on another laptop, everything appears as it should. I tried changing my screen resolution but that has no effect. I also tried changing using css to set and position my background but same results.
Has anyone had a similar problem or have any suggestions to fix this?
Please help! Thank you.

Set pass code for an android application in android studio

I am working on a application , it is having an pass code screen with 4 digits. How to set pass code like that screen and when I open the app I need to show the pass code screen in order to open the application.
Thank you.
first you need to google out something before you ask any question..any way this may help you JUST START your THOUGHT.
How can i set up screen lock with a password programmatically?

Colored buttons don't show up when jGRASP is run on mac?

i'm not sure if I'm allowed to ask questions not explicitly regarding code on StackOverflow, but I currently have a java program involving colored buttons. At school, when I run it on a computer that isn't a Mac, jGRASP shows the colors and runs perfectly fine, but on my personal Macbook, the buttons are white and turn grey when clicked, regardless of what I set the color to. So I know it can't be my code, unless there's a special method especially for Macs, which is doubtful. Is this a problem with all Macs? I'm using the
array[x].setForeground(Color.blue);
method to set everything. Any help would be greatly appreciated!
This may depend on the Look&Feel and Java version. In general, a component doesn't have to pay any attention to its foreground color.

Quitting Java program renders Mac OS X window switching non-functional

On the Mac where I do my programming, I have an app installed called BetterTouchTool that allows me to bind keyboard shortcuts to 'gestures' on my trackpad. I have bound a gesture (that doesn't have an Apple default) to the shortcut command+Q, which quits the active program. I have found this very convenient for quickly quitting programs that I am testing, so that I can get back to writing code.
However for the graphical game that I am programming, this action makes it so that I can't use a three finger swipe to switch between windows (several other gestures are also disabled). This will also happen if I go up to the menu and click quit or if I click the red x close button. The fix is to either restart my computer or (and this is really weird) to click the in-game close button which calls System.exit(0);. I know that most players will be using this but I still want to figure out why this is happening. In addition games like Minecraft on my computer don't do this.
I am using a JFrame with setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); in the code. In an attempt to fix the issue I have tried registering a com.apple.eawt.QuitHandler that calls System.exit(0); in the handler.
I have no idea what would be considered relevant code here, so whatever you would like to see, just let me know.
I figured it out. There was one rouge Thread.sleep() call in my JFrame that was somehow effecting my system.

Categories