我一直收到一个似乎无法解决的错误。它出现在“showSlide(elementNum);”线。
public class SlideGUI extends JPanel{
fillSlide();
showSlide();
}
private class EventListener implements ActionListener{
public void actionPerformed(ActionEvent e){
if (e.getSource() == nextButton){
elementNum++;
if(elementNum == slides.length){
elementNum = 0; //make index number 0 (the first slide)
}
}
showSlide(elementNum);
}
}
public void fillSlide(){
slides[0] = new Slide("Halong Bay.jpg",new Color(49,57,74),"Halong Bay From Lookout Point");
slides[1] = new Slide("Minion.jpg",new Color(3,28,75),"Minion Balloon");
slides[2] = new Slide("Ice Cream.jpg",new Color(13,54,72),"Chocolate Ice Cream with Yoghurt and Coffee Jelly");
}
public void showSlide(){
imageLabel.setIcon(slides[elementNum].getImage());
captionLabel.setText(slides[elementNum].getCaption());
lowerPanel.setBackground(slides[elementNum].getColour());
upperPanel.setBackground(slides[elementNum].getColour());
moveOnPanel.setBackground(slides[elementNum].getColour());
moveBackPanel.setBackground(slides[elementNum].getColour());
picturePanel.setBackground(slides[elementNum].getColour());
}
}
答案 0 :(得分:0)
您使用参数调用showSlide()
,但您声明它没有参数。