기본적으로 비디오에서 실시간으로 BufferedImages로 이미지를 추출하고 처리 후 JFrame에 표시합니다. 안타깝게도 나는 스윙이 매우 좋지 않아 이미지가 의도 한대로 JFrame에 표시되는 동안 모든 새로운 이미지 (초당 24 개)마다 새로운 JFrame이 생성됩니다.BufferedImage에 액세스하여 JFrame 구성 요소를 업데이트하십시오.
내가 가진 GUI로 BufferedImage의를 보내
public class UserInterface extends JFrame {
private JPanel contentPane;
public static void main(BufferedImage inputImage) throws IOException
{
UserInterface frame = new UserInterface(inputImage);
frame.setVisible(true);
}
public UserInterface(BufferedImage inputImage) throws IOException
{
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(50, 50, 1024, 768);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JLabel imageLabel = new JLabel(new ImageIcon(inputImage));
add(imageLabel);
imageLabel.setBounds(11, 60, 480, 360);
contentPane.add(imageLabel);
}
: 그들은 본질적으로 JFrame의 내부 JPanel의 내부 현재 이미지를 포함하는 JLabel의 내 GUI 클래스에 의해 수신
UserInterface.main(currentFrame);
누구나이 문제를 해결하여 모든 이미지를 동적으로 표시 할 수있는 JFrame이 1 개만 표시되도록 조언 할 수 있습니까?
'contentPane.setLayout (null);'Java GUI는 다른 OS, 화면 크기, 화면 해상도 등에서 작동해야합니다. 따라서 픽셀 완전 레이아웃에 도움이되지 않습니다. 대신 레이아웃 관리자 또는 [조합] (http://stackoverflow.com/a/5630271/418556)과 [공백] 레이아웃 채우기 및 테두리 (http://stackoverflow.com/a/17874718/)를 사용하십시오. 418556). –