简体   繁体   中英

split time java (gui) and display

Sample code:

sx = new String(""+hours+"           "+min+ "         "+sec+"."+b.format(mil));
lbl.setText(sx);

Then when I make method:

public void split(){
String[] r= s.split(" ");
System.out.println(r);
{
button private void sp1ActionPerformed(java.awt.event.ActionEvent evt) {
  usedwatch1.split();        
}

But it gave me wrong answer. I want to get the split time when I click to the button split.

use this code

sx = new String(""+hours+";"+min+ ";"+sec+"."+b.format(mil));
String s[]=sx.split(";");
for(int i=0;i<s.length;i++) 
    System.out.println(s[i]);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM