在我看来ArrayList,几乎在每个场景中都会更容易使用,它非常通用.是否存在String[]用于存储输入数据的实例?如果出现这种情况,必然存在缺陷ArrayList,会是什么?
只有想到了我的头顶部的事情将是各种String类似的方法,substring()和split()等.
编辑:StackOverflow的新手.如果这是重新发布,我道歉.并感谢格式化.
以下是我到目前为止的代码:所有导入都是正确的.我确定.:d
当我运行程序时,我得到的只是一个空白帧,没有图片.它应该出现.
public class WindowPractice extends JFrame {
final static int width= 800;
final static int height= 400;
int x;
int y;
Image steve;
Dimension gamesize= new Dimension (width, height);
public WindowPractice(){
setTitle ("Hangman");
setSize (gamesize);
setVisible (true);
setResizable (false);
setLocationRelativeTo (null);
setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
}
public static void main (String[] args) {
new WindowPractice();
ImageIcon steve= new ImageIcon ("Libraries/Pictures/ba190cd951302bcebdf216239e156a4.jpg");
JLabel imageLabel = new JLabel(steve);
}
public void paint(Graphics g){
g.setColor(Color.red);
//g.fillRect( x, y, 100, 20);
g.drawImage(steve, x, y,this);
x= 150; …Run Code Online (Sandbox Code Playgroud)