扩展JPanel类的程序不访问方法plotComponent()这是JFramepackage client.connection;import java.awt.Dimension;import java.io.ObjectInputStream;import java.io.ObjectOutputStream;import javax.swing.JFrame;class DrawFrameRemoteControl extends JFrame{
private DrawPanelRemoteControl imagePanel;
private ClientRemoteControlConnection clientRemoteControlConnection;
private ObjectInputStream clientInputStream;
private ObjectOutputStream clientOutputStream;
private Dimension imageDimension;
private Dimension serverDimension;
public DrawFrameRemoteControl(Dimension imageDimension,ClientRemoteControlConnection clientRemoteControlConnection,ObjectInputStream clientInputStream,ObjectOutputStream clientOutputStream,Dimension serverDimension)
{
super("Remote Desktop Control");
this.clientRemoteControlConnection=clientRemoteControlConnection;
this.clientInputStream=clientInputStream;
this.clientOutputStream=clientOutputStream;
this.imageDimension=imageDimension;
this.serverDimension=serverDimension;
imagePanel=new DrawPanelRemoteControl(imageDimension);
add(imagePanel);
setSize(imageDimension.width,imageDimension.height);
setResizable(false);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setVisible(true);
setLocationRelativeTo(null);
}
void drawNewImageGrayscale(byte[] array)
{
imagePanel.setNewImageGrayscale(array);
imagePanel.repaint();
}}我试过调试代码,尽管imagePanel.repaint()正在多次执行,程序永远不会到达paintComponent()方法DrawPanelRemoteControl班级,等级。有人能告诉我为什么会发生这种事吗?是否与imageDimension反对?补充资料:在……里面main()方法,aDrawFrameRemoteControl对象被创建,并且它的drawNewImageGrayscale(byte[] arr)方法正在从main()每一秒。
添加回答
举报
0/150
提交
取消