📄 scrollbar1.java
字号:
import java.awt.*;
public class Scrollbar1{
public static void main(String[] args) throws Exception{
Frame frame=new Frame("祸惑 父甸扁");
Panel pColor=new Panel();
Label lColor=new Label("0,0,0");
pColor.setBackground(new Color(0,0,0));
Scrollbar sRed=new Scrollbar(Scrollbar.HORIZONTAL,0,1,0,256);
Scrollbar sGreen=new Scrollbar(Scrollbar.HORIZONTAL,0,1,0,256);
Scrollbar sBlue=new Scrollbar(Scrollbar.HORIZONTAL,0,1,0,256);
frame.setLayout(new GridLayout(5,1));
frame.add(pColor);
frame.add(lColor);
frame.add(sRed);
frame.add(sGreen);
frame.add(sBlue);
frame.pack();
frame.setVisible(true);
Color col;
int nRed, nGreen, nBlue;
while(true){
nRed=sRed.getValue();
nGreen=sGreen.getValue();
nBlue=sBlue.getValue();
col=new Color(nRed,nGreen,nBlue);
pColor.setBackground(col);
lColor.setText(nRed + " , " + nGreen + " , " + nBlue);
Thread.sleep(100);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -