为了账号安全,请及时绑定邮箱和手机立即绑定

扩展JPanel类的程序不访问方法plotComponent()

扩展JPanel类的程序不访问方法plotComponent()

隔江千里 2019-06-27 15:51:29
扩展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()每一秒。
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 346 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信