?? tools.java
字號(hào):
package edu.sccp.chat.tools;
import java.awt.Color;
import java.awt.Font;
import javax.swing.JComponent;
public class Tools {
public static boolean checkMsg(String str,int minLength,int maxLength,boolean isDigit) {
if(isDigit){
char[] ch=str.toCharArray();
for(int i=0 ;i<ch.length;i++){
if(!Character.isDigit(ch[i])){
return false;
}
}
if(str.length()<=maxLength && str.length()>=minLength){
return true;
}else{
return false;
}
}else{
if(str.length()<=maxLength && str.length()>=minLength){
return true;
}else{
return false;
}
}
}
/*
* check length
*/
public static boolean checkLength(String str,int minLength,int maxLength){
boolean flag=false;
if(str.length()<=maxLength && str.length()>=minLength)
flag=true;
return flag;
}
/*
* Check the message whether or not is digit
*/
public static boolean isDigit(String str){
boolean flag=true;
char[] ch=str.toCharArray();
for(int i=0;i<ch.length;i++){
if(!Character.isDigit(ch[i]))
flag=false;
}
return flag;
}
/*
* Check the message whether or not in range.
*/
public static boolean inRange(String str,int min,int max){
boolean flag=false;
if(Tools.isDigit(str)){
int i=Integer.parseInt(str);
if(i>=min && i<=max){
flag=true;
}
}
return flag;
}
public static boolean inRange(String str,int min){
boolean flag=false;
if(Tools.isDigit(str)){
int i=Integer.parseInt(str);
if(i>=min){
flag=true;
}
}
return flag;
}
/*
* check message whether or not include char
*/
public static boolean includeChar(String str,char ch){
boolean flag=false;
char[] c=str.toCharArray();
for(int i=0;i<c.length;i++){
if(c[i]==ch)
flag=true;
}
return flag;
}
public static void setFormat(JComponent component){
Font font=new Font("新宋體",Font.PLAIN,12);
Color color=Color.red;
component.setFont(font);
component.setForeground(color);
}
public static void setFormat(JComponent component,Color color){
component.setForeground(color);
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -