小编Miz*_*izu的帖子

存储在Arraylist或String数组中的输入?(新程序员)Java

在我看来ArrayList,几乎在每个场景中都会更容易使用,它非常通用.是否存在String[]用于存储输入数据的实例?如果出现这种情况,必然存在缺陷ArrayList,会是什么?

只有想到了我的头顶部的事情将是各种String类似的方法,substring()split()等.

编辑:StackOverflow的新手.如果这是重新发布,我道歉.并感谢格式化.

java arrays arraylist

6
推荐指数
1
解决办法
6532
查看次数

JFrame没有显示图片

以下是我到目前为止的代码:所有导入都是正确的.我确定.: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)

java swing jframe

2
推荐指数
1
解决办法
1559
查看次数

标签 统计

java ×2

arraylist ×1

arrays ×1

jframe ×1

swing ×1