Display files

What's wrong with the following when it wont display a list of files
All I get is a blank page!
<HTML>
<head>
<script>
function dis()
</script>
</head>
<BODY>
<%@ page language="java" import="java.util.Date" %>
<%
java.io.File f=new java.io.File("c:\\objects");
String str[]=f.list();
out.println("we");
for(int k=0;k<str.length;k++)
out.println(str[k]+"<br>");
%>
</body>
</HTML>

Here you go...try this one.
<%@ page language="java" import="java.io.File, java.util.Date" %>
<HTML>
<head>
<script>
function dis()
</script>
</head>
<BODY>
<%
String dir = "c:\\dirx\\";
File f = new File(dir);
File files[]=f.listFiles();
for(int i=0;i<files.length;i++)
File x = files;
%>
<%=dir+x.getName()%><br>
<%
%>
</body>
</HTML>

Similar Messages

  • Idoc-xi-file scenario.  how to display file in html format

    I am not sure whether this is a valid question.........but want to confirm as it was asked by somebody
    In idoc-xi-file scenario.......  how to display file in html format ??
    Thanks in advance
    Kumar

    Hi Vijayakumar,
    Thanks for your reply !! You mean to say I got to use XSLT mapping and also .htm and .html extension together to produce the html file ?? or it is sufficient to use any one of them to produce the html file ??
    Regards
    Kumar

  • Error while displaying file " C:Temp Filename.Ext cannot be created"

    Dear Friends
    Some users face problem while display the file. They get message " C:\Temp\ Filename.Ext cannot be created ". I checked Details. I got explaination as follows.
    Caution! You are not authorized to work with temporary storage
    Message no. ED204
    Diagnosis
    You do not have authorization to read or write from or to the temporary storage.
    The system uses the temporary storage when you display or change programs using the ABAP Editor.
    The system checks to see whether there is a temporary version of the program.
    If there is, a dialog box appears in which you must choose whether to use the temporary version or the database version.
    The system fills the temporary storage when the editor crashes or you save a temporary version of the program.
    System Response
    You probably do not have the authorization object S_DATASET.
    Procedure
    Ask your system administrator to assign you the relevant authorization.*
    Actually this  problem never occurs frequently. User access the files very frequently creating around 200 Mb to 400 Mb in C:\Temp Folder per day per user. I observerd as per message that User is not have Access right to C drive. Once I get access from IT for that user he is able to display file. But before giving right he is able to display file. But suddenly he is not able to display. I am not getting exact reason why this problem occurs. Some users temp folder size is upto 700 Mb with no acces right to C Drive still he is able to see the image.
    In DC20 I have kept C:\Temp as path for temp folder.
    I have checked the links  also
    Request you to provide me
    What is exact reason of the error?
    Is the solution to problem is giving access rights to the user?
    Do I have to give authorization object S_DATASET to a user?
    With Regards
    Mangesh Pande

    Dear Amaresh
    Thanks for your reply and solution.
    So you mean to say thats this Authorization object  has to be provided to user?
    But my question is how the user was able to see the file even when this Authorization Object was not assigned.
    He was able to display all file. But for particular DIR he is not able to display.
    I have checked this thread
    http://wiki.sdn.sap.com/wiki/display/PLM/Error26172withSAPGUI710+patch13.
    User has SAP GUI 7.10
    File Version 7100.1.0.1027
    Build   0
    Patch Level  0
    Request your help
    With Warm Regards
    Mangesh Pande

  • Web.show_document cannot display file with Chinese char in IIS 6

    Dear all,
    There is a problem that web.show_document cannot display file with Chinese char in IIS 6, but works fine in IIS 5.
    Is it a server problem or is there any setting in server? Do you know how to solve it?
    Big Thanks
    JY

    Hi,
    As Francois mentioned, this issue has nothing to do with forms / web.show_document. web.show_document, just opens the URL specified as parameter. So, if you run the URL (that you've passed as argument for web.show_document), directly in the browser, you would be getting the same issue.
    So, as you said, if it works fine in IIS 5 and does not in IIS 6, it would be an issue with the IIS and not forms. You might want to check out the IIS 6 release notes / documentation for any known issues / raise an issue in that.
    -Arun

  • How do you display file type in PS Elements 10?

    How do you display file type in PS Elements 10 in the Organizer for each photo?
    I know you can right click and look at meta data.
    In PSE 7 it was displayed under each photo.

    Two things:
    1.  Set the View option to show file names:
    2.  Ensure your thumbnails are large enough to display the data:
    Ken

  • The Video app in OS7 update doesn't display file names.

    The Video app in OS7 doesn't display file names under the image.
    How can I identify my video files without having to open each file to access the file name.
    Is there something I am missing or is this just an omission in the OS7 upgrade.
    I am a music teacher and this lack of file names makes the app virtually useless for use in the classroom.

    Agreed. This has been a problem with TV Shows in the Videos app since forever, but at least it used to put the name under Movies. Now instead fixing it for TV Shows in iOS 7 they've done the opposite and made Movies fail the same way as TV Shows always have!
    Apparently it still lists the title for Home Videos, so the best work around for now is probably to reclassify all your Movies as Home Videos. Sigh.
    Apple's Videos app development team seem to be unaware that iTunes can store and play movies and TV shows that don't come from the iTunes Store, videos that don't have covers, and that need to display the names and other info from iTunes for them. They also seem to not understand that the default grid view for videos is totally inadequate for users with scores or hundreds of movies and TV shows that they home share to their iPads and iPhones from iTunes. The Videos app needs a list view at least, as well as a grid view.
    All they have to do is look at how the Apple TV handles the same files and meta-data from iTunes and provide something similar for the iPad and iPhone. Why after all these years they still don't get that I have no idea.

  • The Error doesn't display file on the SAP screen

    Dear experts!
    Now, I'm getting some Issues about displaying file on SAP Screen use 2D Viewer or 3D Viewer.
    - The first, I Created document for WBS.
    - Second, I want to display the file on SAP screen. But the system opened it's by an application on client.
    How do I have to do?
    Help me, please!
    Best regards, Huy

    Hi,
    As I understood you attached a file to WBSE and that file
    is not showing in the project structure.In standard it doesn't show
    in the project structure. With DMS & CAD (2D,3D viewer) integartion it is possible to
    display the document in SAP screen.
    If my understanding is wrong you can elaborate your post and do revert.
    Regards,

  • Display files in web browser

    Hi
    I need to be able to display files(doc, pdf, images etc) in the web browser. My purpose here is just to display the file. Can we do it using Linktourl?
    Thanks
    Jay

    Hi
      Check this thread. You will get the required info you need. If you require more clarifications let me know
    Re: Opening documents...
    Also check this thread
    Re: Display File residing on WAS
    Hope that was helpful
    regards
    ravi

  • Display Files with API in web-browser

    I'm trying to display display files (not reports).
    The download currently completes, but the file is blank.
    I am getting the file as an
    IInfoObject
    by:
    IInfoObject obj = TraversalLogic.getInstance().getInfoObject(iStore, Integer.parseInt(objIdStr), "SI_PROGID, SI_FILES");
    That being: com.crystaldecisions.client.logic.TraversalLogic
    Then trying to print it out with com.crystaldecisions.ePortfolio.plugin.crystalenterprise.content.ContentUtil by
    ContentUtil.displayContent(request, response, obj);
    It compiles, it runs, but then the output document is blank.  The user can see the objects in infoview.  What am I missing here?

    After abandoning ContextUtil and casting these as IContent objects and trying to use: getContent on them, I get the error starting:
    The exception originally thrown was: Server Input% not found or server may be down at com.crystaldecisions.sdk.occa.infostore.internal.g.a(Unknown Source)
    This lead to the following solution on page 89 of http://help.sap.com/businessobject/product_guides/crs2008V1/en/crs_08_v1_releasenotes_en.pdf:
    Solution:
    Users attempting to access a BusinessObjects Enterprise XI 3.0 system
    using BusinessObjects XI R2 SDK applications may receive the following
    system message: "Err: "Server Input% not found or server may be down".
    This is caused by a change to the formatting of File Repository Server (FRS)
    names between the two versions. To resolve this issue, go to the Central
    Configuration Manager and rename your Input FRS to Input.<host
    name>.fileserver and Output FRS to Output.<hostname>.fileserver.
    Making this change resolved the problem.

  • Displaying files in Reports6 (Oracle Reports Team) URGENT

    HELP! I cannot come up with a solution to this problem as yet and
    I am desperate.
    I have two different file formats
    format 1: 4 fields ==> Branch, Policy Number, Due Date, Amount
    length :43 characters.
    format 2: 8 fields ==> the above plus others
    length :73 characters.
    NB. This is the structure of two separate client files.
    Aim: To display the contents of the files to the client.
    What has been tried:
    1. Text_io.getline was used to read each record from file into
    fields on the screen(this is done within a procedure). In
    the Data Model view the company name was retrieved so that
    the appropriate format (format 1 or 2)could be chosen. In the
    layout model depending on the company the corresponding
    fields were displayed. However when the program was run only
    the last record in the file was displayed. How does one get
    Reports6 to show all the records that was read?
    2. The repeating frame concept does not apply as I simply want
    to display files read and even when a select was done where
    I know the values would be repeated this did not work - only
    the last line of the file was displayed.
    3. Again another dummy select was tried with the intent of
    using the 'Read From File' property. This did not apply in
    my situation. ( Or it could be that I do not understand how
    to use this).
    Any help that is forthcoming is greatly appreciated.
    Thanks in advance.

    hello,
    this request sounds now more as if you want to use the text-file
    as a datasource.
    unfortunatly this is not possible with reports 6i as the support
    for text-files as datasources will be introduced with the next
    (upcoming) release.
    regards,
    the oracle reports team --pw                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Preview doesn't display files.

    Hi all,
    Preview is not displaying files when I open them.  What happens is, when I click on the file to open it, the animation for opening the window will appear and there will be an outline of a window onscreen (a literal window) that I can resize and manipulate like I can do for a working one.  Preview just won't allow me to view the content, which is really unusual. 
    I've rebooted it in Safe Mode and found that it works then, but when I restart it, it will revert back to being unusable.
    Please help me, I'm a student and PDF files are vital to my studying!  Thank you
    Info:
    OS X Yosemite
    MacBook Air 2013 8GB RAM 512SSD
    Intel i7 Processor (1.7 GHz)

    1. This procedure is a diagnostic test. It changes nothing, for better or worse, and therefore will not, in itself, solve the problem. But with the aid of the test results, the solution may take a few minutes, instead of hours or days.
    Don't be put off by the complexity of these instructions. The process is much less complicated than the description. You do harder tasks with the computer all the time.
    2. If you don't already have a current backup, back up all data before doing anything else. The backup is necessary on general principle, not because of anything in the test procedure. Backup is always a must, and when you're having any kind of trouble with the computer, you may be at higher than usual risk of losing data, whether you follow these instructions or not.
    There are ways to back up a computer that isn't fully functional. Ask if you need guidance.
    3. Below are instructions to run a UNIX shell script, a type of program. As I wrote above, it changes nothing. It doesn't send or receive any data on the network. All it does is to generate a human-readable report on the state of the computer. That report goes nowhere unless you choose to share it. If you prefer, you can act on it yourself without disclosing the contents to me or anyone else.
    You should be wondering whether you can believe me, and whether it's safe to run a program at the behest of a stranger. In general, no, it's not safe and I don't encourage it.
    In this case, however, there are a couple of ways for you to decide whether the program is safe without having to trust me. First, you can read it. Unlike an application that you download and click to run, it's transparent, so anyone with the necessary skill can verify what it does.
    You may not be able to understand the script yourself. But variations of it have been posted on this website thousands of times over a period of years. The site is hosted by Apple, which does not allow it to be used to distribute harmful software. Any one of the millions of registered users could have read the script and raised the alarm if it was harmful. Then I would not be here now and you would not be reading this message.
    Nevertheless, if you can't satisfy yourself that these instructions are safe, don't follow them. Ask for other options.
    4. Here's a summary of what you need to do, if you choose to proceed:
    ☞ Copy a line of text in this window to the Clipboard.
    ☞ Paste into the window of another application.
    ☞ Wait for the test to run. It usually takes a few minutes.
    ☞ Paste the results, which will have been copied automatically, back into a reply on this page.
    The sequence is: copy, paste, wait, paste again. You don't need to copy a second time. Details follow.
    5. You may have started the computer in "safe" mode. Preferably, these steps should be taken in “normal” mode, under the conditions in which the problem is reproduced. If the system is now in safe mode and works well enough in normal mode to run the test, restart as usual. If you can only test in safe mode, do that.
    6. If you have more than one user, and the one affected by the problem is not an administrator, then please run the test twice: once while logged in as the affected user, and once as an administrator. The results may be different. The user that is created automatically on a new computer when you start it for the first time is an administrator. If you can't log in as an administrator, test as the affected user. Most personal Macs have only one user, and in that case this section doesn’t apply. Don't log in as root.
    7. The script is a single long line, all of which must be selected. You can accomplish this easily by triple-clicking anywhere in the line. The whole line will highlight, though you may not see all of it in the browser window, and you can then copy it. If you try to select the line by dragging across the part you can see, you won't get all of it.
    Triple-click anywhere in the line of text below on this page to select it:
    PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/libexec;clear;cd;p=(Software Hardware Memory Diagnostics Power FireWire Thunderbolt USB Bluetooth SerialATA Fonts 1000 25 5120 KiB/s 1024 85 \\b%% 20480 1 MB/s 25000 ports ' \*dropbox \*genieo\* \*GoogleDr\* \*k.AutoCAD\* \*k.Maya\* vidinst\* ' DYLD_INSERT_LIBRARIES\ DYLD_LIBRARY_PATH -86 "` route -n get default|awk '/e:/{print $2}' `" 25 N\\/A down up 102400 25600 recvfrom sendto CFBundleIdentifier 25 25 25 1000 MB 'com.adobe.AAM.Updater-1.0 com.adobe.AAM.Updater-1.0 com.adobe.AdobeCreativeCloud com.adobe.CS4ServiceManager com.adobe.CS5ServiceManager com.adobe.fpsaud com.adobe.SwitchBoard com.adobe.SwitchBoard com.apple.aelwriter com.apple.AirPortBaseStationAgent com.apple.FolderActions.enabled com.apple.installer.osmessagetracing com.apple.mrt.uiagent com.apple.ReportCrash.Self com.apple.rpmuxd com.apple.SafariNotificationAgent com.apple.usbmuxd com.citrixonline.GoToMeeting.G2MUpdate com.google.keystone.agent com.google.keystone.daemon com.microsoft.office.licensing.helper com.oracle.java.Helper-Tool com.oracle.java.JavaUpdateHelper com.oracle.java.JavaUpdateHelper org.macosforge.xquartz.privileged_startx org.macosforge.xquartz.privileged_startx org.macosforge.xquartz.startx' '879294308 4071182229 461455494 3627668074 1083382502 1274181950 1855907737 2758863019 1848501757 464843899 3694147963 1233118628 2456546649 2806998573 2778718105 2636415542 842973933 2051385900 3301885676 891055588 998894468 695903914 1443423563 4136085286 523110921 2883943871 3873345487' 51 5120 files 4 );N5=${#p[@]};p[N5]=` networksetup -listnetworkserviceorder|awk ' NR>1 { sub(/^\([0-9]+\) /,"");n=$0;getline;} $NF=="'${p[26]}')" { sub(/.$/,"",$NF);print n;exit;} ' `;f=('\n%s: %s\n' '\n%s\n\n%s\n' '\nRAM details\n%s\n' %s\ %s '%s\n-\t%s\n' );S0() { echo ' { q=$NF+0;$NF="";u=$(NF-1);$(NF-1)="";gsub(/^ +| +$/,"");if(q>='${p[$1]}') printf("%s (UID %s) is using %s '${p[$2]}'",$0,u,q);} ';};s=(' s/[0-9A-Za-z._]+@[0-9A-Za-z.]+\.[0-9A-Za-z]{2,4}/EMAIL/g;/faceb/s/(at\.)[^.]+/\1NAME/g;/\/Shared/!s/(\/Users\/)[^ /]+/\1USER/g;s/[-0-9A-Fa-f]{22,}/UUID/g;' ' s/^ +//;/de: S|[nst]:/p;' ' {sub(/^ +/,"")};/er:/;/y:/&&$2<'${p[46]} ' 1s/://;3,6d;/[my].+:/d;s/^ {4}//;H;${ g;s/\n$//;/s: (E[^m]|[^EO])|x([^08]|02[^F]|8[^0])/p;} ' ' 5h;6{ H;g;/P/!p;} ' ' ($1~/^Cy/&&$3>'${p[11]}')||($1~/^Cond/&&$2!~/^N/) ' ' /:$/{ N;/:.+:/d;s/ *://;b0'$'\n'' };/^ *(V.+ [0N]|Man).+ /{ s/ 0x.... //;s/[()]//g;s/(.+: )(.+)/ (\2)/;H;};$b0'$'\n'' d;:0'$'\n'' x;s/\n\n//;/Apple[ ,]|Genesy|Intel|SMSC/d;s/\n.*//;/\)$/p;' ' s/^.*C/C/;H;${ g;/No th|pms/!p;} ' '/= [^GO]/p' '{$1=""};1' ' /Of/!{ s/^.+is |\.//g;p;} ' ' $0&&!/ / { n++;print;} END { if(n<10) print "com.apple.";} ' ' { sub(/ :/,"");print|"tail -n'${p[12]}'";} ' ' NR==2&&$4<='${p[13]}' { print $4;} ' ' END { $2/=256;if($2>='${p[15]}') print int($2) } ' ' NR!=13{next};{sub(/[+-]$/,"",$NF)};'"`S0 21 22`" 'NR!=2{next}'"`S0 37 17`" ' NR!=5||$8!~/[RW]/{next};{ $(NF-1)=$1;$NF=int($NF/10000000);for(i=1;i<=3;i++){$i="";$(NF-1-i)="";};};'"`S0 19 20`" 's:^:/:p' '/\.kext\/(Contents\/)?Info\.plist$/p' 's/^.{52}(.+) <.+/\1/p' ' /Launch[AD].+\.plist$/ { n++;print;} END { if(n<200) print "/System/";} ' '/\.xpc\/(Contents\/)?Info\.plist$/p' ' NR>1&&!/0x|\.[0-9]+$|com\.apple\.launchctl\.(Aqua|Background|System)$/ { print $3;} ' ' /\.(framew|lproj)|\):/d;/plist:|:.+(Mach|scrip)/s/:.+//p ' '/^root$/p' ' !/^\/[AD]|\/Contents\/.+\/Contents\//&&/\/(Lib|usr).+\/(.+\.framework|Contents|Info\.plist|Resources|Versions)$/ { n++;sub(/\/Info\.plist$/,"");sub(/\/(Content|Resource|Version)s(\/.+)?/,"");print|"sort|uniq";} END { if(n<1100) print "/System/";} ' '/\.dylib$/p' ' /Temp|emac/{next};/(etc|Preferences|Launch[AD].+)\// { sub(".(/private)?","");n++;print;} END { split("'"${p[41]}"'",b);split("'"${p[42]}"'",c);for(i in b) print b[i]".plist\t"c[i];if(n<500) print "Launch";} ' ' /^\/(Ap|Dev|Inc|Prev)/d;p;' 's/Pr.+n //p' ' { gsub("^| |\n","\\|\\|kMDItem'${p[35]}'=");sub("^...."," ") };1 ' p '{print $3"\t"$1}' 's/\'$'\t''.+//p' 's/1/On/p' '/Prox.+: [^0]/p' '$2>'${p[43]}'{$2=$2-1;print}' ' BEGIN { i="'${p[26]}'";M1='${p[16]}';M2='${p[18]}';M3='${p[31]}';M4='${p[32]}';} !/^A/{next};/%/ { getline;if($5<M1) a="user "$2"%, system "$4"%";} /disk0/&&$4>M2 { b=$3" ops/s, "$4" blocks/s";} $2==i { if(c) { d=$3+$4+$5+$6;next;};if($4>M3||$6>M4) c=int($4/1024)" in, "int($6/1024)" out";} END { if(a) print "CPU: "a;if(b) print "I/O: "b;if(c) print "Net: "c" (KiB/s)";if(d) print "Net errors: "d" packets/s";} ' ' /r\[0\] /&&$NF!~/^1(0|72\.(1[6-9]|2[0-9]|3[0-1])|92\.168)\./ { print $NF;exit;} ' ' !/^T/ { printf "(static)";exit;} ' '/apsd|BKAg|OpenD/!s/:.+//p' ' (/k:/&& $3!~/(255\.){3}0/)||(/v6:/&&$2!~/A/) ' ' $1~"lR"&&$2<='${p[25]}';$1~"li"&&$3!~"wpa2";' ' BEGIN { FS=":";p="uniq -c|sed -E '"'s/ +\\([0-9]+\\)\\(.+\\)/\\\2 x\\\1/;s/x1$//'"'";} { n=split($3,a,".");sub(/_2[01].+/,"",$3);print $2" "$3" "a[n]$1|p;b=b$1;} END { close(p);if(b) print("\n\t* Code injection");} ' ' NR!=4{next} {$NF/=10240} '"`S0 27 14`" ' END { if($3~/[0-9]/)print$3;} ' ' BEGIN { L='${p[36]}';} !/^[[:space:]]*(#.*)?$/ { l++;if(l<=L) f=f"\n   "$0;} END { F=FILENAME;if(!F) exit;if(!f) f="\n   [N/A]";"cksum "F|getline C;split(C, A);C="checksum "A[1];"file -b "F|getline T;if(T~/^Apple b/) { f="";l=0;while("PlistBuddy -c Print "F|getline g) { l++;if(l<=L) f=f"\n   "g;};};if(T!~/^(AS.+ (En.+ )?text(, with v.+)?$|(Bo|PO).+ sh.+ text ex|XM)/) F=F" ("T", "C")";else F=F" ("C")";printf("\nContents of %s\n%s\n",F,f);if(l>L) printf("\n   ...and %s more line(s)\n",l-L);} ' ' s/^ ?n...://p;s/^ ?p...:/-'$'\t''/p;' 's/0/Off/p' ' END{print NR} ' ' /id: N|te: Y/{i++} END{print i} ' ' / / { print "'"${p[28]}"'";exit;};1;' '/ en/!s/\.//p' ' NR!=13{next};{sub(/[+-M]$/,"",$NF)};'"`S0 39 40`" ' $10~/\(L/&&$9!~"localhost" { sub(/.+:/,"",$9);print $1": "$9|"sort|uniq";} ' '/^ +r/s/.+"(.+)".+/\1/p' 's/(.+\.wdgt)\/(Contents\/)?Info\.plist$/\1/p' 's/^.+\/(.+)\.wdgt$/\1/p' ' /l: /{ /DVD/d;s/.+: //;b0'$'\n'' };/s: /{ /V/d;s/^ */- /;H;};$b0'$'\n'' d;:0'$'\n'' x;/APPLE [^:]+$/d;p;' ' /^find: /d;p;' "`S0 44 45`" ' BEGIN{FS="= "} /Path/{print $2} ' ' /^ *$/d;s/^ */   /;' ' s/^.+ |\(.+\)$//g;p ' '/\.(appex|pluginkit)\/Contents\/Info\.plist$/p' ' /2/{print "WARN"};/4/{print "CRITICAL"};' ' /EVHF|MACR|^s/d;s/^.+: //p;' ' $3~/^[1-9][0-9]{0,2}(\.[1-9][0-9]{0,2}){2}$/ { i++;n=n"\n"$1"\t"$3;} END { if(i>1) print n;} ' ' s/:[^:]+$//;s/ +([0-9]+)(.+)/\2 x\1/p;' ' { gsub(/[()"]/,"",$3);if(!$3) $3="N/A";print $3;} ' ' /es: ./{ s/^.+://;b0'$'\n'' };/^ +C.+ted: +[NY]/H;/:$/b0'$'\n'' d;:0'$'\n'' x;/: +N/d;s/\n.+//p;' );c1=(system_profiler pmset\ -g nvram fdesetup find syslog df vm_stat sar ps crontab iotop top pkgutil 'PlistBuddy 2>&1 -c "Print' whoami cksum kextstat launchctl smcDiagnose sysctl\ -n defaults\ read stat lsbom 'mdfind -onlyin /' ' for i in ${p[24]};do ${c1[18]} ${c2[27]} $i;done;' pluginkit scutil dtrace profiles sed\ -En awk /S*/*/P*/*/*/C*/*/airport networksetup mdutil lsof test osascript\ -e netstat mdls );S1() { printf kMDItemContentTypeTree=com.apple.$1'|sort';};S2() { printf 'L*/Ca*/com.ap*.Saf*/E*/* -d 1 -name In*t -exec '"${c1[14]}"' :'$1'" {} \;|uniq';};c2=(com.apple.loginwindow\ LoginHook '" /L*/P*/loginw*' "'tell app \"System Events\" to get properties of login items'|tr , \\\n" "`S2 CFBundleDisplayName`" '~ $TMPDIR.. \( -flags +sappnd,schg,uappnd,uchg -o ! -user $UID -o ! -perm -600 \)' '-F \$Message -k Sender kernel -k Message CSeq "I/O e"|sort|uniq -c' :${p[35]}\" :Label\" '{/,}L*/{Con,Pref}* -type f ! -size 0 -name *.plist -exec plutil -s {} \;' "-f'%N: %l' Desktop L*/Keyc*" therm sysload boot-args status " -F '\$Time \$(RefProc): \$Message' -k Sender Req 'fsev|kern|launchd' -k RefProc Rne 'Aq|WebK' -k Message Rne '08012|Goog|ksadm|probe|Roame|SMC:|smcD|sserti|suhel| VALI|ver-r|xpma' -k Message Req 'abn|bad |Beac|caug|corru|dead[^bl]|FAIL|fail|GPU |hfs: Ru|idle ex|inval|jnl:|last value [1-9]|NVDA\(|pagin|pci pa|proc: t|Roamed|rror|SL|TCON|Throttli|tim(ed? ?|ing )o|WARN' " '-du -n DEV -n EDEV 1 10' 'acrx -o comm,ruid,%cpu' '-t1 10 1' '-f -pfc /var/db/r*/com.apple.*.{BS,Bas,Es,J,OSXU,Rem,up}*.bom' '{/,}L*/Lo*/Diag* -type f -regex .\*[cght] ! -name .?\* ! -name \*ag \( -exec grep -lq "^Thread c" {} \; -exec printf \* \; -o -true \) -execdir stat -f:%Sc:%N -t%F {} \;|sort -t: -k2 |tail -n'${p[38]} '/S*/*/Ca*/*xpc* >&- ||echo No' '-L /{S*/,}L*/StartupItems -type f -exec file {} +' "`S1 bundle`" "`S1 mach-o-dylib`" `awk "${s[31]}"<<<${p[23]}` "/e*/{auto,{cron,fs}tab,hosts,{[lp],sy}*.conf,mach_i*/*,pam.d/*,ssh{,d}_config,*.local} {,/usr/local}/etc/periodic/*/* /L*/P*{,/*}/com.a*.{Bo,sec*.ap}*t {/S*/,/,}L*/Lau*/*t .launchd.conf" list getenv /Library/Preferences/com.apple.alf\ globalstate --proxy '-n get default' -I --dns -getdnsservers\ "${p[N5]}" -getinfo\ "${p[N5]}" -P -m\ / '' -n1 '-R -l1 -n1 -o prt -stats command,uid,prt' '--regexp --files com.apple.pkg.*|sort|uniq' -kl -l -s\ / '-R -l1 -n1 -o mem -stats command,uid,mem' '+c0 -i4TCP:0-1023' com.apple.dashboard\ layer-gadgets '-d /L*/Mana*/$USER&&echo On' '-app Safari WebKitDNSPrefetchingEnabled' "+c0 -l|awk '{print(\$1,\$3)}'|sort|uniq -c|sort -n|tail -1|awk '{print(\$2,\$3,\$1)}'" -m 'L*/{Con*/*/Data/L*/,}Pref* -type f -size 0c -name *.plist.???????|wc -l' kern.memorystatus_vm_pressure_level '3>&1 >&- 2>&3' " -F '\$Time \$Message' -k Sender kernel -k Message CSeq 'n Cause: -' " -i '-app Safari UserStyleSheetEnabled' -name\ kMDItem${p[35]} "`S2 ${p[35]}`" );N1=${#c2[@]};for j in {0..10};do c2[N1+j]=SP${p[j]}DataType;done;N2=${#c2[@]};for j in 0 1;do c2[N2+j]="-n ' syscall::'${p[33+j]}':return { @out[execname,uid]=sum(arg0) } tick-10sec { trunc(@out,1);exit(0);} '";done;l=(Restricted\ files I/O\ errors 'Elapsed time (s)' POST Battery Safari\ extensions Bad\ plists 'High file counts' User Heat System\ load boot\ args FileVault Diagnostic\ reports Log 'Free space (MiB)' 'Swap (MiB)' Activity 'CPU per process' Login\ hook 'I/O per process' Mach\ ports kexts Daemons Agents XPC\ cache Startup\ items Admin\ access Root\ access Bundles dylibs Apps Font\ issues Inserted\ dylibs Firewall Proxies DNS TCP/IP Wi-Fi Profiles Root\ crontab User\ crontab 'Global login items' 'User login items' Spotlight Memory Listeners Widgets Parental\ Controls Prefetching SATA Descriptors App\ extensions Lockfiles Memory\ pressure SMC Shutdowns Nets Stylesheet );N3=${#l[@]};for i in {0..3};do l[N3+i]=${p[5+i]};done;N4=${#l[@]};for j in 0 1;do l[N4+j]="Current ${p[29+j]}stream data";done;A0() { id -G|grep -qw 80;v[1]=$?;((v[1]==0))&&sudo true;v[2]=$?;v[3]=`date +%s`;clear >&-;date '+Start time: %T %D%n';};for i in 0 1;do eval ' A'$((1+i))'() { v=` eval "${c1[$1]} ${c2[$2]}"|'${c1[30+i]}' "${s[$3]}" `;[[ "$v" ]];};A'$((3+i))'() { v=` while read i;do [[ "$i" ]]&&eval "${c1[$1]} ${c2[$2]}" \"$i\"|'${c1[30+i]}' "${s[$3]}";done<<<"${v[$4]}" `;[[ "$v" ]];};A'$((5+i))'() { v=` while read i;do '${c1[30+i]}' "${s[$1]}" "$i";done<<<"${v[$2]}" `;[[ "$v" ]];};A'$((7+i))'() { v=` eval sudo "${c1[$1]} ${c2[$2]}"|'${c1[30+i]}' "${s[$3]}" `;[[ "$v" ]];};';done;A9(){ v=$((`date +%s`-v[3]));};B2(){ v[$1]="$v";};for i in 0 1;do eval ' B'$i'() { v=;((v['$((i+1))']==0))||{ v=No;false;};};B'$((3+i))'() { v[$2]=`'${c1[30+i]}' "${s[$3]}"<<<"${v[$1]}"`;} ';done;B5(){ v[$1]="${v[$1]}"$'\n'"${v[$2]}";};B6() { v=` paste -d: <(printf "${v[$1]}") <(printf "${v[$2]}")|awk -F: ' {printf("'"${f[$3]}"'",$1,$2)} ' `;};B7(){ v=`grep -Fv "${v[$1]}"<<<"$v"`;};C0() { [[ "$v" ]]&&sed -E "$s"<<<"$v";};C1() { [[ "$v" ]]&&printf "${f[$1]}" "${l[$2]}" "$v"|sed -E "$s";};C2() { v=`echo $v`;[[ "$v" != 0 ]]&&C1 0 $1;};C3() { v=`sed -E "${s[63]}"<<<"$v"`&&C1 1 $1;};for i in 1 2 7 8;do for j in 0 2 3;do eval D$i$j'(){ A'$i' $1 $2 $3; C'$j' $4;};';done;done;{ A0;D20 0 $((N1+1)) 2;D10 0 $N1 1;B0;C2 27;B0&&! B1&&C2 28;D12 15 37 25 8;A1 0 $((N1+2)) 3;C0;D13 0 $((N1+3)) 4 3;D23 0 $((N1+4)) 5 4;D13 0 $((N1+9)) 59 50;for i in 0 1 2;do D13 0 $((N1+5+i)) 6 $((N3+i));done;D13 0 $((N1+8)) 71 $((N3+3));D13 1 10 7 9;D13 1 11 8 10;B1&&D73 19 53 67 55;D22 2 12 9 11;D12 3 13 10 12;D23 4 19 44 13;D13 5 5 69 1;D13 5 54 30 56;D23 5 14 12 14;D22 6 36 13 15;D22 20 52 66 54;D22 7 37 14 16;D23 8 15 38 17;D22 9 16 16 18;B1&&{ D82 35 49 61 51;D82 11 17 17 20;for i in 0 1;do D82 28 $((N2+i)) 45 $((N4+i));done;};D22 12 44 54 45;D22 12 39 15 21;A1 13 40 18;B2 4;B3 4 0 19;A3 14 6 32 0;B4 0 5 11;A1 17 41 20;B7 5;C3 22;B4 4 6 21;A3 14 7 32 6;B4 0 7 11;B3 4 0 22;A3 14 6 32 0;B4 0 8 11;B5 7 8;B1&&{ A8 18 26 23;B7 7;C3 23;};A2 18 26 23;B7 7;C3 24;D13 4 21 24 26;B4 4 12 26;B3 4 13 27;A1 24 22 29;B7 12;B2 14;A4 39 57 70 14;B2 15;B6 14 15 4;C3 29;A1 24 23 32;B7 13;C3 30;B3 4 0 65;A3 14 6 32 0;B4 0 16 11;A1 26 50 64;B7 16;C3 52;D13 24 24 32 31;D13 25 37 32 33;A2 23 18 28;B2 16;A2 16 25 33;B7 16;B3 0 0 34;B2 21;A6 47 21&&C0;B1&&{ D73 21 0 32 19;D73 10 42 32 40;D82 29 35 46 39;};D23 14 1 62 42;D12 34 43 53 44;D12 22 20 32 25;D22 0 $((N1+10)) 51 32;D13 4 8 41 6;D12 21 28 35 34;D13 27 29 36 35;A2 27 32 39&&{ B2 19;A2 33 33 40;B2 20;B6 19 20 3;};C2 36;D23 38 55 68 57;D23 33 34 42 37;B1&&D83 35 45 55 46;D23 32 31 43 38;D12 36 47 32 48;D13 10 42 32 41;D13 37 2 48 43;A1 4 3 60;B2 30;A1 4 58 60;B2 31;B6 30 31 4;C3 5;D12 21 56 35 58;D12 21 48 49 49;B3 4 22 57;A1 21 46 56;B7 22;B3 0 0 58;C3 47;D22 4 4 50 0;D12 4 51 32 53;D23 22 9 37 7;A9;C2 2;} 2>/dev/null|pbcopy;exit 2>&-
    Copy the selected text to the Clipboard by pressing the key combination command-C.
    8. Launch the built-in Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad and start typing the name.
    Click anywhere in the Terminal window and paste by pressing command-V. The text you pasted should vanish immediately. If it doesn't, press the return key.
    9. If you see an error message in the Terminal window such as "Syntax error" or "Event not found," enter
    exec bash
    and press return. Then paste the script again.
    10. If you're logged in as an administrator, you'll be prompted for your login password. Nothing will be displayed when you type it. You will not see the usual dots in place of typed characters. Make sure caps lock is off. Type carefully and then press return. You may get a one-time warning to be careful. If you make three failed attempts to enter the password, the test will run anyway, but it will produce less information. In most cases, the difference is not important. If you don't know the password, or if you prefer not to enter it, press the key combination control-C or just press return  three times at the password prompt. Again, the script will still run.
    If you're not logged in as an administrator, you won't be prompted for a password. The test will still run. It just won't do anything that requires administrator privileges.
    11. The test may take a few minutes to run, depending on how many files you have and the speed of the computer. A computer that's abnormally slow may take longer to run the test. While it's running, there will be nothing in the Terminal window and no indication of progress. Wait for the line
    [Process completed]
    to appear. If you don't see it within half an hour or so, the test probably won't complete in a reasonable time. In that case, close the Terminal window and report what happened. No harm will be done.
    12. When the test is complete, quit Terminal. The results will have been copied to the Clipboard automatically. They are not shown in the Terminal window. Please don't copy anything from there. All you have to do is start a reply to this comment and then paste by pressing command-V again.
    At the top of the results, there will be a line that begins with the words "Start time." If you don't see that, but instead see a mass of gibberish, you didn't wait for the "Process completed" message to appear in the Terminal window. Please wait for it and try again.
    If any private information, such as your name or email address, appears in the results, anonymize it before posting. Usually that won't be necessary.
    13. When you post the results, you might see an error message on the web page: "You have included content in your post that is not permitted," or "You are not authorized to post." That's a bug in the forum software. Please post the test results on Pastebin, then post a link here to the page you created.
    14. This is a public forum, and others may give you advice based on the results of the test. They speak only for themselves, and I don't necessarily agree with them.
    Copyright © 2014 by Linc Davis. As the sole author of this work, I reserve all rights to it except as provided in the Use Agreement for the Apple Support Communities website ("ASC"). Readers of ASC may copy it for their own personal use. Neither the whole nor any part may be redistributed.

  • Display files also in tree?

    hai, to every one
    This program displaying folders from the local system, But my problem is, it was not displaying files.
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.tree.*;
    import javax.swing.event.*;
    public class FileTree1
      extends JFrame
      public static final ImageIcon ICON_COMPUTER =
        new ImageIcon("computer.gif");
      public static final ImageIcon ICON_DISK =
        new ImageIcon("disk.gif");
      public static final ImageIcon ICON_FOLDER =
        new ImageIcon("folder.gif");
      public static final ImageIcon ICON_EXPANDEDFOLDER =
        new ImageIcon("expandedfolder.gif");
      protected JTree  m_tree;
      protected DefaultTreeModel m_model;
      protected JTextField m_display;
      public FileTree1()
        super("Directories Tree");
        setSize(400, 300);
        DefaultMutableTreeNode top = new DefaultMutableTreeNode(
          new IconData(ICON_COMPUTER, null, "Computer"));
        DefaultMutableTreeNode node;
        File[] roots = File.listRoots();
        for (int k=0; k<roots.length; k++)
          node = new DefaultMutableTreeNode(new IconData(ICON_DISK,
            null, new FileNode(roots[k])));
          top.add(node);
                            node.add( new DefaultMutableTreeNode(new Boolean(true)));
        m_model = new DefaultTreeModel(top);
        m_tree = new JTree(m_model);
                    m_tree.putClientProperty("JTree.lineStyle", "Angled");
        TreeCellRenderer renderer = new
          IconCellRenderer();
        m_tree.setCellRenderer(renderer);
        m_tree.addTreeExpansionListener(new
          DirExpansionListener());
        m_tree.addTreeSelectionListener(new
          DirSelectionListener());
        m_tree.getSelectionModel().setSelectionMode(
          TreeSelectionModel.SINGLE_TREE_SELECTION);
        m_tree.setShowsRootHandles(true);
        m_tree.setEditable(false);
        JScrollPane s = new JScrollPane();
        s.getViewport().add(m_tree);
        getContentPane().add(s, BorderLayout.CENTER);
        m_display = new JTextField();
        m_display.setEditable(false);
        getContentPane().add(m_display, BorderLayout.NORTH);
        WindowListener wndCloser = new WindowAdapter()
          public void windowClosing(WindowEvent e)
            System.exit(0);
        addWindowListener(wndCloser);
        setVisible(true);
      DefaultMutableTreeNode getTreeNode(TreePath path)
        return (DefaultMutableTreeNode)(path.getLastPathComponent());
      FileNode getFileNode(DefaultMutableTreeNode node)
        if (node == null)
          return null;
        Object obj = node.getUserObject();
        if (obj instanceof IconData)
          obj = ((IconData)obj).getObject();
        if (obj instanceof FileNode)
          return (FileNode)obj;
        else
          return null;
        // Make sure expansion is threaded and updating the tree model
        // only occurs within the event dispatching thread.
        class DirExpansionListener implements TreeExpansionListener
            public void treeExpanded(TreeExpansionEvent event)
                final DefaultMutableTreeNode node = getTreeNode(
                    event.getPath());
                final FileNode fnode = getFileNode(node);
                Thread runner = new Thread()
                  public void run()
                    if (fnode != null && fnode.expand(node))
                      Runnable runnable = new Runnable()
                        public void run()
                           m_model.reload(node);
                      SwingUtilities.invokeLater(runnable);
                runner.start();
            public void treeCollapsed(TreeExpansionEvent event) {}
      class DirSelectionListener
        implements TreeSelectionListener
        public void valueChanged(TreeSelectionEvent event)
          DefaultMutableTreeNode node = getTreeNode(
            event.getPath());
          FileNode fnode = getFileNode(node);
          if (fnode != null)
            m_display.setText(fnode.getFile().
              getAbsolutePath());
          else
            m_display.setText("");
      public static void main(String argv[])
        new FileTree1();
    class IconCellRenderer
      extends    JLabel
      implements TreeCellRenderer
      protected Color m_textSelectionColor;
      protected Color m_textNonSelectionColor;
      protected Color m_bkSelectionColor;
      protected Color m_bkNonSelectionColor;
      protected Color m_borderSelectionColor;
      protected boolean m_selected;
      public IconCellRenderer()
        super();
        m_textSelectionColor = UIManager.getColor(
          "Tree.selectionForeground");
        m_textNonSelectionColor = UIManager.getColor(
          "Tree.textForeground");
        m_bkSelectionColor = UIManager.getColor(
          "Tree.selectionBackground");
        m_bkNonSelectionColor = UIManager.getColor(
          "Tree.textBackground");
        m_borderSelectionColor = UIManager.getColor(
          "Tree.selectionBorderColor");
        setOpaque(false);
      public Component getTreeCellRendererComponent(JTree tree,
        Object value, boolean sel, boolean expanded, boolean leaf,
        int row, boolean hasFocus)
        DefaultMutableTreeNode node =
          (DefaultMutableTreeNode)value;
        Object obj = node.getUserObject();
        setText(obj.toString());
                    if (obj instanceof Boolean)
                      setText("Retrieving data...");
        if (obj instanceof IconData)
          IconData idata = (IconData)obj;
          if (expanded)
            setIcon(idata.getExpandedIcon());
          else
            setIcon(idata.getIcon());
        else
          setIcon(null);
        setFont(tree.getFont());
        setForeground(sel ? m_textSelectionColor :
          m_textNonSelectionColor);
        setBackground(sel ? m_bkSelectionColor :
          m_bkNonSelectionColor);
        m_selected = sel;
        return this;
      public void paintComponent(Graphics g)
        Color bColor = getBackground();
        Icon icon = getIcon();
        g.setColor(bColor);
        int offset = 0;
        if(icon != null && getText() != null)
          offset = (icon.getIconWidth() + getIconTextGap());
        g.fillRect(offset, 0, getWidth() - 1 - offset,
          getHeight() - 1);
        if (m_selected)
          g.setColor(m_borderSelectionColor);
          g.drawRect(offset, 0, getWidth()-1-offset, getHeight()-1);
        super.paintComponent(g);
    class IconData
      protected Icon   m_icon;
      protected Icon   m_expandedIcon;
      protected Object m_data;
      public IconData(Icon icon, Object data)
        m_icon = icon;
        m_expandedIcon = null;
        m_data = data;
      public IconData(Icon icon, Icon expandedIcon, Object data)
        m_icon = icon;
        m_expandedIcon = expandedIcon;
        m_data = data;
      public Icon getIcon()
        return m_icon;
      public Icon getExpandedIcon()
        return m_expandedIcon!=null ? m_expandedIcon : m_icon;
      public Object getObject()
        return m_data;
      public String toString()
        return m_data.toString();
    class FileNode
      protected File m_file;
      public FileNode(File file)
        m_file = file;
      public File getFile()
        return m_file;
      public String toString()
        return m_file.getName().length() > 0 ? m_file.getName() :
          m_file.getPath();
      public boolean expand(DefaultMutableTreeNode parent)
        DefaultMutableTreeNode flag =
          (DefaultMutableTreeNode)parent.getFirstChild();
        if (flag==null)    // No flag
          return false;
        Object obj = flag.getUserObject();
        if (!(obj instanceof Boolean))
          return false;      // Already expanded
        parent.removeAllChildren();  // Remove Flag
        File[] files = listFiles();
        if (files == null)
          return true;
        Vector v = new Vector();
        for (int k=0; k<files.length; k++)
                   /*File child = new File(dir, list);
              String name = (child.getName()) ;
              if(child.isDirectory()) add(new Node(child));
              else add(new Node(child));*/
    File f = files[k];
    if (!(f.isDirectory()))
    continue;
    FileNode newNode = new FileNode(f);
    boolean isAdded = false;
    for (int i=0; i<v.size(); i++)
    FileNode nd = (FileNode)v.elementAt(i);
    if (newNode.compareTo(nd) < 0)
    v.insertElementAt(newNode, i);
    isAdded = true;
    break;
    if (!isAdded)
    v.addElement(newNode);
    for (int i=0; i<v.size(); i++)
    FileNode nd = (FileNode)v.elementAt(i);
    IconData idata = new IconData(FileTree1.ICON_FOLDER,
    FileTree1.ICON_EXPANDEDFOLDER, nd);
    DefaultMutableTreeNode node = new
    DefaultMutableTreeNode(idata);
    parent.add(node);
    if (nd.hasSubDirs())
    node.add(new DefaultMutableTreeNode(
    new Boolean(true) ));
    return true;
    public boolean hasSubDirs()
    File[] files = listFiles();
    if (files == null)
    return false;
    for (int k=0; k<files.length; k++)
    if (files[k].isDirectory())
    return true;
    return false;
    public int compareTo(FileNode toCompare)
    return m_file.getName().compareToIgnoreCase(
    toCompare.m_file.getName() );
    protected File[] listFiles()
    if (!m_file.isDirectory())
              return m_file.listFiles();
         try
    return m_file.listFiles();
    catch (Exception ex)
    JOptionPane.showMessageDialog(null,
    "Error reading directory "+m_file.getAbsolutePath(),
    "Warning", JOptionPane.WARNING_MESSAGE);
    return null;
    Thanks in advance
    raja

    This code shows the files in your tree
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.tree.*;
    import javax.swing.event.*;
    public class FileTree1
      extends JFrame
      public static final ImageIcon ICON_COMPUTER =
        new ImageIcon("computer.gif");
      public static final ImageIcon ICON_DISK =
        new ImageIcon("disk.gif");
      public static final ImageIcon ICON_FOLDER =
        new ImageIcon("folder.gif");
      public static final ImageIcon ICON_EXPANDEDFOLDER =
        new ImageIcon("expandedfolder.gif");
      protected JTree  m_tree;
      protected DefaultTreeModel m_model;
      protected JTextField m_display;
      public FileTree1()
        super("Directories Tree");
        setSize(400, 300);
        DefaultMutableTreeNode top = new DefaultMutableTreeNode(
          new IconData(ICON_COMPUTER, null, "Computer"));
        DefaultMutableTreeNode node;
        File[] roots = File.listRoots();
        for (int k=0; k<roots.length; k++)
          node = new DefaultMutableTreeNode(new IconData(ICON_DISK,
            null, new FileNode(roots[k])));
          top.add(node);
                            node.add( new DefaultMutableTreeNode(new Boolean(true)));
        m_model = new DefaultTreeModel(top);
        m_tree = new JTree(m_model);
                    m_tree.putClientProperty("JTree.lineStyle", "Angled");
        TreeCellRenderer renderer = new
          IconCellRenderer();
        m_tree.setCellRenderer(renderer);
        m_tree.addTreeExpansionListener(new
          DirExpansionListener());
        m_tree.addTreeSelectionListener(new
          DirSelectionListener());
        m_tree.getSelectionModel().setSelectionMode(
          TreeSelectionModel.SINGLE_TREE_SELECTION);
        m_tree.setShowsRootHandles(true);
        m_tree.setEditable(false);
        JScrollPane s = new JScrollPane();
        s.getViewport().add(m_tree);
        getContentPane().add(s, BorderLayout.CENTER);
        m_display = new JTextField();
        m_display.setEditable(false);
        getContentPane().add(m_display, BorderLayout.NORTH);
        WindowListener wndCloser = new WindowAdapter()
          public void windowClosing(WindowEvent e)
            System.exit(0);
        addWindowListener(wndCloser);
        setVisible(true);
      DefaultMutableTreeNode getTreeNode(TreePath path)
        return (DefaultMutableTreeNode)(path.getLastPathComponent());
      FileNode getFileNode(DefaultMutableTreeNode node)
        if (node == null)
          return null;
        Object obj = node.getUserObject();
        if (obj instanceof IconData)
          obj = ((IconData)obj).getObject();
        if (obj instanceof FileNode)
          return (FileNode)obj;
        else
          return null;
        // Make sure expansion is threaded and updating the tree model
        // only occurs within the event dispatching thread.
        class DirExpansionListener implements TreeExpansionListener
            public void treeExpanded(TreeExpansionEvent event)
                final DefaultMutableTreeNode node = getTreeNode(
                    event.getPath());
                final FileNode fnode = getFileNode(node);
                Thread runner = new Thread()
                  public void run()
                    if (fnode != null && fnode.expand(node))
                      Runnable runnable = new Runnable()
                        public void run()
                           m_model.reload(node);
                      SwingUtilities.invokeLater(runnable);
                runner.start();
            public void treeCollapsed(TreeExpansionEvent event) {}
      class DirSelectionListener
        implements TreeSelectionListener
        public void valueChanged(TreeSelectionEvent event)
          DefaultMutableTreeNode node = getTreeNode(
            event.getPath());
          FileNode fnode = getFileNode(node);
          if (fnode != null)
            m_display.setText(fnode.getFile().
              getAbsolutePath());
          else
            m_display.setText("");
      public static void main(String argv[])
        new FileTree1();
    class IconCellRenderer
      extends    JLabel
      implements TreeCellRenderer
      protected Color m_textSelectionColor;
      protected Color m_textNonSelectionColor;
      protected Color m_bkSelectionColor;
      protected Color m_bkNonSelectionColor;
      protected Color m_borderSelectionColor;
      protected boolean m_selected;
      public IconCellRenderer()
        super();
        m_textSelectionColor = UIManager.getColor(
          "Tree.selectionForeground");
        m_textNonSelectionColor = UIManager.getColor(
          "Tree.textForeground");
        m_bkSelectionColor = UIManager.getColor(
          "Tree.selectionBackground");
        m_bkNonSelectionColor = UIManager.getColor(
          "Tree.textBackground");
        m_borderSelectionColor = UIManager.getColor(
          "Tree.selectionBorderColor");
        setOpaque(false);
      public Component getTreeCellRendererComponent(JTree tree,
        Object value, boolean sel, boolean expanded, boolean leaf,
        int row, boolean hasFocus)
        DefaultMutableTreeNode node =
          (DefaultMutableTreeNode)value;
        Object obj = node.getUserObject();
        setText(obj.toString());
                    if (obj instanceof Boolean)
                      setText("Retrieving data...");
        if (obj instanceof IconData)
          IconData idata = (IconData)obj;
          if (expanded)
            setIcon(idata.getExpandedIcon());
          else
            setIcon(idata.getIcon());
        else
          setIcon(null);
        setFont(tree.getFont());
        setForeground(sel ? m_textSelectionColor :
          m_textNonSelectionColor);
        setBackground(sel ? m_bkSelectionColor :
          m_bkNonSelectionColor);
        m_selected = sel;
        return this;
      public void paintComponent(Graphics g)
        Color bColor = getBackground();
        Icon icon = getIcon();
        g.setColor(bColor);
        int offset = 0;
        if(icon != null && getText() != null)
          offset = (icon.getIconWidth() + getIconTextGap());
        g.fillRect(offset, 0, getWidth() - 1 - offset,
          getHeight() - 1);
        if (m_selected)
          g.setColor(m_borderSelectionColor);
          g.drawRect(offset, 0, getWidth()-1-offset, getHeight()-1);
        super.paintComponent(g);
    class IconData
      protected Icon   m_icon;
      protected Icon   m_expandedIcon;
      protected Object m_data;
      public IconData(Icon icon, Object data)
        m_icon = icon;
        m_expandedIcon = null;
        m_data = data;
      public IconData(Icon icon, Icon expandedIcon, Object data)
        m_icon = icon;
        m_expandedIcon = expandedIcon;
        m_data = data;
      public Icon getIcon()
        return m_icon;
      public Icon getExpandedIcon()
        return m_expandedIcon!=null ? m_expandedIcon : m_icon;
      public Object getObject()
        return m_data;
      public String toString()
        return m_data.toString();
    class FileNode
      protected File m_file;
      public FileNode(File file)
        m_file = file;
      public File getFile()
        return m_file;
      public String toString()
        return m_file.getName().length() > 0 ? m_file.getName() :
          m_file.getPath();
      public boolean expand(DefaultMutableTreeNode parent)
        DefaultMutableTreeNode flag =
          (DefaultMutableTreeNode)parent.getFirstChild();
        if (flag==null)    // No flag
          return false;
        Object obj = flag.getUserObject();
        if (!(obj instanceof Boolean))
          return false;      // Already expanded
        parent.removeAllChildren();  // Remove Flag
        File[] files = listFiles();
        if (files == null)
          return true;
        Vector v = new Vector();
        for (int k=0; k<files.length; k++)
                   File child = new File(dir, list);
              String name = (child.getName()) ;
              if(child.isDirectory()) add(new Node(child));
              else add(new Node(child));
    File f = files[k];
    /* if (!(f.isDirectory()))
    continue; */
    FileNode newNode = new FileNode(f);
    boolean isAdded = false;
    for (int i=0; i><v.size(); i++)
    FileNode nd = (FileNode)v.elementAt(i);
    if (newNode.compareTo(nd) >< 0)
    v.insertElementAt(newNode, i);
    isAdded = true;
    break;
    if (!isAdded)
    v.addElement(newNode);
    for (int i=0; i<v.size(); i++)
    FileNode nd = (FileNode)v.elementAt(i);
    IconData idata = new IconData(FileTree1.ICON_FOLDER,
    FileTree1.ICON_EXPANDEDFOLDER, nd);
    DefaultMutableTreeNode node = new
    DefaultMutableTreeNode(idata);
    parent.add(node);
    if (nd.hasSubDirs())
    node.add(new DefaultMutableTreeNode(
    new Boolean(true) ));
    return true;
    public boolean hasSubDirs()
    File[] files = listFiles();
    if (files == null)
    return false;
    for (int k=0; k><files.length; k++)
    if (true)
    return true;
    return false;
    public int compareTo(FileNode toCompare)
    return m_file.getName().compareToIgnoreCase(
    toCompare.m_file.getName() );
    protected File[] listFiles()
    if (!m_file.isDirectory())
              return m_file.listFiles();
         try
    return m_file.listFiles();
    catch (Exception ex)
    JOptionPane.showMessageDialog(null,
    "Error reading directory "+m_file.getAbsolutePath(),
    "Warning", JOptionPane.WARNING_MESSAGE);
    return null;

  • On elements 11 organizer how do you display file #

    On elements 11 organizer how do you display file # for each photo?

    Control D
    Zoom in until it appears.
    Alternately: menu Vieuw (?? I have a german version...). Click details, persons etc...

  • Display File Extension in iPhoto?

    I've just started to use iphoto.  In the thumbnail view of an event (or for that matter, anytime I'm viewing a display of thumbnails), I would like iphoto to display file name and file extension.  It's not doing that and I can't see a setting in iphoto preferences to enable file extensions.  I know there's a Finder preference to show all extensions, and it is checked.
    Is there a way to display file extensions?

    Yes.
    Using Photoshop or Photoshop Elements as Your Editor of Choice in iPhoto.
    1 - select Photoshop or Photoshop Elememts as your editor of choice in iPhoto's General Preference Section's under the "Edit photo:" menu.
    2 - double click on the thumbnail in iPhoto to open it in Photoshop.  When you're finished editing click on the Save button. If you immediately get the JPEG Options window make your selection (Baseline standard seems to be the most compatible jpeg format) and click on the OK button. Your done. 
    3 - however, if you get the navigation window
    that indicates that  PS wants to save it as a PS formatted file.  You'll need to either select JPEG from the menu and save (top image) or click on the desktop in the Navigation window (bottom image) and save it to the desktop for importing as a new photo.
    This method will let iPhoto know that the photo has been editied and will update the thumbnail file to reflect the edit..
    NOTE: With Photoshop Elements  the Saving File preferences should be configured as shown:
    I also suggest the Maximize PSD File Compatabilty be set to Always.  In PSE’s General preference pane set the Color Picker to Apple as shown:
    Note 1: screenshots are from PSE 10
    Note:  to switch between iPhoto and PS or PSE as the editor of choice Control (right)-click on the thumbnail and select either Edit in iPhoto or Edit in External Editor from the contextual menu. If you use iPhoto to edit more than PSE re-select iPhoto in the iPhoto General preference pane. Then iPhoto will be the default editor and you can use the contextual menu to select PSE for your editor when desired.

  • Finder can't find / display files in external drive

    Just upgraded to Lion on my MacBook, and Finder can't find / display files from my external thumb drive. I got message that the external drive was removed incorrectly, but I did not remove the thumb drive at all. After several attempts on removing and inserting the thumb drive, the files just didn't show up under Finder, and I have no way of working on files from external drive. I went to a Window based notebook and checked, the files are still in my thumb drive so they have not been corrupted, hopefully. How can I make Finder works with external drive in Lion ?

    The problem I have was finally resolved by having a "clean" install for Lion, meaning to back up your hard disc, re-install Snow Leopard, then Lion. It's a lot of work but my MacBook is now working.

  • Finder 600 error/not displaying files

    Finder giving me a 600 error, if it opens it won't display files, especially those on a network hard drive. It will let me see most folders though, again, if I can get past the 600 error. iTunes stopped working for a while but the second I clicked into these forums it worked!
    I've seen some similar threads but they didn't fix my issue. FYI I'm running the latest OS.

    Please read this whole message before doing anything.
    This procedure is a test, not a solution. Don’t be disappointed when you find that nothing has changed after you complete it.
    Step 1
    The purpose of this step is to determine whether the problem is localized to your user account.
    Enable guest logins* and log in as Guest. For instructions, launch the System Preferences application, select Help from the menu bar, and enter “Set up guest users” (without the quotes) in the search box. Don't use the Safari-only “Guest User” login created by “Find My Mac.”
    While logged in as Guest, you won’t have access to any of your personal files or settings. Applications will behave as if you were running them for the first time. Don’t be alarmed by this; it’s normal. If you need any passwords or other personal data in order to complete the test, memorize, print, or write them down before you begin.
    Test while logged in as Guest. Same problem?
    After testing, log out of the guest account and, in your own account, disable it if you wish. Any files you created in the guest account will be deleted automatically when you log out of it.
    *Note: If you’ve activated “Find My Mac” or FileVault, then you can’t enable the Guest account. The “Guest User” login created by “Find My Mac” is not the same. Create a new account in which to test, and delete it, including its home folder, after testing.
    Step 2
    The purpose of this step is to determine whether the problem is caused by third-party system modifications that load automatically at startup or login, or by a peripheral device.
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards. Boot in safe mode* and log in to the account with the problem. The instructions provided by Apple are as follows:
    Shut down your computer, wait 30 seconds, and then hold down the shift key while pressing the power button.
    When you see the gray Apple logo, release the shift key.
    If you are prompted to log in, type your password, and then hold down the shift key again as you click Log in.
    Safe mode is much slower to boot and run than normal, and some things won’t work at all, including wireless networking on certain Macs.  The next normal boot may also be somewhat slow.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
    *Note: If FileVault is enabled, or if a firmware password is set, or if the boot volume is a software RAID, you can’t boot in safe mode.
    Test while in safe mode. Same problem?
    After testing, reboot as usual (i.e., not in safe mode) and verify that you still have the problem. Post the results of steps 1 and 2.

Maybe you are looking for

  • Is it possible to have 2 display names (one for internal use; the other for external use) in Active Directory?

    The idea: When communicating amongst our own staff via email we'd like to see our display names in this format: Firstname Lastname (Division/Department/Branch/Unit) Whereas, when we send emails to people outside the company, we'd like to be seen as:

  • How can I stop deleted mail 'reappearing' in inbox?

    I have email [email protected] set up on my mail app on iphone 3gs iOS 4.2.1. I have a small but annoying issue where I read and delete messages from my inbox but next time I check my mail they have reappeared as new unread messages. I have to delete

  • Scanner not working HP Photosmart C4780

    I have OS X 10.9.5 and a HP Photosmart C4780 printer.  I'm trying to scan something to a pdf and I'm getting a black image.  When I scan an 8.5 x 11 size document as an image it only scans 1/4 of the document.  Please let me know if there is a driver

  • Report Layout Service in 2005

    Hi I'm trying to use the report layout service to delete a layout, but it is always giving a error. I'm most probably doing something silly,here is the code. Please let me know if you see a problem Try Dim oReportLayout As SAPbobsCOM.ReportLayout Dim

  • Toshiba Laptop Webcam/Mic doesn't work, how can I fix it?

    It just won't start up, it's simply a black screen rather then my face. I also get a message saying that a USB device is not recognized?  I've looked into the Device Manager and uninstalled the Webcam Driver and restarted my computer. Still doens't w