jFrame

A JFrame is a little more than just a regular java app. You must extend and import a bunch of graphics classes included with JDK. To do this you need the following:

Here is a small list of JFrame variables and what they do:

  • SetSize(config_width, config_height); – changes the size of the window
  • setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); – I believe this adds the close button on the upper right corner.
  • setResizeable(true/false); – can you drag the window edges to resize it?
  • setAlwaysOnTop(true/false); – basically a “pin window” command, making it on top of everything else, even if it is out of focus.
  • setVisible(true/false); – is the window visible? It can exist, but it doesn’t have to actually work.
  • setLocation(windowX, windowY); – sets the initial position of the upper left-hand corner of the window with respect to the upper left-hand corner of the monitor (starting at (0,0)).

Leave a Reply

Your email address will not be published. Required fields are marked *