📄 sco.java~4~
字号:
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(); JLabel l1 = new JLabel(); /**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); l1.setText("100"); this.add(s1, new XYConstraints(90, 6, 200, -1)); this.add(l1, new XYConstraints(22, 6, 51, 19)); } /**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(200-v,200-v,2*v,2*v); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -