⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 debug15_4.java

📁 北京大学出版社的
💻 JAVA
字号:
package questions.c15;
import javax.swing.JPanel;
import java.awt.*;
public class Debug15_4 extends JPanel {
   private String ovalHeight = "25";
   private String ovalWidth = "50";
   private static final Point START = new Point( 20, 20 );
   public void setOvalHeight( String ovalHeight ) {
      try {
         listeners.fireVetoableChange( "ovalHeight",
                                       this.ovalHeight,
                                       ovalHeight );
         this.ovalHeight = ovalHeight;
      } catch ( PropertyVetoException pve ) {
         // change was vetoed, nothing to do
      }
   }
   public String getOvalHeight() {
      return ovalHeight;
   }
   public void setOvalWidth( String ovalWidth ) {
      try {
         listeners.fireVetoableChange( "ovalWidth",
                                       this.ovalWidth,
                                       ovalWidth );
         this.ovalWidth = ovalWidth;
      } catch ( PropertyVetoException pve ) {
         // change was vetoed, nothing to do
      }
   }
   public String getOvalWidth() {
      return ovalWidth;
   }
   public Dimension getPreferredSize() {
      return new Dimension( 100, 100 );
   }
   public void paintComponent( Graphics g ) {
      super.paintComponent( g );
      int h = Integer.parseInt( ovalHeight );
      int w = Integer.parseInt( ovalWidth );
      g.fillOval( START.x, START.y, w, h );
   }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -