List of usage examples for java.awt Canvas setSize
public void setSize(int width, int height)
From source file:net.wurstclient.hooks.FrameHook.java
public static void createFrame(DefaultResourcePack mcDefaultResourcePack, Logger logger) throws LWJGLException { // check if frame should be created if (!isAutoMaximize() && !WurstBot.isEnabled()) return;/*from w ww . jav a 2 s . c o m*/ // create frame frame = new JFrame("Minecraft 1.8"); // add LWJGL Canvas canvas = new Canvas(); canvas.setBackground(new Color(16, 16, 16)); Display.setParent(canvas); Minecraft mc = Minecraft.getMinecraft(); canvas.setSize(mc.displayWidth, mc.displayHeight); frame.add(canvas); // configure frame frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setLocationRelativeTo(null); // add icons InputStream icon16 = null; InputStream icon32 = null; try { icon16 = mcDefaultResourcePack.func_152780_c(new ResourceLocation("icons/icon_16x16.png")); icon32 = mcDefaultResourcePack.func_152780_c(new ResourceLocation("icons/icon_32x32.png")); ArrayList<BufferedImage> icons = new ArrayList<>(); icons.add(ImageIO.read(icon16)); icons.add(ImageIO.read(icon32)); frame.setIconImages(icons); } catch (Exception e) { logger.error("Couldn't set icon", e); } finally { IOUtils.closeQuietly(icon16); IOUtils.closeQuietly(icon32); } // show frame if (!WurstBot.isEnabled()) frame.setVisible(true); }