Example usage for javax.swing JFrame dispose

List of usage examples for javax.swing JFrame dispose

Introduction

In this page you can find the example usage for javax.swing JFrame dispose.

Prototype

public void dispose() 

Source Link

Document

Releases all of the native screen resources used by this Window , its subcomponents, and all of its owned children.

Usage

From source file:com.haulmont.cuba.desktop.gui.components.DesktopTabSheet.java

protected void attachTab(JFrame frame, TabImpl tab) {
    int tabIndex = 0;
    int attachedBeforeCount = 0;
    JComponent tabContent = DesktopComponentsHelper.getComposition(tab.getComponent());
    String caption = tab.getCaption();
    ButtonTabComponent tabComponent = tab.getButtonTabComponent();
    for (Map.Entry<JComponent, TabImpl> entry : tabContents.entrySet()) {
        if (entry.getKey() == tabContent) {
            tabIndex = attachedBeforeCount;
            break;
        } else if (entry.getKey().getParent() == impl) {
            attachedBeforeCount++;/*w w  w.j a  v  a  2 s  .  co  m*/
        }
    }

    impl.add(tabContent, tabIndex);
    if (!tab.isEnabled()) {
        impl.setComponentAt(tabIndex, null);
    }
    impl.setTitleAt(tabIndex, caption);
    impl.setTabComponentAt(tabIndex, tabComponent);
    updateTabsEnabledState();
    tabComponent.revalidate();
    tabComponent.repaint();
    frame.dispose();
}

From source file:configuration.Util.java

public static String[] simpleSearchBox(String type, boolean multi, boolean hide) {
    JFrame f = createSearchFrame();
    JFileChooser jf;/*from   ww  w  .  j  a v  a 2s . c om*/
    jf = new JFileChooser(config.getExplorerPath());
    if (type.contains("d") || type.contains("D"))
        jf.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    else if (type.contains("f") || type.contains("F"))
        jf.setFileSelectionMode(JFileChooser.FILES_ONLY);
    else
        jf.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
    jf.setAcceptAllFileFilterUsed(false);
    jf.setMultiSelectionEnabled(multi);
    jf.setFileHidingEnabled(hide);
    int result = jf.showOpenDialog(f);
    f.dispose();

    if (result == JFileChooser.APPROVE_OPTION) {
        if (multi) {
            //--Save new filepath and files
            File[] files = jf.getSelectedFiles();
            String[] path = new String[files.length];
            for (int i = 0; i < files.length; i++) {
                path[i] = getCanonicalPath(files[i].getPath());
            }
            return path;
        } else {
            File file = jf.getSelectedFile();
            String[] path = new String[1];
            path[0] = getCanonicalPath(file.getPath());
            return path;
        }
    }
    String[] empty = new String[0];
    return empty;
}

From source file:at.becast.youploader.gui.FrmMain.java

protected void startUploads() {
    UploadMgr.setSpeed_limit(speed);//  w  ww .j a v  a 2 s  .com
    if ("0".equals(Main.s.setting.get("tos_agreed")) && !this.tos) {
        if (Main.debug)
            LOG.debug("Asking about ToS Agreement");

        //Dummy JFrame to keep Dialog on top
        JFrame frmOpt = new JFrame();
        frmOpt.setAlwaysOnTop(true);
        JCheckBox checkbox = new JCheckBox(LANG.getString("frmMain.tos.Remember"));
        String message = LANG.getString("frmMain.tos.Message");
        Object[] params = { message, checkbox };
        int n;
        do {
            n = JOptionPane.showConfirmDialog(frmOpt, params, LANG.getString("frmMain.tos.Title"),
                    JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE);
        } while (n == JOptionPane.CLOSED_OPTION);
        if (n == JOptionPane.OK_OPTION) {
            if (Main.debug)
                LOG.debug("Agreed to ToS");

            if (checkbox.isSelected()) {
                Main.s.setting.put("tos_agreed", "1");
                Main.s.save("tos_agreed");
            }
            this.tos = true;
            UploadMgr.start();
        }
        frmOpt.dispose();
    } else {
        if (Main.debug)
            LOG.debug("Previously agreed to ToS");

        UploadMgr.start();
    }
}

From source file:ch.descabato.browser.BackupBrowser.java

public static void main2(final String[] args)
        throws InterruptedException, InvocationTargetException, SecurityException, IOException {
    if (args.length > 1)
        throw new IllegalArgumentException(
                "SYNTAX:  java... " + BackupBrowser.class.getName() + " [initialPath]");

    SwingUtilities.invokeAndWait(new Runnable() {

        @Override/*  w w  w. jav a2 s .c o  m*/
        public void run() {
            tryLoadSubstanceLookAndFeel();
            final JFrame f = new JFrame("OtrosVfsBrowser demo");
            f.addWindowListener(finishedListener);
            Container contentPane = f.getContentPane();
            contentPane.setLayout(new BorderLayout());
            DataConfiguration dc = null;
            final PropertiesConfiguration propertiesConfiguration = new PropertiesConfiguration();
            File favoritesFile = new File("favorites.properties");
            propertiesConfiguration.setFile(favoritesFile);
            if (favoritesFile.exists()) {
                try {
                    propertiesConfiguration.load();
                } catch (ConfigurationException e) {
                    e.printStackTrace();
                }
            }
            dc = new DataConfiguration(propertiesConfiguration);
            propertiesConfiguration.setAutoSave(true);
            final VfsBrowser comp = new VfsBrowser(dc, (args.length > 0) ? args[0] : null);
            comp.setSelectionMode(SelectionMode.FILES_ONLY);
            comp.setMultiSelectionEnabled(true);
            comp.setApproveAction(new AbstractAction(Messages.getMessage("demo.showContentButton")) {
                @Override
                public void actionPerformed(ActionEvent e) {
                    FileObject[] selectedFiles = comp.getSelectedFiles();
                    System.out.println("Selected files count=" + selectedFiles.length);
                    for (FileObject selectedFile : selectedFiles) {
                        try {
                            FileSize fileSize = new FileSize(selectedFile.getContent().getSize());
                            System.out.println(selectedFile.getName().getURI() + ": " + fileSize.toString());
                            Desktop.getDesktop()
                                    .open(new File(new URI(selectedFile.getURL().toExternalForm())));
                            //                byte[] bytes = readBytes(selectedFile.getContent().getInputStream(), 150 * 1024l);
                            //                JScrollPane sp = new JScrollPane(new JTextArea(new String(bytes)));
                            //                JDialog d = new JDialog(f);
                            //                d.setTitle("Content of file: " + selectedFile.getName().getFriendlyURI());
                            //                d.getContentPane().add(sp);
                            //                d.setSize(600, 400);
                            //                d.setVisible(true);
                        } catch (Exception e1) {
                            LOGGER.error("Failed to read file", e1);
                            JOptionPane.showMessageDialog(f,
                                    (e1.getMessage() == null) ? e1.toString() : e1.getMessage(), "Error",
                                    JOptionPane.ERROR_MESSAGE);
                        }
                    }
                }
            });

            comp.setCancelAction(new AbstractAction(Messages.getMessage("general.cancelButtonText")) {
                @Override
                public void actionPerformed(ActionEvent e) {
                    f.dispose();
                    try {
                        propertiesConfiguration.save();
                    } catch (ConfigurationException e1) {
                        e1.printStackTrace();
                    }
                    System.exit(0);
                }
            });
            contentPane.add(comp);

            f.pack();
            f.setVisible(true);
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        }
    });
    while (!finished)
        Thread.sleep(100);
}

From source file:io.github.jeremgamer.editor.ManagerFrame.java

public ManagerFrame(String projectName, final JFrame parent) {
    dialog = this;

    ArrayList<BufferedImage> icons = new ArrayList<BufferedImage>();
    try {//from w ww . j a va 2  s .  c  om
        icons.add(ImageIO.read(ImageGetter.class.getResource("icon16.png")));
        icons.add(ImageIO.read(ImageGetter.class.getResource("icon32.png")));
        icons.add(ImageIO.read(ImageGetter.class.getResource("icon64.png")));
        icons.add(ImageIO.read(ImageGetter.class.getResource("icon128.png")));
    } catch (IOException e1) {
        e1.printStackTrace();
    }

    this.setIconImages((List<? extends Image>) icons);

    this.setTitle("Grer les projets");
    this.setSize(300, 200);
    this.setModal(true);
    this.setLocationRelativeTo(parent);
    this.setResizable(false);

    final JScrollPane scroll = new JScrollPane(content);
    scroll.getVerticalScrollBar().setUnitIncrement(Editor.SCROLL_SPEED);
    content.setBorder(BorderFactory.createTitledBorder(""));
    content.setLayout(new BoxLayout(content, BoxLayout.PAGE_AXIS));
    for (File project : new File("projects").listFiles()) {
        if (project.getName().equals(Editor.getProjectName())) {
            content.add(new ProjectPanel(project.getName(), true, parent, this));
        } else {
            content.add(new ProjectPanel(project.getName(), false, parent, this));
        }
    }
    try {
        final JButton add = new JButton("Crer un nouveau projet",
                new ImageIcon(ImageIO.read(ImageGetter.class.getResource("add.png"))));
        newProjectPanel.add(newProjectName);
        newProjectPanel.add(validate);

        this.setLayout(new BorderLayout());
        scroll.setBorder(null);
        this.add(scroll, BorderLayout.CENTER);
        this.add(add, BorderLayout.SOUTH);

        add.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event) {
                validate.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        dispose();
                        parent.dispose();
                        new Thread(new Runnable() {
                            public void run() {
                                window.getContentPane()
                                        .add(new JLabel("",
                                                new ImageIcon(ImageGetter.class.getResource("splash.gif")),
                                                SwingConstants.CENTER));
                                window.setBackground(new Color(0, 0, 0, 0));
                                window.setSize(300, 300);
                                window.setLocationRelativeTo(null);
                                window.setVisible(true);
                            }
                        }).start();

                        new Thread(new Runnable() {
                            public void run() {
                                new Editor(newProjectName.getText());
                                window.setVisible(false);
                            }
                        }).start();
                    }
                });
                CaretListener caretUpdate = new CaretListener() {
                    public void caretUpdate(javax.swing.event.CaretEvent e) {
                        JTextField text = (JTextField) e.getSource();
                        for (File dir : new File("projects").listFiles()) {
                            if (dir.isDirectory() && text.getText().equals(dir.getName())) {
                                validate.setEnabled(false);
                                validate.setText("Existe dj");
                                break;
                            } else {
                                validate.setEnabled(true);
                                validate.setText("Crer!");
                            }
                        }
                    }
                };
                JButton cancel = null;
                try {
                    cancel = new JButton(
                            new ImageIcon(ImageIO.read(ImageGetter.class.getResource("cancel.png"))));
                } catch (IOException e1) {
                    e1.printStackTrace();
                }
                newProjectName.addCaretListener(caretUpdate);
                remove(add);
                addPanel.setLayout(new BorderLayout());
                addPanel.add(newProjectPanel, BorderLayout.CENTER);
                addPanel.add(cancel, BorderLayout.EAST);
                add(addPanel, BorderLayout.SOUTH);
                revalidate();
                repaint();
                cancel.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent event) {
                        newProjectName.setText("");
                        remove(addPanel);
                        add(add, BorderLayout.SOUTH);
                        revalidate();
                        repaint();
                    }

                });
                newProjectName.requestFocusInWindow();
                newProjectName.requestFocus();
            }

        });
        this.setVisible(true);
    } catch (IOException e) {
        e.printStackTrace();
    }

}

From source file:autoGui.RegisterPagePanel.java

RegisterPagePanel(JFrame parent, MouseAdapter backHandler) {
    parent.getContentPane().add(RegisterPage, "name_22846752421143");
    RegisterPage.setLayout(null);//ww  w. j a v  a2s. co  m
    //System.out.println(parent.getContentPane());
    RegisterPage.setBounds(100, 100, 1036, 608);

    email = new JTextField();
    email.setBounds(642, 87, 116, 22);
    RegisterPage.add(email);
    email.setColumns(10);

    JLabel lblEmail = new JLabel("Email*");
    lblEmail.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblEmail.setBounds(506, 89, 56, 16);
    RegisterPage.add(lblEmail);

    JLabel lblNewLabel = new JLabel("Password*");
    lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblNewLabel.setBounds(506, 132, 71, 16);
    RegisterPage.add(lblNewLabel);

    JLabel lblFirstName = new JLabel("First Name*");
    lblFirstName.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblFirstName.setBounds(141, 87, 88, 16);
    RegisterPage.add(lblFirstName);

    firstName = new JTextField();
    firstName.setBounds(241, 85, 142, 22);
    RegisterPage.add(firstName);
    firstName.setColumns(10);

    JLabel lblNewLabel_1 = new JLabel("Middle Name");
    lblNewLabel_1.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblNewLabel_1.setBounds(141, 132, 88, 16);
    RegisterPage.add(lblNewLabel_1);

    middleName = new JTextField();
    middleName.setBounds(241, 129, 142, 22);
    RegisterPage.add(middleName);
    middleName.setColumns(10);

    JLabel lblNewLabel_2 = new JLabel("Last Name*");
    lblNewLabel_2.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblNewLabel_2.setBounds(141, 174, 88, 16);
    RegisterPage.add(lblNewLabel_2);

    lastName = new JTextField();
    lastName.setBounds(241, 172, 142, 22);
    RegisterPage.add(lastName);
    lastName.setColumns(10);

    JLabel lblPersonalInformation = new JLabel("Personal Information");
    lblPersonalInformation.setFont(new Font("Tahoma", Font.PLAIN, 16));
    lblPersonalInformation.setBounds(86, 33, 159, 27);
    RegisterPage.add(lblPersonalInformation);

    JLabel lblContactInformation = new JLabel("Contact Information");
    lblContactInformation.setFont(new Font("Tahoma", Font.PLAIN, 16));
    lblContactInformation.setBounds(459, 33, 175, 27);
    RegisterPage.add(lblContactInformation);

    JLabel lblPhoneNumber = new JLabel("Phone*");
    lblPhoneNumber.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblPhoneNumber.setBounds(506, 217, 71, 16);
    RegisterPage.add(lblPhoneNumber);

    phone = new JTextField();
    phone.setBounds(642, 215, 116, 22);
    RegisterPage.add(phone);
    phone.setColumns(10);

    password = new JPasswordField();
    password.setBounds(642, 130, 116, 22);
    RegisterPage.add(password);

    JButton btnBack_5 = new JButton("Back");
    btnBack_5.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
        }
    });

    btnBack_5.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            if (lastPage == 6) {
                lastPage = 4;

            }
            RegisterPage.setVisible(false);
            parent.getContentPane().getComponent(lastPage).setVisible(true);
            backHandler.mouseClicked(e);
        }
    });
    btnBack_5.setBounds(12, 525, 97, 25);
    RegisterPage.add(btnBack_5);

    JButton btnExit_6 = new JButton("Exit");
    btnExit_6.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            parent.setVisible(false);
            parent.dispose();
        }
    });
    btnExit_6.setBounds(909, 525, 97, 25);
    RegisterPage.add(btnExit_6);

    JLabel lblAddress = new JLabel("Address*");
    lblAddress.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblAddress.setBounds(141, 217, 56, 16);
    RegisterPage.add(lblAddress);

    address = new JTextField();
    address.setBounds(241, 215, 142, 22);
    RegisterPage.add(address);
    address.setColumns(10);

    address2 = new JTextField();
    address2.setBounds(241, 260, 142, 22);
    RegisterPage.add(address2);
    address2.setColumns(10);

    JLabel lblCity = new JLabel("City*");
    lblCity.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblCity.setBounds(141, 308, 56, 16);
    RegisterPage.add(lblCity);

    city = new JTextField();
    city.setBounds(241, 306, 142, 22);
    RegisterPage.add(city);
    city.setColumns(10);

    JLabel lblAddress_1 = new JLabel("Address 2");
    lblAddress_1.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblAddress_1.setBounds(141, 263, 77, 16);
    RegisterPage.add(lblAddress_1);

    JLabel lblZip = new JLabel("Zip*");
    lblZip.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblZip.setBounds(141, 402, 56, 16);
    RegisterPage.add(lblZip);

    zip = new JTextField();
    zip.setBounds(241, 400, 142, 22);
    RegisterPage.add(zip);
    zip.setColumns(10);

    JLabel lblState = new JLabel("State*");
    lblState.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblState.setBounds(141, 355, 56, 16);
    RegisterPage.add(lblState);

    state = new JTextField();
    state.setBounds(241, 353, 142, 22);
    RegisterPage.add(state);
    state.setColumns(10);

    JLabel lblRequired = new JLabel("* = required");
    lblRequired.setBounds(301, 39, 88, 16);
    RegisterPage.add(lblRequired);

    JLabel lblLicenseInfo = new JLabel("License Information");
    lblLicenseInfo.setFont(new Font("Tahoma", Font.PLAIN, 16));
    lblLicenseInfo.setBounds(459, 257, 148, 27);
    RegisterPage.add(lblLicenseInfo);

    JLabel lblNumber = new JLabel("Number*");
    lblNumber.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblNumber.setBounds(506, 310, 71, 16);
    RegisterPage.add(lblNumber);

    license = new JTextField();
    license.setBounds(642, 306, 116, 22);
    RegisterPage.add(license);
    license.setColumns(10);

    JLabel lblDateOfBirth = new JLabel("Date of Birth*");
    lblDateOfBirth.setBounds(506, 372, 88, 16);
    RegisterPage.add(lblDateOfBirth);

    birthMonth = new JComboBox();
    birthMonth.setModel(new DefaultComboBoxModel(new String[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul",
            "Aug", "Sep", "Oct", "Nov", "Dec" }));
    birthMonth.setBounds(642, 370, 71, 22);
    RegisterPage.add(birthMonth);

    birthDay = new JComboBox();
    birthDay.setModel(new DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
            "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26",
            "27", "28", "29", "30", "31" }));
    birthDay.setBounds(708, 370, 62, 22);
    RegisterPage.add(birthDay);

    List<Integer> years = new ArrayList<Integer>();
    for (int i = 1915; i <= 2015; ++i) {
        years.add(i);
    }

    birthYear = new JComboBox(years.toArray());
    birthYear.setBounds(769, 370, 97, 22);
    RegisterPage.add(birthYear);

    JButton btnContinue = new JButton("Continue ->");
    btnContinue.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            register(parent);

        }
    });
    btnContinue.setBounds(674, 428, 133, 34);
    RegisterPage.add(btnContinue);

    JLabel lblConfirmPassword = new JLabel("Confirm Password*");
    lblConfirmPassword.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblConfirmPassword.setBounds(506, 174, 121, 16);
    RegisterPage.add(lblConfirmPassword);

    repassword = new JPasswordField();
    repassword.setBounds(642, 172, 116, 22);
    RegisterPage.add(repassword);

    JLabel lblNewLabel_3 = new JLabel("Credit card #*");
    lblNewLabel_3.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblNewLabel_3.setBounds(141, 448, 93, 16);
    RegisterPage.add(lblNewLabel_3);

    cardNumber = new JTextField();
    cardNumber.setBounds(241, 443, 142, 28);
    RegisterPage.add(cardNumber);
    cardNumber.setColumns(10);

    JLabel lblCardExp = new JLabel("Card exp*");
    lblCardExp.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblCardExp.setBounds(141, 496, 82, 16);
    RegisterPage.add(lblCardExp);

    cardExpMonth = new JComboBox();
    cardExpMonth.setModel(new DefaultComboBoxModel(new String[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
            "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }));
    cardExpMonth.setBounds(238, 493, 77, 27);
    RegisterPage.add(cardExpMonth);

    cardExpDay = new JComboBox();
    cardExpDay.setModel(new DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9",
            "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25",
            "26", "27", "28", "29", "30", "31" }));
    cardExpDay.setBounds(312, 493, 71, 27);
    RegisterPage.add(cardExpDay);

    JLabel lblLicenseState = new JLabel("License state*");
    lblLicenseState.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblLicenseState.setBounds(506, 338, 88, 16);
    RegisterPage.add(lblLicenseState);

    licenseState = new JTextField();
    licenseState.setBounds(642, 333, 116, 28);
    RegisterPage.add(licenseState);
    licenseState.setColumns(10);

    RegisterPage.setVisible(false);
}

From source file:org.eclipse.wb.internal.swing.utils.SwingImageUtils.java

private static void fetchMenuVisualData_JMenuBar(MenuVisualData menuData, Container menuObject,
        Container parent) throws Exception {
    if (parent != null) {
        menuData.m_menuBounds = CoordinateUtils
                .get(SwingUtilities.convertRectangle(menuObject, menuObject.getBounds(), parent));
    } else {//from  ww w  .  j  a  v  a 2  s.  c o m
        // image
        {
            JFrame frame = new JFrame();
            frame.setBounds(menuObject.getBounds());
            frame.setJMenuBar((JMenuBar) menuObject);
            frame.pack();
            prepareForPrinting(frame);
            try {
                menuData.m_menuImage = createComponentShot(menuObject);
            } finally {
                setVisible(frame, false);
                frame.dispose();
            }
        }
        // bounds
        menuData.m_menuBounds = CoordinateUtils.get(menuObject.getBounds());
    }
    // items
    fetchMenuVisualData_items(menuData, menuObject);
}

From source file:org.eurocarbdb.application.glycoworkbench.plugin.s3.gui.StartupDialog.java

/**
 * Creates stand-alone dialog box for testing only.
 *
 * @param args//www .  j a  va  2s .co  m
 * @throws Exception
 */
public static void main(String args[]) throws Exception {
    //        String algorithm = Jets3tProperties.getInstance(Constants.JETS3T_PROPERTIES_FILENAME)
    //            .getStringProperty("crypto.algorithm", "PBEWithMD5AndDES");
    //        File file = new File("/Users/jmurty/Desktop/test.enc");
    //        AWSCredentials awsCredentialsTest = new AWSCredentials("a", "b");
    //        awsCredentialsTest.save("please", file, algorithm);
    //        System.err.println("Saved: " + awsCredentialsTest);
    //        System.err.println("Loaded: " + AWSCredentials.load("please", file));
    //        if (true)
    //            return;
    //
    JFrame f = new JFrame();

    HyperlinkActivatedListener listener = new HyperlinkActivatedListener() {
        private static final long serialVersionUID = -225585129296632961L;

        public void followHyperlink(URL url, String target) {
            BareBonesBrowserLaunch.openURL(url.toString());
        }
    };

    StartupDialog startupDialog = new StartupDialog(f,
            Jets3tProperties.getInstance(Constants.JETS3T_PROPERTIES_FILENAME), listener);
    startupDialog.setVisible(true);
    AWSCredentials awsCredentials = startupDialog.getAWSCredentials();
    startupDialog.dispose();

    if (awsCredentials != null) {
        System.out.println("AWS Credentials: " + awsCredentials.getLogString());
    } else {
        System.out.println("AWS Credentials: null");
    }

    f.dispose();
}

From source file:org.jets3t.apps.cockpit.gui.StartupDialog.java

/**
 * Creates stand-alone dialog box for testing only.
 *
 * @param args//ww  w.jav a  2 s  .  c om
 * @throws Exception
 */
public static void main(String args[]) throws Exception {
    JFrame f = new JFrame();

    HyperlinkActivatedListener listener = new HyperlinkActivatedListener() {
        private static final long serialVersionUID = -225585129296632961L;

        public void followHyperlink(URL url, String target) {
            BareBonesBrowserLaunch.openURL(url.toString());
        }
    };

    StartupDialog startupDialog = new StartupDialog(f,
            Jets3tProperties.getInstance(Constants.JETS3T_PROPERTIES_FILENAME), listener);
    startupDialog.setVisible(true);
    ProviderCredentials credentials = startupDialog.getProviderCredentials();
    startupDialog.dispose();

    if (credentials != null) {
        System.out.println("Credentials: " + credentials.getLogString());
    } else {
        System.out.println("Credentials: null");
    }

    f.dispose();
}

From source file:org.jets3t.apps.cockpitlite.ToggleAclDialog.java

public static void main(String[] args) {
    JFrame ownerFrame = new JFrame("Test");
    ToggleAclDialog dialog = new ToggleAclDialog(ownerFrame, false, null, new Properties());
    dialog.setVisible(true);//from ww  w  .  java 2s. c o  m

    dialog.dispose();
    ownerFrame.dispose();
}