Answer the question
In order to leave comments, you need to log in
Tables in Java?
The crux of the matter is this. There are a large number of files, certain information is extracted from each (roughly speaking, tags, the String class, plus the file name and path to it). Accordingly, they are different for each file. There is an idea to create a class with fields containing these tags, that is, for each file there will be an instance of this class. A display problem arises: it is most convenient through a table, since for each file the tags can be processed and changed (at the end of the execution, just check if the table parameters have changed and, if so, overwrite the tags in the files). But in the table, if I understood correctly, it turns out that you can’t really cram objects of this class, you can cram only field values. It would be more correct to abandon the table and use something else, working with instances of my class with tag fields, or to abandon the class with tags and just write these same tags directly to the table? Or maybe there is some other option that I do not see, due to little experience?
Thank you in advance.
Answer the question
In order to leave comments, you need to log in
Sorry for the somewhat confusing question. The table is an object of the JTable class. We take a bunch of files, extract tags from them, and put the tags into a table, which is a JTable, in order to work with them later. There is also an option to create your own class with fields containing tags and create an instance of the class for each file, and then somehow present the fields of all instances of this class and work with them. So I wander from one option to another.
Well, the idea is basically correct.
Firstly, I would create some kind of my own entity that would denote such a record. Among the properties, I would indicate File, if necessary, you can physically access it, i.e.
public class SuperDeed {
private File file;
private Set<String> tags;
private String name;
...(getters, setters, constructor)
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question