java - JFrame size, resize, fullscreen -


my question have 3 parts.

  1. i know, how can set jframe window resizable, can not go under minim size user cant make smaller minimum size.
  2. i know, how can set jframe window resizable, still keep aspect ratio (16:9) if user resizing it.
  3. i know, how can make program become full screen after clicks button there no borders , runs game or (and if there specific issues how can revert safely).

thanks , patient not perfect english , not perfect java knowledge.

the provided answer useful , answers part of question, still of still blank me.

the part of code:

private void createdisplay() {     graphicsdevice gd = graphicsenvironment.getlocalgraphicsenvironment().getdefaultscreendevice();      frame = new jframe(title);                                              //setting title of window     frame.setsize(width, height);                                           //setting width , height of window     frame.setdefaultcloseoperation(jframe.exit_on_close);                   //make sure program closes down     frame.setresizable(true);     frame.setlocationrelativeto(null);                                      //the window apparel on center     frame.setvisible(true);     frame.seticonimage(assets.imagemap.get("icon"));      canvas = new canvas();     canvas.setpreferredsize(new dimension(width, height));     canvas.setmaximumsize(new dimension(width, height));     canvas.setminimumsize(new dimension(gd.getdisplaymode().getwidth() / 2, gd.getdisplaymode().getheight() / 2));     canvas.setfocusable(false);      frame.add(canvas);     frame.pack();                                                           //resize window little bit able see of canvas } 

  1. set frame's minimum size (setminimumsize)
  2. is more difficult, notified of size change after fact, you'll fighting system changes (and run problems generated size change event). might better focus on keeping ratio of contents of frame based on available space within frame (vlc example of this)
  3. full screen exclusive mode

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -