slideshowinjavanetbeansIwanttoinserttimerinthefollowingcodesothattheimagescanautomaticallychangeaftersomeseconds
void initImage() {
String[] filesname = {"img1.png", "img2.png", "img3.png", "img4.png", "img5.png", "img6.png", "img7.png", "img8.png"};
for (String s : filesname) {
Icon icon = new ImageIcon("src/images/" + s);
JLabel label = new JLabel(icon);
imagepanel.add(label);
}
cardlayout = new CardLayout();
imagepanel.setLayout(cardlayout);
}
Comments
Post a Comment