-1

I'm still very new to Java.
In C# we have the ability to just go and set the form border style like this:

this.FormBorderStyle = FormBorderStyle.None;

How can I accomplish this.

Aniket Kulkarni
  • 12,825
  • 9
  • 67
  • 90
Fred
  • 2,402
  • 4
  • 31
  • 58
  • what did you try? Imo `Frame`s have borders, `Window`s shouldn't. – Zhedar Jan 15 '13 at 14:16
  • Take a look at the answers to [this question](http://stackoverflow.com/questions/11992506/java-dialog-box). – Rob I Jan 15 '13 at 14:18
  • I couldnt try anything. searched the internet but nowhere to be found even an example or code. its not in the properties window, so I have no idea how to accomplish this. only in c# but now I need to do this in java...... – Fred Jan 15 '13 at 14:19

1 Answers1

3

You can use the JFrame method setUndecorated(true). Here is an example:

   import javax.swing.JFrame;
   import javax.swing.JLabel;

   public class Main {
     public static void main(String[] args) {
       JFrame frame = new JFrame("TitleLessJFrame");
       frame.getContentPane().add(new JLabel(" HEY!!!"));
       frame.setUndecorated(true);
       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       frame.setSize(400, 200);
       frame.setVisible(true);
     }
   }
monsur
  • 45,581
  • 16
  • 101
  • 95
GioLaq
  • 2,489
  • 21
  • 26
  • Yes, thanks, that does the trick! does it have to actually display the complete form first and then after like 10 milliseconds display the undecorated one? no way of changing that? but its ok like this thanks! – Fred Jan 15 '13 at 14:31
  • you can use frame.setUndecorated(true); immediately – GioLaq Jan 15 '13 at 14:47
  • Ohkay COOL, nice. Thank you – Fred Jan 15 '13 at 14:52