Java Utililty Methods JFrame

List of utility methods to do JFrame

Description

The list of methods to do JFrame are organized into topic(s).

Method

voidunpackArchive(URL url, File targetDir, JFrame frame, ProgressMonitor progressMonitor)
Unpack an archive from a URL
if (!targetDir.exists()) {
    targetDir.mkdirs();
InputStream in = new BufferedInputStream(url.openStream(), 1024);
File zip = File.createTempFile("temp", ".zip", targetDir);
zip.deleteOnExit();
FileOutputStream fileOutputStream = new FileOutputStream(zip);
OutputStream out = new BufferedOutputStream(fileOutputStream);
...
voidwaitFor(JFrame popup)
wait For
while (popup.isVisible()) {
    try {
        Thread.sleep(100);
    } catch (Exception ex) {
        ex.printStackTrace();
JFramewrapPanelInFrame(JFrame frame, JPanel panel, String caption, int width, int height)
wrap Panel In Frame
frame.setTitle(caption);
frame.setSize(width, height);
frame.add(panel);
frame.pack();
frame.setVisible(true);
return frame;
voidwrite(JFrame frame, String ext, String desc, String text)
write
File file = findFileSave(frame, ext, desc);
if (file == null) {
    return;
write(file, text);
booleanwriteOrAbort(String path, JFrame frame)
Return if yes or not a file should be written.
if (fileAlreadyExist(path)) {
    int n = JOptionPane.showConfirmDialog(
            frame,
            path + "\n\n" + "The selected filename already exists. If you\n"
                    + "continue, the contents of the existing file will\n" + "be replaced.\n" + "\n"
                    + "Do you want to continue?",
            "Replace file", JOptionPane.YES_NO_OPTION);
    if (n == JOptionPane.YES_OPTION)
...