What's new

Closed Please help !! :'( about java basic lang to...

Status
Not open for further replies.

Princess Serrano

Eternal Poster
Joined
Apr 2, 2016
Posts
429
Reaction
285
Points
285
Gusto ko po mag clearscreen, gusto ko din mag timeout at gusto ko magkakulay yung text output ko sa cmd.

For example

class Sample{
public static void main ( String [] args ) {
//wait(1000);
System.out.println("Hello World!"); //color yellow
//cls or clear the
}
}
 
Pwede ka gumamit ng timertask para madelay ung call mo ng println.
Ex.
import java.util.Timer;
import java.util.TimerTask;

Timer myTimer;

void startTimer(int seconds){
myTimer = new Timer();
myTimer.schedule(new myTimerTask() , seconds*1000);
}

class myTimerTask extends TimerTask{
.public void run(){
// dito mo lagay method mo pag times up na.
myTimer.cancel();
}
}
Para maging yellow ung txt sa cosole mo gamit ka ng ANSI escape codes.
Ex.
public static final String RESET = "\u001B[0m";
public static final String YELLOW = "\u001B[33m";
Then
System.out.println(ANSI_RED + "This is YELLOW!" + ANSI_RESET);
Magpprint ng yellow yan kung supported ung terminal mo.
 
Status
Not open for further replies.

Similar threads

Back
Top