Java: Assigning Variables to an Array Based on User Input -


I'm making a start for Java, so if I'm making some derp mistake, please forgive me. ..

I have a jsibobox that has been named as an array called array. My goal is that JComboBox displays all filenames in a fixed directory. So far, I have prepared the code to assign files to files in a single string in a single string. Code:

  Package Moderate; Public category GuiBlocks2 extends JFrame {/ ** * * / Private static last long serial VERSIONUID = 1 L; Public JFileChooser filePath; FileEditor File Joiner = New FileEditor (); / ** * Launch Application * / Static String Files; Fixed string [] fileNames = {files}; Public Static Zero Main (String [] Elggs) {EventQueue.invokeLater (New Runnabal) (Public went from zero) {try {GuiBlocks2 frame = New GuiBlocks2 (); Frame.Set still (true);} hold (exception e) {E.printStackTrace ();}}}); // directory path here string path = "."; File folder = new file (path); File [] listOfFiles = folder.listFiles (); For (int i = 0; i   

Then there is another method that combines named kickboxes to the filename array. My question: How to assign all the files in the array.

If you want all the array files in the current directory, you can simply create a string object and You can add each filename (in the loop) in it. You should add a separator like ":" between them.

I will change my code like this:

  string filelist = ""; For (int i = 0; i   

Now if you want to get an array of all filenames, you can simply use the partitioning method. I designate the array a new string array, allFile;

  string [] allFile = fileList.split (":");    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -