April 14, 20205 yr How do I import an image into the code? I have no clue how to... If you just say import into Onpaint etc im not gonna understand Please if you can answer in code. I want to import just a black image ontop of the chatbox.
April 14, 20205 yr private final String PAINT_URL = "https://i.imgur.com/something.png"; private BufferedImage PAINT_IMAGE = null; @Override public void onPaint(Graphics2D g) { g.drawImage(PAINT_IMAGE,0,337,null); } public void loadImage(){ try { URL url = new URL(PAINT_URL); PAINT_IMAGE = ImageIO.read(url); }catch(Exception e){} }
April 14, 20205 yr 28 minutes ago, Naked said: private final String PAINT_URL = "https://i.imgur.com/something.png"; private BufferedImage PAINT_IMAGE = null; @Override public void onPaint(Graphics2D g) { g.drawImage(PAINT_IMAGE,0,337,null); } public void loadImage(){ try { URL url = new URL(PAINT_URL); PAINT_IMAGE = ImageIO.read(url); }catch(Exception e){} } y u spooning him
April 14, 20205 yr 7 minutes ago, Medusa said: y u spooning him Sometimes a man needs to spoon another man.
April 14, 20205 yr You can do g.fillRect(int x, int y, int width, int height) if you just want to place a black rectangle, where x, y are the coordinates of the upper-left corner of the chatbox
Create an account or sign in to comment