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

📄 sco.java~8~

📁 用java编写的画长方形的程序
💻 JAVA~8~
字号:
package sco;import java.awt.*;import java.awt.event.*;import java.applet.*;import javax.swing.*;import com.borland.jbcl.layout.*;public class sco extends Applet {  int v;  boolean isStandalone = false;  JScrollBar s1 = new JScrollBar();  XYLayout xYLayout1 = new XYLayout();  /**Get a parameter value*/  public String getParameter(String key, String def) {    return isStandalone ? System.getProperty(key, def) :      (getParameter(key) != null ? getParameter(key) : def);  }  /**Construct the applet*/  public sco() {  }  /**Initialize the applet*/  public void init() {    try {      jbInit();    }    catch(Exception e) {      e.printStackTrace();    }  }  /**Component initialization*/  private void jbInit() throws Exception {    s1.setOrientation(JScrollBar.HORIZONTAL);    s1.setValue(50);    s1.setRequestFocusEnabled(true);    s1.addAdjustmentListener(new java.awt.event.AdjustmentListener() {      public void adjustmentValueChanged(AdjustmentEvent e) {        s1_adjustmentValueChanged(e);      }    });    this.setLayout(xYLayout1);    this.add(s1, new XYConstraints(60, 7, 200, -1));  }  /**Get Applet information*/  public String getAppletInfo() {    return "Applet Information";  }  /**Get parameter info*/  public String[][] getParameterInfo() {    return null;  }  void s1_adjustmentValueChanged(AdjustmentEvent e) {    v=e.getValue();    s1.setValue(v);    l1.setText(String.valueOf(v));    repaint();  } public void paint(Graphics g){   g.drawRect(150-v,150-v,2*v,2*v); } public void update(Graphics g){    g.clearRect(0,50,300,200);    paint(g); } }

⌨️ 快捷键说明

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