📄 switch.java
字号:
package joeh.asciidraw;
import java.awt.*;
import java.applet.*;
import java.util.*;
import java.io.*;
public class Switch extends Object {
//store the color and the character representation of it.
//For ASCII text switches, the color will be white
//but their is a character in myChar.
//Note that a blank is white and " "!
String myChar = " "; //default
Color myColor = Color.white; //default
boolean reallyShowFlag = false; //and print the actual char on the screen too
public Switch(boolean t, String x, Color c) {
myColor = new Color(c.getRGB());
String myChar = new String(x);
reallyShowFlag = t;
}
public void turnOff(){
myColor = Color.white;
myChar = " ";
}
public boolean isOn(){
//Means, do you have info besides white space?
return (!( (myColor.equals(Color.white))
&& ((myChar=="")||(myChar==" ")) ));
}
public String getChar(){
return myChar;
}
//set the char to print in the ascii form,
//boolean true = show on screen too yes/no
public void setChar(String x, boolean b) {
myChar = new String(x);
reallyShowFlag = b;
}
public boolean reallyShowChar() {
return reallyShowFlag;
}
public Color getColor(){
return myColor;
}
//as a convention, when something is set white, the char is " "
public void setColor(Color c) {
myColor = new Color(c.getRGB());
//If they are setting white
if (c.equals(Color.white))
turnOff();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -