private void selectFile() { File f = rest_ui.getOpenFile(FileChooserType.OPEN_REQUEST_BODY); if (f == null) { // Pressed cancel? return; } if (!f.canRead()) { JOptionPane.showMessageDialog( rest_ui.getFrame(), "File not readable: " + f.getAbsolutePath(), "IO Error", JOptionPane.ERROR_MESSAGE); return; } // Content type charset correction: ContentTypeSelectorOnFile.select(jp_contentType, f, this); // Set name: if (StringUtil.isEmpty(jtf_fileName.getText())) { jtf_fileName.setText(f.getName()); } // Set file: jtf_file.setText(f.getAbsolutePath()); }
@Override public void clear() { jp_contentType.clear(); jtf_fileName.setText(""); jtf_file.setText(""); }