I have a button and on click I want it to load a text field (like a pop up). Is this possible?
I've looked into
this.setVisible(false);
new className().setVisible(true);
But this means I'd need a new JFrame. I'm not against the idea - I'm just asking if there is a better way of doing it. If possible, I want it to load JUST a text field instead of a the frame that is around it.
I've just created JOptionPane as suggested below - But i'm still having problems. The pop up appears, but nothing is included in the box.
When mouse is clicked on class 1:
JOptionPane.showMessageDialog(this, MetaData.getTags());
class 2 (I'm aware this isn't the best way to throw exceptions. This is only a rough program). Using metadata extractor for those who are interested.
public String getTags() {
try {
Metadata metadata = ImageMetadataReader.readMetadata(jpegFile);
for (Directory directory : metadata.getDirectories()) {
for (Tag allTags : directory.getTags()) {
System.out.println("MetaData Class: " + allTags);
}
}
} catch (ImageProcessingException ex) {
Logger.getLogger(MetaData.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(MetaData.class.getName()).log(Level.SEVERE, null, ex);
}
return allTags;
}