culzonez Posted April 14, 2020 Posted April 14, 2020 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.
Naked Posted April 14, 2020 Posted April 14, 2020 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){} }
Medusa Posted April 14, 2020 Posted April 14, 2020 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
Naked Posted April 14, 2020 Posted April 14, 2020 7 minutes ago, Medusa said: y u spooning him Sometimes a man needs to spoon another man. 1
Camaro Posted April 14, 2020 Posted April 14, 2020 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