Window resize event?

后端 未结 5 2050
星月不相逢
星月不相逢 2021-02-02 07:55

I\'m writing a simple painting program using java, and I want some method to be called whenever the JFrame component is resized. But I can\'t find any method like windowRes
5条回答
  •  时光取名叫无心
    2021-02-02 08:12

    An example with ComponentAdapter

    //Detect windows changes
    window.addComponentListener(new ComponentAdapter( ) {
      public void componentResized(ComponentEvent ev) {
       label.setText(ev.toString());
      }
    });
    

提交回复
热议问题