Public class test {
Public void caseanimal (string animal ){
Unerline temp = unerline. getsunerline (animal );
Switch (temp ){
Case is not underlined:
System. Out. println ("No underline ");
Break;
Case single line:
System. Out. println ("single line ");
Break;
Case dual line:
System. Out. println ("double line ");
Break;
}
}
Public Enum unerline {
No underline, single line, double line, dot line, line, long line, dot line, double line, short line, Wave Line, double line, bold, dot line bold, dash bold, long line bold, bold, bold, and wavy;
Public static unerline getsunerline (string unerline ){
Return valueof (unerline. tolowercase ());
}
}
/**
* @ Param ARGs
*/
Public static void main (string [] ARGs ){
Test client = new test ();
Client. caseanimal ("single line ");
}
}
In fact, this is just a code snippet. In the UI, there is such a combox with no underline, single line, dual line, dot line, dashes, long lines, dot lines, and double-dot lines, short, wavy, double, bold, Dot, bold, long, bold, bold, double, bold, different options need to be used as an interface parameter. In this case, enumeration can be used to complete such a task. You can use it flexibly.