Blank Blank - 1 year ago 95
Java Question

JComboBox doesn't get my values

I have a problem with my JComboBox.

I create a new file by writing the name of my file in a Textfield. By clicking on a button I create a file with this value and add this into my JComboBox, but I only see the Object value, for example "[;@1b1428d" and that's the problem. The user doesn't even know what this value means so I need my filename. I searched for a long time and Yes the

doesn't work :D

My Code looks like this:
JComboBox TxtDoc = new JComboBox(create());

public File[] create(){
FileSystemView SYSTEM = FileSystemView.getFileSystemView();
String user = System.getProperty("user.home")+"\\notes";
File userdir = new File(user);
File[] fileList = SYSTEM.getFiles(userdir, true);
return fileList;

newTxt.addMouseListener(new MouseAdapter() {

public void mouseClicked(MouseEvent event){
new Documents().createTxtDoc(); // <-- this just open a new frame with my textfield and a button.


thank you for your help
regards Blank

Answer Source

iterate over it:

    for (File f : fileList) {