I’m having a hard time trying to make a Java program with just a shape (e.g rectangle) as main window. I don’t want the shape to be inside the ‘OS-window’ (with buttons to close and minimize etc..)
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I don’t know if you can draw directly on the screen in Java (I tend to think you can’t). But you could create a
JDialog(which doesn’t appear in the taskbar) and callsetUndecorated(true)on it (to get rid of the title bar). Then you can do whatever custom painting you want with it.Edit: kts points out that
JWindowwill work even better for this purpose. From the Javadocs:And there’s even a no-argument constructor, so you don’t have to worry about passing in a
nullowner!