Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/397.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法在Java中使用HashMap从BuffereImage渲染视频_Java_Jframe_Jwt_Bufferedimage_Gridbaglayout - Fatal编程技术网

无法在Java中使用HashMap从BuffereImage渲染视频

无法在Java中使用HashMap从BuffereImage渲染视频,java,jframe,jwt,bufferedimage,gridbaglayout,Java,Jframe,Jwt,Bufferedimage,Gridbaglayout,在我的项目中,我有一个类FramesUtil,它包含一组存储在HashMap中的帧- ConcurrentHashMap<Integer, Frame> frameMap 在迭代过程中,JFrame似乎没有在循环中使用新的BuffereImage进行更新 下面是我在Arbiter.java中的playVideo方法- public static void playVideo() { BufferedImage img; JFrame frame =

在我的项目中,我有一个类FramesUtil,它包含一组存储在HashMap中的帧-

    ConcurrentHashMap<Integer, Frame> frameMap
在迭代过程中,JFrame似乎没有在循环中使用新的BuffereImage进行更新

下面是我在Arbiter.java中的playVideo方法-

    public static void playVideo() {
    BufferedImage img;
    JFrame frame = new JFrame();
    GridBagLayout gLayout = new GridBagLayout();
    frame.getContentPane().setLayout(gLayout);
    JLabel lbIm1;
    for(int i=0; (img=FramesUtil.frameMap.get(i).bufferedImage)!=null; i++) {
        lbIm1 = new JLabel(new ImageIcon(img));
        GridBagConstraints c = new GridBagConstraints();
        c.fill = GridBagConstraints.HORIZONTAL;
        c.anchor = GridBagConstraints.CENTER;
        c.fill = GridBagConstraints.HORIZONTAL;
        c.gridx = 0;
        c.gridy = 1;
        System.out.println(lbIm1);
        frame.getContentPane().add(lbIm1, c);
        frame.pack();
        frame.setVisible(true);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

}
P.P.S.我已经尝试在for循环

中创建新的jFrand和GrdAgBayes实例,请看一看,我也会考虑一个可能通过
    public static void playVideo() {
    BufferedImage img;
    JFrame frame = new JFrame();
    GridBagLayout gLayout = new GridBagLayout();
    frame.getContentPane().setLayout(gLayout);
    JLabel lbIm1;
    for(int i=0; (img=FramesUtil.frameMap.get(i).bufferedImage)!=null; i++) {
        lbIm1 = new JLabel(new ImageIcon(img));
        GridBagConstraints c = new GridBagConstraints();
        c.fill = GridBagConstraints.HORIZONTAL;
        c.anchor = GridBagConstraints.CENTER;
        c.fill = GridBagConstraints.HORIZONTAL;
        c.gridx = 0;
        c.gridy = 1;
        System.out.println(lbIm1);
        frame.getContentPane().add(lbIm1, c);
        frame.pack();
        frame.setVisible(true);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

}