Package displayables

Source Code of displayables.ListRootFiles

package displayables;

import java.io.IOException;
import java.util.Enumeration;

import javax.microedition.io.file.FileSystemRegistry;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.List;

public class ListRootFiles extends List {

  public ListRootFiles(String title){
    super(title, List.IMPLICIT);
    Enumeration drives = FileSystemRegistry.listRoots();
    Image driver = null;
    try {
      driver = Image.createImage("/drive-harddisk.png");
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    while (drives.hasMoreElements()) {
      String driveString = drives.nextElement().toString();
      if(driveString.length() <= 3)
      this.append(driveString, driver);
    }
  }
}
TOP

Related Classes of displayables.ListRootFiles

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.