RandomGuy32

setPreferredSize

Sep 13th, 2015
195
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         JFrame gameFrame = new JFrame("PlaceholderName v" + version);
  2.         GameCanvas gameCanvas = new GameCanvas();
  3.        
  4.         JFrame paletteFrame = new JFrame("Tiles");
  5.         PaletteCanvas paletteCanvas = new PaletteCanvas(256, 256);
  6.        
  7.         gameFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  8.        
  9.         gameFrame.getContentPane().add(gameCanvas);
  10.         gameFrame.setResizable(true);
  11.         gameCanvas.setPreferredSize(new Dimension(Game.innerWidth, Game.innerHeight));
  12.         gameFrame.setResizable(false);
  13.         gameFrame.pack();
  14.         gameFrame.setLocation(10, 10);
  15.         gameFrame.setVisible(true);
  16.        
  17.         paletteFrame.getContentPane().add(paletteCanvas);
  18.         paletteFrame.setResizable(true);
  19.         paletteCanvas.setPreferredSize(new Dimension(256, 256));
  20.         paletteFrame.setResizable(false);
  21.         paletteFrame.pack();
  22.         paletteFrame.setLocation(30 + Game.innerWidth, 10);
  23.         paletteFrame.setVisible(true);
  24.  
  25. /*
  26. Game.innerWidth == 896
  27. Game.innerHeight == 512
  28.  
  29. gameCanvas:
  30.     Breite: 896
  31.     Höhe: 512
  32.  
  33. paletteCanvas:
  34.     Breite: 266
  35.     Höhe: 266
  36. */
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×