Example usage for javax.swing JDialog setDefaultLookAndFeelDecorated

List of usage examples for javax.swing JDialog setDefaultLookAndFeelDecorated

Introduction

In this page you can find the example usage for javax.swing JDialog setDefaultLookAndFeelDecorated.

Prototype

public static void setDefaultLookAndFeelDecorated(boolean defaultLookAndFeelDecorated) 

Source Link

Document

Provides a hint as to whether or not newly created JDialog s should have their Window decorations (such as borders, widgets to close the window, title...) provided by the current look and feel.

Usage

From source file:com.vsquaresystem.safedeals.readyreckoner.ReadyReckonerService.java

public Boolean checkExistingDataa() throws IOException {
    logger.info("check ke andar hai bhai??");
    Vector checkCellVectorHolder = read();
    logger.info("checkCellVectorHolder line116 :{}", checkCellVectorHolder);
    logger.info("read in check line117 :{}", read());
    int excelSize = checkCellVectorHolder.size() - 1;
    System.out.println("excelSize" + excelSize);
    List<Readyreckoner> rs = readyReckonerDAL.getAll();
    JFrame parent = new JFrame();

    System.out.println("rs" + rs);
    int listSize = rs.size();
    logger.info("rsss:::::", listSize);
    System.out.println("rsss:::::" + listSize);
    if (excelSize == listSize || excelSize > listSize) {
        JDialog.setDefaultLookAndFeelDecorated(true);
        int response = JOptionPane.showConfirmDialog(null, "Do you want to continue?", "Confirm",
                JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
        switch (response) {
        case JOptionPane.NO_OPTION:
            System.out.println("No button clicked");
            JOptionPane.showMessageDialog(parent, "upload Cancelled");
            break;
        case JOptionPane.YES_NO_OPTION:
            saveToDatabase(checkCellVectorHolder);
            System.out.println("Yes button clicked");
            JOptionPane.showMessageDialog(parent, "Saved succesfully");
            break;
        case JOptionPane.CLOSED_OPTION:
            System.out.println("JOptionPane closed");
            break;
        }/*w  w w  .  j a v  a 2  s .co m*/

    } else {
        System.out.println("No selected");
    }

    return true;
}

From source file:net.sf.keystore_explorer.gui.CreateApplicationGui.java

private static void initLookAndFeel(ApplicationSettings applicationSettings) {
    LnfUtil.installLnfs();/*from  w w  w.ja  v a  2 s . co  m*/

    String lookFeelClassName = applicationSettings.getLookAndFeelClass();

    if (lookFeelClassName != null) {
        LnfUtil.useLnf(lookFeelClassName);
    } else {
        String lookAndFeelClass = LnfUtil.useLnfForPlatform();
        applicationSettings.setLookAndFeelClass(lookAndFeelClass);
    }

    boolean lookFeelDecorated = applicationSettings.getLookAndFeelDecorated();

    JFrame.setDefaultLookAndFeelDecorated(lookFeelDecorated);
    JDialog.setDefaultLookAndFeelDecorated(lookFeelDecorated);
}

From source file:SplitPaneDemo2.java

/**
 * Create the GUI and show it. For thread safety, this method should be
 * invoked from the event-dispatching thread.
 *///w w  w .j av  a  2s.co  m
private static void createAndShowGUI() {
    //Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);
    JDialog.setDefaultLookAndFeelDecorated(true);

    //Create and set up the window.
    JFrame frame = new JFrame("SplitPaneDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    SplitPaneDemo splitPaneDemo = new SplitPaneDemo();
    frame.getContentPane().add(splitPaneDemo.getSplitPane());

    //Display the window.
    frame.pack();
    frame.setVisible(true);
}

From source file:components.FrameDemo2.java

/**
 * Create the GUI and show it.  For thread safety,
 * this method should be invoked from the
 * event-dispatching thread.//from   w ww  .  j ava 2s  .c  o  m
 */
private static void createAndShowGUI() {
    //Use the Java look and feel.
    try {
        UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
    } catch (Exception e) {
    }

    //Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);
    JDialog.setDefaultLookAndFeelDecorated(true);

    //Instantiate the controlling class.
    JFrame frame = new JFrame("FrameDemo2");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    //Create and set up the content pane.
    FrameDemo2 demo = new FrameDemo2();

    //Add components to it.
    Container contentPane = frame.getContentPane();
    contentPane.add(demo.createOptionControls(), BorderLayout.CENTER);
    contentPane.add(demo.createButtonPane(), BorderLayout.PAGE_END);
    frame.getRootPane().setDefaultButton(defaultButton);

    //Display the window.
    frame.pack();
    frame.setLocationRelativeTo(null); //center it
    frame.setVisible(true);
}

From source file:FrameDemo2.java

/**
 * Create the GUI and show it. For thread safety, this method should be
 * invoked from the event-dispatching thread.
 *//*from w  w  w  .  j a va 2 s  .co m*/
private static void createAndShowGUI() {
    // Use the Java look and feel.
    try {
        UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
    } catch (Exception e) {
    }

    // Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);
    JDialog.setDefaultLookAndFeelDecorated(true);

    // Instantiate the controlling class.
    JFrame frame = new JFrame("FrameDemo2");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // Create and set up the content pane.
    FrameDemo2 demo = new FrameDemo2();

    // Add components to it.
    Container contentPane = frame.getContentPane();
    contentPane.add(demo.createOptionControls(), BorderLayout.CENTER);
    contentPane.add(demo.createButtonPane(), BorderLayout.PAGE_END);
    frame.getRootPane().setDefaultButton(defaultButton);

    // Display the window.
    frame.pack();
    frame.setLocationRelativeTo(null); // center it
    frame.setVisible(true);
}

From source file:net.sf.firemox.Magic.java

/**
 * @param args//ww w . j a v a 2  s  .  co m
 *          the command line arguments
 * @throws Exception
 */
public static void main(String[] args) throws Exception {
    Log.init();
    Log.debug("MP v" + IdConst.VERSION + ", jre:" + System.getProperty("java.runtime.version") + ", jvm:"
            + System.getProperty("java.vm.version") + ",os:" + System.getProperty("os.name") + ", res:"
            + Toolkit.getDefaultToolkit().getScreenSize().width + "x"
            + Toolkit.getDefaultToolkit().getScreenSize().height + ", root:" + MToolKit.getRootDir());
    System.setProperty("swing.aatext", "true");
    System.setProperty(SubstanceLookAndFeel.WATERMARK_IMAGE_PROPERTY,
            MToolKit.getIconPath(Play.ZONE_NAME + "/hardwoodfloor.png"));

    final File substancelafFile = MToolKit.getFile(FILE_SUBSTANCE_PROPERTIES);
    if (substancelafFile == null) {
        Log.warn("Unable to locate '" + FILE_SUBSTANCE_PROPERTIES
                + "' file, you are using the command line with wrong configuration. See http://www.firemox.org/dev/project.html documentation");
    } else {
        System.getProperties().load(new FileInputStream(substancelafFile));
    }
    MToolKit.defaultFont = new Font("Arial", 0, 11);
    try {
        if (args.length > 0) {
            final String[] args2 = new String[args.length - 1];
            System.arraycopy(args, 1, args2, 0, args.length - 1);
            if ("-rebuild".equals(args[0])) {
                XmlConfiguration.main(args2);
            } else if ("-oracle2xml".equals(args[0])) {
                Oracle2Xml.main(args2);
            } else if ("-batch".equals(args[0])) {
                if ("-server".equals(args[1])) {
                    batchMode = BATCH_SERVER;
                } else if ("-client".equals(args[1])) {
                    batchMode = BATCH_CLIENT;
                }
            } else {
                Log.error("Unknown options '" + Arrays.toString(args)
                        + "'\nUsage : java -jar starter.jar <options>, where options are :\n"
                        + "\t-rebuild -game <tbs name> [-x] [-d] [-v] [-h] [-f] [-n]\n"
                        + "\t-oracle2xml -f <oracle file> -d <output directory> [-v] [-h]");
            }
            System.exit(0);
            return;
        }
        if (batchMode == -1 && !"Mac OS X".equals(System.getProperty("os.name"))) {
            splash = new SplashScreen(MToolKit.getIconPath("splash.jpg"), null, 2000);
        }

        // language settings
        LanguageManager.initLanguageManager(Configuration.getString("language", "auto"));
    } catch (Throwable t) {
        Log.error("START-ERROR : \n\t" + t.getMessage());
        System.exit(1);
        return;
    }
    Log.debug("MP Language : " + LanguageManager.getLanguage().getName());
    speparateAvatar = Toolkit.getDefaultToolkit().getScreenSize().height > 768;

    // verify the java version, minimal is 1.5
    if (new JavaVersion().compareTo(new JavaVersion(IdConst.MINIMAL_JRE)) == -1) {
        Log.error(LanguageManager.getString("wrongjava") + IdConst.MINIMAL_JRE);
    }

    // load look and feel settings
    lookAndFeelName = Configuration.getString("preferred", MUIManager.LF_SUBSTANCE_CLASSNAME);
    // try {
    // FileInputStream in= new FileInputStream("MAGIC.TTF");
    // MToolKit.defaultFont= Font.createFont(Font.TRUETYPE_FONT, in);
    // in.close();
    // MToolKit.defaultFont= MToolKit.defaultFont.deriveFont(Font.BOLD, 11);
    // }
    // catch (FileNotFoundException e) {
    // System.out.println("editorfont.ttf not found, using default.");
    // }
    // catch (Exception ex) {
    // ex.printStackTrace();
    // }

    // Read available L&F
    final LinkedList<Pair<String, String>> lfList = new LinkedList<Pair<String, String>>();
    try {
        BufferedReader buffReader = new BufferedReader(
                new InputStreamReader(MToolKit.getResourceAsStream(IdConst.FILE_THEME_SETTINGS)));
        String line;
        while ((line = buffReader.readLine()) != null) {
            line = line.trim();
            if (!line.startsWith("#")) {
                final int index = line.indexOf(';');
                if (index != -1) {
                    lfList.add(new Pair<String, String>(line.substring(0, index), line.substring(index + 1)));
                }
            }
        }
        IOUtils.closeQuietly(buffReader);
    } catch (Throwable e) {
        // no place for resolve this problem
        Log.debug("Error reading L&F properties : " + e.getMessage());
    }
    for (Pair<String, String> pair : lfList) {
        UIManager.installLookAndFeel(pair.key, pair.value);
    }

    // install L&F
    if (SkinLF.isSkinLF(lookAndFeelName)) {
        // is a SkinLF Look & Feel
        /*
         * Make sure we have a nice window decoration.
         */
        SkinLF.installSkinLF(lookAndFeelName);
    } else {
        // is Metal Look & Feel
        if (!MToolKit.isAvailableLookAndFeel(lookAndFeelName)) {
            // preferred look&feel is not available
            JOptionPane.showMessageDialog(magicForm,
                    LanguageManager.getString("preferredlfpb", lookAndFeelName),
                    LanguageManager.getString("error"), JOptionPane.INFORMATION_MESSAGE);
            setDefaultUI();
        }

        // Install the preferred
        LookAndFeel newLAF = MToolKit.geLookAndFeel(lookAndFeelName);
        frameDecorated = newLAF.getSupportsWindowDecorations();

        /*
         * Make sure we have a nice window decoration.
         */
        JFrame.setDefaultLookAndFeelDecorated(frameDecorated);
        JDialog.setDefaultLookAndFeelDecorated(frameDecorated);
        UIManager.setLookAndFeel(MToolKit.geLookAndFeel(lookAndFeelName));
    }

    // Start main thread
    try {
        new Magic();
        SwingUtilities.invokeLater(SkinLF.REFRESH_RUNNER);
    } catch (Throwable e) {
        Log.fatal("In main thread, occurred exception : ", e);
        ConnectionManager.closeConnexions();
        return;
    }
}

From source file:net.sf.firemox.DeckBuilder.java

/**
 * Load the deck builder from the command line.
 * /*from w w w.ja va  2  s  .c om*/
 * @param args
 *          the command line arguments
 */
public static void main(String[] args) {
    consoleMode = true;
    JFrame.setDefaultLookAndFeelDecorated(true);
    JDialog.setDefaultLookAndFeelDecorated(true);
    autoLoad();
}

From source file:display.containers.FileManager.java

public Container getPane() {
    //if (gui==null) {

    fileSystemView = FileSystemView.getFileSystemView();
    desktop = Desktop.getDesktop();

    JPanel detailView = new JPanel(new BorderLayout(3, 3));
    //fileTableModel = new FileTableModel();

    table = new JTable();
    table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    table.setAutoCreateRowSorter(true);//ww  w .  ja va  2  s. c o m
    table.setShowVerticalLines(false);
    table.addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent e) {
            if (e.getClickCount() >= 2) {
                Point p = e.getPoint();
                int row = table.convertRowIndexToModel(table.rowAtPoint(p));
                int column = table.convertColumnIndexToModel(table.columnAtPoint(p));
                if (row >= 0 && column >= 0) {
                    mouseDblClicked(row, column);
                }
            }
        }
    });
    table.addKeyListener(new KeyListener() {

        @Override
        public void keyTyped(KeyEvent arg0) {

        }

        @Override
        public void keyReleased(KeyEvent arg0) {
            if (KeyEvent.VK_DELETE == arg0.getKeyCode()) {
                if (mode != 2) {
                    parentFrame.setLock(true);
                    parentFrame.getProgressBarPanel().setVisible(true);
                    Thread t = new Thread(new Runnable() {

                        @Override
                        public void run() {
                            try {
                                deleteSelectedFiles();
                            } catch (IOException e) {
                                JOptionPane.showMessageDialog(parentFrame, "Error during the deletion.",
                                        "Deletion error", JOptionPane.ERROR_MESSAGE);
                                WindowManager.mwLogger.log(Level.SEVERE, "Error during the deletion.", e);
                            } finally {
                                parentFrame.setLock(false);
                                refresh();
                                parentFrame.getProgressBarPanel().setVisible(false);
                            }
                        }
                    });
                    t.start();

                } else {
                    if (UserProfile.CURRENT_USER.getLevel() == 3) {
                        parentFrame.setLock(true);
                        parentFrame.getProgressBarPanel().setVisible(true);
                        Thread delThread = new Thread(new Runnable() {

                            @Override
                            public void run() {
                                int[] rows = table.getSelectedRows();
                                int[] columns = table.getSelectedColumns();
                                for (int i = 0; i < rows.length; i++) {
                                    if (!continueAction) {
                                        continueAction = true;
                                        return;
                                    }
                                    int row = table.convertRowIndexToModel(rows[i]);
                                    try {
                                        deleteServerFile(row);
                                    } catch (Exception e) {
                                        WindowManager.mwLogger.log(Level.SEVERE, "Error during the deletion.",
                                                e);
                                    }
                                }
                                refresh();
                                parentFrame.setLock(false);
                                parentFrame.getProgressBarPanel().setVisible(false);
                            }
                        });
                        delThread.start();

                    }
                }
            }
        }

        @Override
        public void keyPressed(KeyEvent arg0) {
            // TODO Auto-generated method stub

        }
    });
    table.getSelectionModel().addListSelectionListener(listSelectionListener);
    JScrollPane tableScroll = new JScrollPane(table);
    Dimension d = tableScroll.getPreferredSize();
    tableScroll.setPreferredSize(new Dimension((int) d.getWidth(), (int) d.getHeight() / 2));
    detailView.add(tableScroll, BorderLayout.CENTER);

    // the File tree
    DefaultMutableTreeNode root = new DefaultMutableTreeNode();
    treeModel = new DefaultTreeModel(root);
    table.getRowSorter().addRowSorterListener(new RowSorterListener() {

        @Override
        public void sorterChanged(RowSorterEvent e) {
            ((FileTableModel) table.getModel()).fireTableDataChanged();
        }
    });

    // show the file system roots.
    File[] roots = fileSystemView.getRoots();
    for (File fileSystemRoot : roots) {
        DefaultMutableTreeNode node = new DefaultMutableTreeNode(fileSystemRoot);
        root.add(node);
        //showChildren(node);
        //
        File[] files = fileSystemView.getFiles(fileSystemRoot, true);
        for (File file : files) {
            if (file.isDirectory()) {
                node.add(new DefaultMutableTreeNode(file));
            }
        }
        //
    }
    JScrollPane treeScroll = new JScrollPane();

    Dimension preferredSize = treeScroll.getPreferredSize();
    Dimension widePreferred = new Dimension(200, (int) preferredSize.getHeight());
    treeScroll.setPreferredSize(widePreferred);

    JPanel fileView = new JPanel(new BorderLayout(3, 3));

    detailView.add(fileView, BorderLayout.SOUTH);

    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, treeScroll, detailView);

    JPanel simpleOutput = new JPanel(new BorderLayout(3, 3));
    progressBar = new JProgressBar();
    simpleOutput.add(progressBar, BorderLayout.EAST);
    progressBar.setVisible(false);
    showChildren(getCurrentDir().toPath());
    //table.setDragEnabled(true);
    table.setColumnSelectionAllowed(false);

    // Menu popup
    Pmenu = new JPopupMenu();
    changeProjectitem = new JMenuItem("Reassign");
    renameProjectitem = new JMenuItem("Rename");
    twitem = new JMenuItem("To workspace");
    tlitem = new JMenuItem("To local");
    processitem = new JMenuItem("Select for process");
    switch (mode) {
    case 0:
        Pmenu.add(twitem);
        twitem.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                parentFrame.getBtnlocalTowork().doClick();
            }
        });
        break;
    case 1:
        Pmenu.add(tlitem);
        Pmenu.add(processitem);
        tlitem.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                parentFrame.getBtnWorkTolocal().doClick();
            }
        });
        processitem.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent arg0) {
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        // Recupere les lignes selectionnees
                        int[] indices = table.getSelectedRows();
                        // On recupere les fichiers correspondants
                        ArrayList<File> files = new ArrayList<File>();
                        for (int i = 0; i < indices.length; i++) {
                            int row = table.convertRowIndexToModel(indices[i]);
                            File fi = ((FileTableModel) table.getModel()).getFile(row);
                            if (fi.isDirectory())
                                files.add(fi);
                        }
                        ImageProcessingFrame imf = new ImageProcessingFrame(files);
                    }
                });

            }
        });
        break;
    case 2:
        if (UserProfile.CURRENT_USER.getLevel() == 3) {
            Pmenu.add(changeProjectitem);
            Pmenu.add(renameProjectitem);
        }
        Pmenu.add(twitem);
        twitem.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                parentFrame.getBtndistToWorkspace().doClick();
            }
        });
        Pmenu.add(tlitem);
        tlitem.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                parentFrame.getBtndistToLocal().doClick();
            }
        });
        break;
    }
    changeProjectitem.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            table.setEnabled(false);
            File from = ((FileTableModel) table.getModel())
                    .getFile(table.convertRowIndexToModel(table.getSelectedRows()[0]));

            ReassignProjectPanel reas = new ReassignProjectPanel(from.toPath()); // mode creation de liens
            Popup popup = PopupFactory.getSharedInstance().getPopup(WindowManager.MAINWINDOW, reas,
                    (int) WindowManager.MAINWINDOW.getX() + 200, (int) WindowManager.MAINWINDOW.getY() + 150);
            reas.setPopupWindow(popup);
            popup.show();
            table.setEnabled(true);
        }
    });
    renameProjectitem.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            table.setEnabled(false);
            final File from = ((FileTableModel) table.getModel())
                    .getFile(table.convertRowIndexToModel(table.getSelectedRows()[0]));
            JDialog.setDefaultLookAndFeelDecorated(true);
            String s = (String) JOptionPane.showInputDialog(WindowManager.MAINWINDOW, "New project name ?",
                    "Rename project", JOptionPane.PLAIN_MESSAGE, null, null, from.getName());

            //If a string was returned, say so.
            if ((s != null) && (s.length() > 0)) {
                ProjectDAO pdao = new MySQLProjectDAO();
                if (new File(from.getParent() + File.separator + s).exists()) {
                    SwingUtilities.invokeLater(new Runnable() {

                        @Override
                        public void run() {
                            JDialog.setDefaultLookAndFeelDecorated(true);
                            JOptionPane.showMessageDialog(WindowManager.MAINWINDOW,
                                    "Couldn't rename " + from.getName()
                                            + " (A file with this filename already exists)",
                                    "Renaming error", JOptionPane.ERROR_MESSAGE);
                        }
                    });
                    WindowManager.mwLogger.log(Level.SEVERE,
                            "Error during file project renaming (" + from.getName() + "). [Duplication error]");
                } else {
                    try {
                        boolean succeed = pdao.renameProject(from.getName(), s);
                        if (!succeed) {
                            SwingUtilities.invokeLater(new Runnable() {

                                @Override
                                public void run() {
                                    JDialog.setDefaultLookAndFeelDecorated(true);
                                    JOptionPane.showMessageDialog(WindowManager.MAINWINDOW,
                                            "Couldn't rename " + from.getName()
                                                    + " (no project with this name)",
                                            "Renaming error", JOptionPane.ERROR_MESSAGE);
                                }
                            });
                        } else {
                            from.renameTo(new File(from.getParent() + File.separator + s));
                            // on renomme le repertoire nifti ou dicom correspondant si il existe
                            switch (from.getParentFile().getName()) {
                            case ServerInfo.NRI_ANALYSE_NAME:
                                if (new File(from.getAbsolutePath().replaceAll(ServerInfo.NRI_ANALYSE_NAME,
                                        ServerInfo.NRI_DICOM_NAME)).exists())
                                    try {
                                        Files.move(Paths.get(from.getAbsolutePath().replaceAll(
                                                ServerInfo.NRI_ANALYSE_NAME, ServerInfo.NRI_DICOM_NAME)),
                                                Paths.get(from.getParent().replaceAll(
                                                        ServerInfo.NRI_ANALYSE_NAME, ServerInfo.NRI_DICOM_NAME)
                                                        + File.separator + s));
                                    } catch (IOException e) {
                                        e.printStackTrace();
                                        SwingUtilities.invokeLater(new Runnable() {

                                            @Override
                                            public void run() {
                                                JDialog.setDefaultLookAndFeelDecorated(true);
                                                JOptionPane.showMessageDialog(WindowManager.MAINWINDOW,
                                                        "Couldn't rename " + from.getName()
                                                                + " (error with file system)",
                                                        "Renaming error", JOptionPane.ERROR_MESSAGE);
                                            }
                                        });
                                        WindowManager.mwLogger.log(Level.SEVERE,
                                                "Error during file project renaming (" + from.getName() + ")",
                                                e);
                                    } //from.renameTo(new File(from.getParent().replaceAll(ServerInfo.NRI_ANALYSE_NAME, ServerInfo.NRI_DICOM_NAME)+File.separator+s));
                                break;
                            case ServerInfo.NRI_DICOM_NAME:
                                if (new File(from.getAbsolutePath().replaceAll(ServerInfo.NRI_DICOM_NAME,
                                        ServerInfo.NRI_ANALYSE_NAME)).exists())
                                    try {
                                        Files.move(Paths.get(from.getAbsolutePath().replaceAll(
                                                ServerInfo.NRI_DICOM_NAME, ServerInfo.NRI_ANALYSE_NAME)),
                                                Paths.get(from.getParent().replaceAll(ServerInfo.NRI_DICOM_NAME,
                                                        ServerInfo.NRI_ANALYSE_NAME) + File.separator + s));
                                    } catch (IOException e) {
                                        SwingUtilities.invokeLater(new Runnable() {

                                            @Override
                                            public void run() {
                                                JDialog.setDefaultLookAndFeelDecorated(true);
                                                JOptionPane.showMessageDialog(WindowManager.MAINWINDOW,
                                                        "Couldn't rename " + from.getName()
                                                                + " (error with file system)",
                                                        "Renaming error", JOptionPane.ERROR_MESSAGE);
                                            }
                                        });
                                        e.printStackTrace();
                                        WindowManager.mwLogger.log(Level.SEVERE,
                                                "Error during file project renaming (" + from.getName() + ")",
                                                e);
                                    } //from.renameTo(new File(from.getParent().replaceAll(ServerInfo.NRI_DICOM_NAME, ServerInfo.NRI_ANALYSE_NAME)+File.separator+s));
                                break;
                            }
                            refresh();
                        }
                    } catch (final SQLException e) {
                        WindowManager.mwLogger.log(Level.SEVERE, "Error during SQL project renaming", e);
                        SwingUtilities.invokeLater(new Runnable() {

                            @Override
                            public void run() {
                                JDialog.setDefaultLookAndFeelDecorated(true);
                                JOptionPane.showMessageDialog(WindowManager.MAINWINDOW,
                                        "Exception : " + e.toString(), "Openning error",
                                        JOptionPane.ERROR_MESSAGE);
                            }
                        });
                    }
                }
            }
            table.setEnabled(true);
        }
    });
    table.addMouseListener(new MouseListener() {

        public void mouseClicked(MouseEvent me) {

        }

        public void mouseEntered(MouseEvent e) {
        }

        public void mouseExited(MouseEvent e) {
        }

        public void mousePressed(MouseEvent e) {
        }

        public void mouseReleased(MouseEvent me) {
            if (me.getButton() == 3 && table.getSelectedRowCount() > 0) {
                int row = table.convertRowIndexToModel(table.rowAtPoint(me.getPoint()));
                changeProjectitem.setVisible(isPatient(((FileTableModel) table.getModel()).getFile(row)));
                renameProjectitem.setVisible(isProject(((FileTableModel) table.getModel()).getFile(row)));
                Pmenu.show(me.getComponent(), me.getX(), me.getY());
            }
        }
    });
    //

    //}
    return tableScroll;
}

From source file:UserInterface.FinanceRole.TransferToRegSiteJPanel.java

private void autoTransferJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_autoTransferJButtonActionPerformed

    //Validation//w w w  .j  av a 2s  .  c o m
    boolean validationSuccess;
    validationSuccess = validationAutoTansfer();

    if (validationSuccess) {

        objWorldEnterprise.getObjTransactionDirectory().updateTransactionAccount();

        BigDecimal worldDonation = AutoTransfer.transferCheck(objWorldEnterprise, objUserAccount,
                autoDonationAmount);
        BigDecimal worldBalance = objWorldEnterprise.getObjTransactionDirectory().getAvailableRealBalance();
        System.out.println(worldDonation);

        System.out.println(objWorldEnterprise.getObjTransactionDirectory().getAvailableRealBalance());
        System.out.println(objWorldEnterprise.getObjTransactionDirectory().getAvailableVirtualBalance());

        int positiveWorldBalance = worldBalance.compareTo(worldDonation);

        if (positiveWorldBalance >= 1) {
            JDialog.setDefaultLookAndFeelDecorated(true);

            int response = JOptionPane.showConfirmDialog(null,
                    "Total transfer of $ " + worldDonation + "/- Do you want to transfer?", "Confirm",
                    JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
            if (response == JOptionPane.YES_OPTION) {
                System.out.println("Yes button clicked");
                worldDonation = AutoTransfer.transferConfirm(objWorldEnterprise, objUserAccount,
                        autoDonationAmount);

                JOptionPane.showMessageDialog(null, "$ " + worldDonation + "/- transferred successfully");

                autoTransferJTextField.setText(null);

                populateLowRegSiteTable();
            }
        } else {
            JOptionPane.showMessageDialog(null, "World Balance is low");
        }
    }
}

From source file:com.github.lindenb.jvarkit.tools.bamviewgui.BamFileRef.java

@Override
public Collection<Throwable> call() throws Exception {
    JFrame.setDefaultLookAndFeelDecorated(true);
    JDialog.setDefaultLookAndFeelDecorated(true);
    List<BamFileRef> bams = new ArrayList<BamFileRef>();

    final List<String> args = getInputFiles();
    List<File> IN = new ArrayList<File>();

    if (args.isEmpty()) {
        LOG.info("NO BAM provided; Opening dialog");
        JFileChooser chooser = new JFileChooser();
        chooser.setFileFilter(new FileFilter() {
            @Override/*w w w.  j  a v  a  2  s. c om*/
            public String getDescription() {
                return "Indexed BAM files.";
            }

            @Override
            public boolean accept(File f) {
                if (f.isDirectory())
                    return true;
                return acceptBam(f);
            };
        });
        chooser.setMultiSelectionEnabled(true);
        if (chooser.showOpenDialog(null) != JFileChooser.APPROVE_OPTION) {
            return wrapException("user pressed cancel");
        }
        File fs[] = chooser.getSelectedFiles();
        if (fs != null)
            IN.addAll(Arrays.asList(chooser.getSelectedFiles()));
    } else {
        for (String arg : args) {
            File filename = new File(arg);
            if (!acceptBam(filename)) {
                return wrapException(
                        "Cannot use " + filename + " as input Bam. bad extenstion ? index missing ?");
            }
            IN.add(filename);
        }
    }

    for (File in : IN) {
        try {
            bams.add(create(in));
        } catch (Exception err) {
            return wrapException(err);
        }
    }
    if (bams.isEmpty()) {
        return wrapException("No Bam file");
    }
    LOG.info("showing BAM frame");
    final BamFrame frame = new BamFrame(bams);
    frame.igvIP = super.IGV_HOST;
    frame.igvPort = super.IGV_PORT;
    try {
        SwingUtilities.invokeAndWait(new Runnable() {
            @Override
            public void run() {
                Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
                frame.setBounds(50, 50, screen.width - 100, screen.height - 100);
                frame.setVisible(true);
            }
        });
    } catch (Exception err) {
        err.printStackTrace();
        System.exit(-1);
    }

    return RETURN_OK;
}