【发布时间】:2014-09-07 13:52:06
【问题描述】:
谁能告诉我我的for loop 有什么问题?我一直在花费大量时间反复试验并在互联网上进行研究,但我仍然找不到解决方案。它一直说预期的标识符找不到符号。请帮忙谢谢!
package imageviewer;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Scanner;
import java.util.Vector;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
public class ImageViewer extends JPanel implements ActionListener {
JPanel bottomPanel;
JLabel imageLabel;
JButton previousBtn;
JButton nxtBtn;
ImageViewer()
{
imageLabel = new JLabel("Image Display");
imageLabel.setBackground(Color.WHITE);
imageLabel.setOpaque(true);
add(imageLabel);
previousBtn = new JButton("Previous");
previousBtn.addActionListener(this);
add(previousBtn);
nxtBtn = new JButton("Next");
nxtBtn.addActionListener(this);
add(nxtBtn);
}
String userInput = JOptionPane.showInputDialog("Please input name of first image file");
Scanner myScanner = new Scanner(userInput);
String fileDetail = myScanner.next();
String[] arr = fileDetail.split("\\.");
String fileName = arr[0].replaceAll("[0-9.]", "");
String fileNumber = arr[0].replaceAll("[^0-9]", "");
String fileFormat = arr[1];
int num = Integer.parseInt(fileNumber);
String totalImage = JOptionPane.showInputDialog("Please enter the number of images in total");
Scanner secondScanner = new Scanner(totalImage);
int numberInput = secondScanner.nextInt();
ImageIcon imageGraphic = new ImageIcon(fileName + fileNumber + "." + fileFormat);
Vector <String> imageDetail = new Vector <String>();
int total = (num + numberInput);
for(int i = num; i < total; i++)
{
}
public void actionPerformed(ActionEvent e)
{
}
}
【问题讨论】:
标签: java swing for-loop symbols