http://image.ohozaa.com/view/6fcjh
How to do this with Java Source code
I can merge that but i can not to connect that like this pictue
http://image.ohozaa.com/view/6fcjh
How to do this with Java Source code
I can merge that but i can not to connect that like this pictue
Put each image in an ImageIcon
, then each Icon
in a JLabel
, and then add both JLabels
to a JPanel
that uses GridLayout(2, 1)
(2 rows, 1 column).
Another approach would be to combine multiple Icons into a single Icon. See Compound Icon.
File path = new File("images");
BufferedImage image = ImageIO.read(new File(path, "1 (1).jpg"));
BufferedImage overlay = ImageIO.read(new File(path, "1 (2).jpg"));
int w = image.getWidth();
int h = image.getHeight()+ overlay.getHeight();
BufferedImage combined = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
Graphics g = combined.getGraphics();
g.drawImage(image, 0, 0, null);
g.drawImage(overlay, 0, image.getHeight(), null);
ImageIO.write(combined, "PNG", new File(path, "combined 2.png"));