Example usage for java.awt Cursor HAND_CURSOR

List of usage examples for java.awt Cursor HAND_CURSOR

Introduction

In this page you can find the example usage for java.awt Cursor HAND_CURSOR.

Prototype

int HAND_CURSOR

To view the source code for java.awt Cursor HAND_CURSOR.

Click Source Link

Document

The hand cursor type.

Usage

From source file:op.care.prescription.PnlPrescription.java

private CollapsiblePane createCP4(final Prescription prescription) {
    /***/* w  w  w  . j a va  2 s.co  m*/
     *                          _        ____ ____  _  _    ______                          _       _   _           __
     *       ___ _ __ ___  __ _| |_ ___ / ___|  _ \| || |  / /  _ \ _ __ ___  ___  ___ _ __(_)_ __ | |_(_) ___  _ __\ \
     *      / __| '__/ _ \/ _` | __/ _ \ |   | |_) | || |_| || |_) | '__/ _ \/ __|/ __| '__| | '_ \| __| |/ _ \| '_ \| |
     *     | (__| | |  __/ (_| | ||  __/ |___|  __/|__   _| ||  __/| | |  __/\__ \ (__| |  | | |_) | |_| | (_) | | | | |
     *      \___|_|  \___|\__,_|\__\___|\____|_|      |_| | ||_|   |_|  \___||___/\___|_|  |_| .__/ \__|_|\___/|_| |_| |
     *                                                     \_\                               |_|                    /_/
     */
    final String key = prescription.getID() + ".xprescription";
    if (!cpMap.containsKey(key)) {
        cpMap.put(key, new CollapsiblePane());
        try {
            cpMap.get(key).setCollapsed(true);
        } catch (PropertyVetoException e) {
            e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
        }
    }
    final CollapsiblePane cpPres = cpMap.get(key);

    String title = "<html><table border=\"0\">" + "<tr valign=\"top\">" + "<td width=\"280\" align=\"left\">"
            + prescription.getPITAsHTML() + "</td>" + "<td width=\"380\" align=\"left\">" + "<font size=+1>"
            + PrescriptionTools.getShortDescription(prescription) + "</font>"
            + PrescriptionTools.getDoseAsHTML(prescription)
            + PrescriptionTools.getInventoryInformationAsHTML(prescription) + "</td>"
            + "<td width=\"200\" align=\"left\">" + PrescriptionTools.getOriginalPrescription(prescription)
            + PrescriptionTools.getRemark(prescription) + "</td>";

    if (!prescription.getCommontags().isEmpty()) {
        title += "<tr>" + "    <td colspan=\"3\">" + CommontagsTools.getAsHTML(prescription.getCommontags(),
                SYSConst.html_16x16_tagPurple_internal) + "</td>" + "  </tr>";
    }

    if (PrescriptionTools.isAnnotationNecessary(prescription)) {
        title += "<tr>" + "    <td colspan=\"3\">" + PrescriptionTools.getAnnontationsAsHTML(prescription)
                + "</td>" + "  </tr>";
    }

    title += "</table>" + "</html>";

    DefaultCPTitle cptitle = new DefaultCPTitle(title, null);
    cpPres.setCollapsible(false);
    cptitle.getButton().setIcon(getIcon(prescription));

    cpPres.setTitleLabelComponent(cptitle.getMain());
    cpPres.setSlidingDirection(SwingConstants.SOUTH);

    if (!prescription.getAttachedFilesConnections().isEmpty()) {
        /***
         *      _     _         _____ _ _
         *     | |__ | |_ _ __ |  ___(_) | ___  ___
         *     | '_ \| __| '_ \| |_  | | |/ _ \/ __|
         *     | |_) | |_| | | |  _| | | |  __/\__ \
         *     |_.__/ \__|_| |_|_|   |_|_|\___||___/
         *
         */
        final JButton btnFiles = new JButton(
                Integer.toString(prescription.getAttachedFilesConnections().size()), SYSConst.icon22greenStar);
        btnFiles.setToolTipText(SYSTools.xx("misc.btnfiles.tooltip"));
        btnFiles.setForeground(Color.BLUE);
        btnFiles.setHorizontalTextPosition(SwingUtilities.CENTER);
        btnFiles.setFont(SYSConst.ARIAL18BOLD);
        btnFiles.setPressedIcon(SYSConst.icon22Pressed);
        btnFiles.setAlignmentX(Component.RIGHT_ALIGNMENT);
        btnFiles.setAlignmentY(Component.TOP_ALIGNMENT);
        btnFiles.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        btnFiles.setContentAreaFilled(false);
        btnFiles.setBorder(null);

        btnFiles.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent actionEvent) {
                // checked for acls
                Closure fileHandleClosure = OPDE.getAppInfo().isAllowedTo(InternalClassACL.UPDATE,
                        internalClassID) ? null : new Closure() {
                            @Override
                            public void execute(Object o) {
                                EntityManager em = OPDE.createEM();
                                final Prescription myPrescription = em.find(Prescription.class,
                                        prescription.getID());
                                em.close();
                                lstPrescriptions.remove(prescription);
                                lstPrescriptions.add(myPrescription);
                                Collections.sort(lstPrescriptions);
                                final CollapsiblePane myCP = createCP4(myPrescription);
                                buildPanel();
                                GUITools.flashBackground(myCP, Color.YELLOW, 2);
                            }
                        };
                new DlgFiles(prescription, fileHandleClosure);
            }
        });
        btnFiles.setEnabled(OPDE.isFTPworking());
        cptitle.getRight().add(btnFiles);
    }

    if (!prescription.getAttachedProcessConnections().isEmpty()) {
        /***
         *      _     _         ____
         *     | |__ | |_ _ __ |  _ \ _ __ ___   ___ ___  ___ ___
         *     | '_ \| __| '_ \| |_) | '__/ _ \ / __/ _ \/ __/ __|
         *     | |_) | |_| | | |  __/| | | (_) | (_|  __/\__ \__ \
         *     |_.__/ \__|_| |_|_|   |_|  \___/ \___\___||___/___/
         *
         */
        final JButton btnProcess = new JButton(
                Integer.toString(prescription.getAttachedProcessConnections().size()), SYSConst.icon22redStar);
        btnProcess.setToolTipText(SYSTools.xx("misc.btnprocess.tooltip"));
        btnProcess.setForeground(Color.YELLOW);
        btnProcess.setHorizontalTextPosition(SwingUtilities.CENTER);
        btnProcess.setFont(SYSConst.ARIAL18BOLD);
        btnProcess.setPressedIcon(SYSConst.icon22Pressed);
        btnProcess.setAlignmentX(Component.RIGHT_ALIGNMENT);
        btnProcess.setAlignmentY(Component.TOP_ALIGNMENT);
        btnProcess.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        btnProcess.setContentAreaFilled(false);
        btnProcess.setBorder(null);
        btnProcess.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent actionEvent) {
                new DlgProcessAssign(prescription, new Closure() {
                    @Override
                    public void execute(Object o) {
                        if (o == null) {
                            return;
                        }
                        Pair<ArrayList<QProcess>, ArrayList<QProcess>> result = (Pair<ArrayList<QProcess>, ArrayList<QProcess>>) o;

                        ArrayList<QProcess> assigned = result.getFirst();
                        ArrayList<QProcess> unassigned = result.getSecond();

                        EntityManager em = OPDE.createEM();

                        try {
                            em.getTransaction().begin();

                            em.lock(em.merge(resident), LockModeType.OPTIMISTIC);
                            Prescription myPrescription = em.merge(prescription);
                            em.lock(myPrescription, LockModeType.OPTIMISTIC_FORCE_INCREMENT);

                            ArrayList<SYSPRE2PROCESS> attached = new ArrayList<SYSPRE2PROCESS>(
                                    prescription.getAttachedProcessConnections());
                            for (SYSPRE2PROCESS linkObject : attached) {
                                if (unassigned.contains(linkObject.getQProcess())) {
                                    linkObject.getQProcess().getAttachedNReportConnections().remove(linkObject);
                                    linkObject.getPrescription().getAttachedProcessConnections()
                                            .remove(linkObject);
                                    em.merge(new PReport(
                                            SYSTools.xx(PReportTools.PREPORT_TEXT_REMOVE_ELEMENT) + ": "
                                                    + myPrescription.getTitle() + " ID: "
                                                    + myPrescription.getID(),
                                            PReportTools.PREPORT_TYPE_REMOVE_ELEMENT,
                                            linkObject.getQProcess()));
                                    em.remove(linkObject);
                                }
                            }
                            attached.clear();

                            for (QProcess qProcess : assigned) {
                                List<QProcessElement> listElements = qProcess.getElements();
                                if (!listElements.contains(myPrescription)) {
                                    QProcess myQProcess = em.merge(qProcess);
                                    SYSPRE2PROCESS myLinkObject = em
                                            .merge(new SYSPRE2PROCESS(myQProcess, myPrescription));
                                    em.merge(new PReport(
                                            SYSTools.xx(PReportTools.PREPORT_TEXT_ASSIGN_ELEMENT) + ": "
                                                    + myPrescription.getTitle() + " ID: "
                                                    + myPrescription.getID(),
                                            PReportTools.PREPORT_TYPE_ASSIGN_ELEMENT, myQProcess));
                                    qProcess.getAttachedPrescriptionConnections().add(myLinkObject);
                                    myPrescription.getAttachedProcessConnections().add(myLinkObject);
                                }
                            }

                            em.getTransaction().commit();

                            lstPrescriptions.remove(prescription);
                            lstPrescriptions.add(myPrescription);
                            Collections.sort(lstPrescriptions);
                            final CollapsiblePane myCP = createCP4(myPrescription);
                            buildPanel();
                            GUITools.flashBackground(myCP, Color.YELLOW, 2);

                        } catch (OptimisticLockException ole) {
                            OPDE.warn(ole);
                            if (em.getTransaction().isActive()) {
                                em.getTransaction().rollback();
                            }
                            if (ole.getMessage().indexOf("Class> entity.info.Resident") > -1) {
                                OPDE.getMainframe().emptyFrame();
                                OPDE.getMainframe().afterLogin();
                            }
                            OPDE.getDisplayManager().addSubMessage(DisplayManager.getLockMessage());
                        } catch (RollbackException ole) {
                            if (em.getTransaction().isActive()) {
                                em.getTransaction().rollback();
                            }
                            if (ole.getMessage().indexOf("Class> entity.info.Resident") > -1) {
                                OPDE.getMainframe().emptyFrame();
                                OPDE.getMainframe().afterLogin();
                            }
                            OPDE.getDisplayManager().addSubMessage(DisplayManager.getLockMessage());
                        } catch (Exception e) {
                            if (em.getTransaction().isActive()) {
                                em.getTransaction().rollback();
                            }
                            OPDE.fatal(e);
                        } finally {
                            em.close();
                        }

                    }
                });
            }
        });
        // checked for acls
        btnProcess.setEnabled(OPDE.getAppInfo().isAllowedTo(InternalClassACL.UPDATE, internalClassID));
        cptitle.getRight().add(btnProcess);
    }

    /***
     *      __  __
     *     |  \/  | ___ _ __  _   _
     *     | |\/| |/ _ \ '_ \| | | |
     *     | |  | |  __/ | | | |_| |
     *     |_|  |_|\___|_| |_|\__,_|
     *
     */
    final JButton btnMenu = new JButton(SYSConst.icon22menu);
    btnMenu.setPressedIcon(SYSConst.icon22Pressed);
    btnMenu.setAlignmentX(Component.RIGHT_ALIGNMENT);
    btnMenu.setAlignmentY(Component.TOP_ALIGNMENT);
    btnMenu.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    btnMenu.setContentAreaFilled(false);
    btnMenu.setBorder(null);
    btnMenu.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            JidePopup popup = new JidePopup();
            popup.setMovable(false);
            popup.getContentPane().setLayout(new BoxLayout(popup.getContentPane(), BoxLayout.LINE_AXIS));
            popup.setOwner(btnMenu);
            popup.removeExcludedComponent(btnMenu);
            JPanel pnl = getMenu(prescription);
            popup.getContentPane().add(pnl);
            popup.setDefaultFocusComponent(pnl);

            GUITools.showPopup(popup, SwingConstants.WEST);
        }
    });
    cptitle.getRight().add(btnMenu);

    cpPres.setHorizontalAlignment(SwingConstants.LEADING);
    cpPres.setOpaque(false);

    return cpPres;
}

From source file:apidemo.PanScrollZoomDemo.java

/**
 * Sets the pan mode./*  w  w  w . j  av  a2  s  .  c  om*/
 * 
 * @param val  a boolean.
 */
private void setPanMode(final boolean val) {

    //        this.chartPanel.setHorizontalZoom(!val);
    // chartPanel.setHorizontalAxisTrace(! val);
    //      this.chartPanel.setVerticalZoom(!val);
    // chartPanel.setVerticalAxisTrace(! val);

    if (val) {
        this.chartPanel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    } else {
        this.chartPanel.setCursor(Cursor.getDefaultCursor());
    }
}

From source file:org.yccheok.jstock.gui.SaveToCloudJDialog.java

private void jLabel9MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel9MouseEntered
    this.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}

From source file:org.tinymediamanager.ui.moviesets.dialogs.MovieSetEditorDialog.java

/**
 * Instantiates a new movie set editor.// w  w  w  .ja  va 2  s . c  om
 * 
 * @param movieSet
 *          the movie set
 * @param inQueue
 *          the in queue
 */
public MovieSetEditorDialog(MovieSet movieSet, boolean inQueue) {
    super(BUNDLE.getString("movieset.edit"), "movieSetEditor"); //$NON-NLS-1$
    setBounds(5, 5, 800, 500);

    movieSetToEdit = movieSet;
    try {
        List<String> enabledScrapers = new ArrayList<>();
        if (MovieModuleManager.MOVIE_SETTINGS.getMovieArtworkScrapers().contains(Constants.TMDB)) {
            enabledScrapers.add(Constants.TMDB);
        }
        if (MovieModuleManager.MOVIE_SETTINGS.getMovieArtworkScrapers().contains(Constants.FANART_TV)) {
            enabledScrapers.add(Constants.FANART_TV);
        }
        artworkScrapers.addAll(movieList.getArtworkScrapers(enabledScrapers));
        // artworkScrapers.addAll(movieList.getArtworkScrapers(Arrays.asList(Constants.TMDB, Constants.FANART_TV)));
    } catch (Exception e2) {
        LOGGER.warn("error getting IMediaArtworkProvider " + e2.getMessage());
    }

    getContentPane().setLayout(new BorderLayout());
    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.NORTH);
    getContentPane().add(tabbedPane, BorderLayout.CENTER);

    JPanel panelContent = new JPanel();
    panelContent.setLayout(new FormLayout(new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC,
            FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("100px"),
            FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("300px:grow"), FormFactory.RELATED_GAP_COLSPEC,
            ColumnSpec.decode("250px:grow"), FormFactory.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormFactory.NARROW_LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                    FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                    FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("75px:grow"),
                    FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                    FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                    FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                    FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                    FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"),
                    FormFactory.NARROW_LINE_GAP_ROWSPEC, }));

    tabbedPane.addTab(BUNDLE.getString("metatag.details"), panelContent); //$NON-NLS-1$

    JLabel lblName = new JLabel(BUNDLE.getString("movieset.title")); //$NON-NLS-1$
    panelContent.add(lblName, "2, 2, right, default");

    tfName = new JTextField();
    panelContent.add(tfName, "4, 2, 3, 1, fill, default");
    tfName.setColumns(10);

    lblPoster = new ImageLabel();
    lblPoster.setAlternativeText(BUNDLE.getString("image.notfound.poster")); //$NON-NLS-1$
    lblPoster.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            int tmdbId = 0;
            try {
                tmdbId = Integer.parseInt(tfTmdbId.getText());
            } catch (Exception e1) {
            }
            HashMap<String, Object> ids = new HashMap<>(movieSetToEdit.getIds());
            ids.put(Constants.TMDB, tmdbId);
            // MovieSetImageChooserDialog dialog = new MovieSetImageChooserDialog(tmdbId, ImageType.POSTER, lblPoster);
            ImageChooserDialog dialog = new ImageChooserDialog(ids, ImageType.POSTER, artworkScrapers,
                    lblPoster, null, null, MediaType.MOVIE_SET);
            dialog.setLocationRelativeTo(MainWindow.getActiveInstance());
            dialog.setVisible(true);
        }
    });
    panelContent.add(lblPoster, "8, 2, 1, 9, fill, fill");

    JLabel lblTmdbid = new JLabel(BUNDLE.getString("metatag.tmdb")); //$NON-NLS-1$
    panelContent.add(lblTmdbid, "2, 4, right, default");

    tfTmdbId = new JTextField();
    panelContent.add(tfTmdbId, "4, 4, fill, default");
    tfTmdbId.setColumns(10);

    JButton btnSearchTmdbId = new JButton("");
    btnSearchTmdbId.setAction(actionSearchTmdbId);
    panelContent.add(btnSearchTmdbId, "6, 4, left, default");

    JLabel lblOverview = new JLabel(BUNDLE.getString("metatag.plot")); //$NON-NLS-1$
    panelContent.add(lblOverview, "2, 6, right, top");

    JScrollPane scrollPaneOverview = new JScrollPane();
    panelContent.add(scrollPaneOverview, "4, 6, 3, 1, fill, fill");

    tpOverview = new JTextPane();
    scrollPaneOverview.setViewportView(tpOverview);

    JLabel lblMovies = new JLabel(BUNDLE.getString("tmm.movies")); //$NON-NLS-1$
    panelContent.add(lblMovies, "2, 8, right, top");

    JScrollPane scrollPaneMovies = new JScrollPane();
    panelContent.add(scrollPaneMovies, "4, 8, 3, 9, fill, fill");

    tableMovies = new JTable();
    scrollPaneMovies.setViewportView(tableMovies);

    JButton btnRemoveMovie = new JButton("");
    btnRemoveMovie.setAction(actionRemoveMovie);
    panelContent.add(btnRemoveMovie, "2, 10, right, top");

    lblFanart = new ImageLabel();
    lblFanart.setAlternativeText(BUNDLE.getString("image.notfound.fanart")); //$NON-NLS-1$
    lblFanart.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            int tmdbId = 0;
            try {
                tmdbId = Integer.parseInt(tfTmdbId.getText());
            } catch (Exception e1) {
            }
            HashMap<String, Object> ids = new HashMap<>(movieSetToEdit.getIds());
            ids.put(Constants.TMDB, tmdbId);
            ImageChooserDialog dialog = new ImageChooserDialog(ids, ImageType.FANART, artworkScrapers,
                    lblFanart, null, null, MediaType.MOVIE_SET);
            dialog.setLocationRelativeTo(MainWindow.getActiveInstance());
            dialog.setVisible(true);
        }
    });
    panelContent.add(lblFanart, "8, 12, 1, 5, fill, fill");

    /**
     * Artwork pane
     */
    {
        JPanel artworkPanel = new JPanel();
        tabbedPane.addTab(BUNDLE.getString("metatag.extraartwork"), null, artworkPanel, null); //$NON-NLS-1$
        artworkPanel.setLayout(new FormLayout(
                new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("250px:grow"),
                        FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("250px:grow"),
                        FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("150px:grow"),
                        FormFactory.RELATED_GAP_COLSPEC, },
                new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                        FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("50px:grow(2)"),
                        FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                        FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("200px:grow(2)"),
                        FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), }));
        {
            JLabel lblLogoT = new JLabel(BUNDLE.getString("mediafiletype.logo")); //$NON-NLS-1$
            artworkPanel.add(lblLogoT, "2, 2");
        }
        {
            lblLogo = new ImageLabel();
            lblLogo.setAlternativeText(BUNDLE.getString("image.notfound.logo")); //$NON-NLS-1$
            lblLogo.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    ImageChooserDialog dialog = new ImageChooserDialog(movieSetToEdit.getIds(), ImageType.LOGO,
                            movieList.getDefaultArtworkScrapers(), lblLogo, null, null, MediaType.MOVIE);
                    dialog.setLocationRelativeTo(MainWindow.getActiveInstance());
                    dialog.setVisible(true);
                }
            });
            {
                final JLabel lblClearlogoT = new JLabel(BUNDLE.getString("mediafiletype.clearlogo")); //$NON-NLS-1$
                artworkPanel.add(lblClearlogoT, "4, 2");
            }
            lblLogo.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            artworkPanel.add(lblLogo, "2, 4, fill, fill");
        }
        {
            lblClearlogo = new ImageLabel();
            lblClearlogo.setAlternativeText(BUNDLE.getString("image.notfound.clearlogo")); //$NON-NLS-1$
            lblClearlogo.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    ImageChooserDialog dialog = new ImageChooserDialog(movieSetToEdit.getIds(),
                            ImageType.CLEARLOGO, movieList.getDefaultArtworkScrapers(), lblClearlogo, null,
                            null, MediaType.MOVIE);
                    dialog.setLocationRelativeTo(MainWindow.getActiveInstance());
                    dialog.setVisible(true);
                }
            });
            lblClearlogo.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            artworkPanel.add(lblClearlogo, "4, 4, fill, fill");
        }

        {
            JLabel lblClearartT = new JLabel(BUNDLE.getString("mediafiletype.clearart")); //$NON-NLS-1$
            artworkPanel.add(lblClearartT, "2, 6");
        }
        {
            lblClearart = new ImageLabel();
            lblClearart.setAlternativeText(BUNDLE.getString("image.notfound.clearart")); //$NON-NLS-1$
            lblClearart.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    ImageChooserDialog dialog = new ImageChooserDialog(movieSetToEdit.getIds(),
                            ImageType.CLEARART, movieList.getDefaultArtworkScrapers(), lblClearart, null, null,
                            MediaType.MOVIE);
                    dialog.setLocationRelativeTo(MainWindow.getActiveInstance());
                    dialog.setVisible(true);
                }
            });
            {
                JLabel lblBannerT = new JLabel(BUNDLE.getString("mediafiletype.banner")); //$NON-NLS-1$
                artworkPanel.add(lblBannerT, "4, 6");
            }
            lblClearart.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            artworkPanel.add(lblClearart, "2, 8, fill, fill");
        }
        {
            lblBanner = new ImageLabel();
            lblBanner.setAlternativeText(BUNDLE.getString("image.notfound.banner")); //$NON-NLS-1$
            lblBanner.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    ImageChooserDialog dialog = new ImageChooserDialog(movieSetToEdit.getIds(),
                            ImageType.BANNER, movieList.getDefaultArtworkScrapers(), lblBanner, null, null,
                            MediaType.MOVIE);
                    dialog.setLocationRelativeTo(MainWindow.getActiveInstance());
                    dialog.setVisible(true);
                }
            });
            lblBanner.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            artworkPanel.add(lblBanner, "4, 8, 3, 1, fill, fill");
        }

        // extra artwork
        lblBanner.setImagePath(movieSetToEdit.getArtworkFilename(MediaFileType.BANNER));
    }

    /**
     * Button pane
     */
    {
        JPanel buttonPane = new JPanel();
        getContentPane().add(buttonPane, BorderLayout.SOUTH);
        EqualsLayout layout = new EqualsLayout(5);
        buttonPane.setBorder(new EmptyBorder(4, 4, 4, 4));
        layout.setMinWidth(100);
        buttonPane.setLayout(layout);
        {
            JButton btnOk = new JButton(BUNDLE.getString("Button.ok")); //$NON-NLS-1$
            btnOk.setAction(actionOk);
            buttonPane.add(btnOk);
            getRootPane().setDefaultButton(btnOk);

            JButton btnCancel = new JButton(BUNDLE.getString("Button.cancel")); //$NON-NLS-1$
            btnCancel.setAction(actionCancel);
            buttonPane.add(btnCancel);

            if (inQueue) {
                JButton abortButton = new JButton(BUNDLE.getString("Button.abortqueue")); //$NON-NLS-1$
                buttonPane.add(abortButton);
                abortButton.setAction(actionAbort);
            }
        }

    }

    {
        tfName.setText(movieSetToEdit.getTitle());
        tfTmdbId.setText(String.valueOf(movieSetToEdit.getTmdbId()));
        tpOverview.setText(movieSetToEdit.getPlot());
        moviesInSet.addAll(movieSetToEdit.getMovies());

        if (StringUtils.isNotBlank(movieSetToEdit.getArtworkFilename(MediaFileType.POSTER))) {
            lblPoster.setImagePath(movieSetToEdit.getArtworkFilename(MediaFileType.POSTER));
        } else {
            lblPoster.setImageUrl(movieSetToEdit.getArtworkUrl(MediaFileType.POSTER));
        }

        if (StringUtils.isNotBlank(movieSetToEdit.getArtworkFilename(MediaFileType.FANART))) {
            lblFanart.setImagePath(movieSetToEdit.getArtworkFilename(MediaFileType.FANART));
        } else {
            lblFanart.setImageUrl(movieSetToEdit.getArtworkUrl(MediaFileType.FANART));
        }
        lblLogo.setImagePath(movieSetToEdit.getArtworkFilename(MediaFileType.LOGO));
        lblClearlogo.setImagePath(movieSetToEdit.getArtworkFilename(MediaFileType.CLEARLOGO));
        lblClearart.setImagePath(movieSetToEdit.getArtworkFilename(MediaFileType.CLEARART));
    }

    initDataBindings();

    // adjust table columns
    // name column
    tableMovies.getTableHeader().getColumnModel().getColumn(0).setHeaderValue(BUNDLE.getString("metatag.name"));

    // year column
    int width = tableMovies.getFontMetrics(tableMovies.getFont()).stringWidth(" 2000");
    int titleWidth = tableMovies.getFontMetrics(tableMovies.getFont())
            .stringWidth(BUNDLE.getString("metatag.year")); //$NON-NLS-1$
    if (titleWidth > width) {
        width = titleWidth;
    }
    tableMovies.getTableHeader().getColumnModel().getColumn(1).setPreferredWidth(width);
    tableMovies.getTableHeader().getColumnModel().getColumn(1).setMinWidth(width);
    tableMovies.getTableHeader().getColumnModel().getColumn(1).setMaxWidth((int) (width * 1.5));
    tableMovies.getTableHeader().getColumnModel().getColumn(1).setHeaderValue(BUNDLE.getString("metatag.year"));

    // watched column
    tableMovies.getTableHeader().getColumnModel().getColumn(2).setPreferredWidth(70);
    tableMovies.getTableHeader().getColumnModel().getColumn(2).setMinWidth(70);
    tableMovies.getTableHeader().getColumnModel().getColumn(2).setMaxWidth(85);
    tableMovies.getTableHeader().getColumnModel().getColumn(2)
            .setHeaderValue(BUNDLE.getString("metatag.watched"));
}

From source file:net.technicpack.launcher.ui.InstallerFrame.java

private void initComponents() {
    setSize(DIALOG_WIDTH, DIALOG_HEIGHT);
    setIconImage(resources.getImage("icon.png"));
    setLayout(new BorderLayout());

    JPanel header = new JPanel();
    header.setBackground(Color.black);
    header.setLayout(new BoxLayout(header, BoxLayout.LINE_AXIS));
    header.setBorder(BorderFactory.createEmptyBorder(4, 8, 4, 8));
    add(header, BorderLayout.PAGE_START);

    JLabel title = new JLabel(resources.getString("launcher.installer.title"));
    title.setFont(resources.getFont(ResourceLoader.FONT_RALEWAY, 34));
    title.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    title.setOpaque(false);// ww  w . j av a 2s .c  o m
    title.setIcon(resources.getIcon("options_cog.png"));
    header.add(title);

    header.add(Box.createHorizontalGlue());

    JButton closeButton = new JButton();
    closeButton.setIcon(resources.getIcon("close.png"));
    closeButton.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    closeButton.setContentAreaFilled(false);
    closeButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    closeButton.setFocusPainted(false);
    closeButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            mainFrame.setVisible(true);
            dispose();
        }
    });
    header.add(closeButton);

    SimpleTabPane centerPanel = new SimpleTabPane();
    centerPanel.setBackground(LauncherFrame.COLOR_FORMELEMENT_INTERNAL);
    centerPanel.setForeground(LauncherFrame.COLOR_GREY_TEXT);
    centerPanel.setSelectedBackground(LauncherFrame.COLOR_BLUE);
    centerPanel.setSelectedForeground(LauncherFrame.COLOR_WHITE_TEXT);
    centerPanel.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 14));
    centerPanel.setOpaque(true);
    add(centerPanel, BorderLayout.CENTER);

    JPanel standardInstallPanel = new JPanel();
    standardInstallPanel.setBackground(LauncherFrame.COLOR_CENTRAL_BACK_OPAQUE);

    setupStandardInstall(standardInstallPanel);

    JPanel portableModePanel = new JPanel();
    portableModePanel.setBackground(LauncherFrame.COLOR_CENTRAL_BACK_OPAQUE);

    setupPortableMode(portableModePanel);

    centerPanel.addTab(resources.getString("launcher.installer.standard").toUpperCase(), standardInstallPanel);
    centerPanel.addTab(resources.getString("launcher.installer.portable").toUpperCase(), portableModePanel);

    if (settings.isPortable()) {
        centerPanel.setSelectedIndex(1);
    } else
        centerPanel.setSelectedIndex(0);

    setLocationRelativeTo(null);
}

From source file:op.care.values.PnlValues.java

private CollapsiblePane createCP4Type(final ResValueTypes vtype) {
    final String keyType = vtype.getID() + ".xtypes";
    final CollapsiblePane cpType = getCP(keyType);

    final DefaultCPTitle cptitle = new DefaultCPTitle(vtype.getText(), new ActionListener() {
        @Override//from  w  w  w  . jav  a  2 s. c o m
        public void actionPerformed(ActionEvent e) {
            try {
                cpType.setCollapsed(!cpType.isCollapsed());
            } catch (PropertyVetoException pve) {
                // BAH!
            }
        }
    });
    cptitle.getButton().setFont(SYSConst.ARIAL24);
    cptitle.getButton().setForeground(vtype.getColor());
    cpType.setBackground(Color.white);

    cpType.setTitleLabelComponent(cptitle.getMain());
    cpType.setSlidingDirection(SwingConstants.SOUTH);

    if (OPDE.getAppInfo().isAllowedTo(InternalClassACL.UPDATE, internalClassID)) {
        /***
         *         _       _     _    __                  _____               __
         *        / \   __| | __| |  / /_ __   ___ _ __  |_   _|   _ _ __   __\ \
         *       / _ \ / _` |/ _` | | || '_ \ / _ \ '__|   | || | | | '_ \ / _ \ |
         *      / ___ \ (_| | (_| | | || |_) |  __/ |      | || |_| | |_) |  __/ |
         *     /_/   \_\__,_|\__,_| | || .__/ \___|_|      |_| \__, | .__/ \___| |
         *                           \_\_|                     |___/|_|       /_/
         */
        final JButton btnAdd = new JButton(SYSConst.icon22add);
        btnAdd.setPressedIcon(SYSConst.icon22addPressed);
        btnAdd.setAlignmentX(Component.RIGHT_ALIGNMENT);
        btnAdd.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        btnAdd.setContentAreaFilled(false);
        btnAdd.setBorder(null);
        btnAdd.setToolTipText(
                SYSTools.xx("nursingrecords.vitalparameters.btnAdd.tooltip") + " (" + vtype.getText() + ")");
        btnAdd.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent actionEvent) {
                addValue(vtype);
            }
        });
        cptitle.getRight().add(btnAdd);
        btnAdd.setEnabled(resident.isActive());
    }

    cpType.addCollapsiblePaneListener(new CollapsiblePaneAdapter() {
        @Override
        public void paneExpanded(CollapsiblePaneEvent collapsiblePaneEvent) {
            cpType.setContentPane(createContentPanel4Type(vtype));
        }
    });

    if (!cpType.isCollapsed()) {
        cpType.setContentPane(createContentPanel4Type(vtype));
    }

    if (!ResValueTools.getYearsWithValues(resident, vtype).isEmpty()) {
        //            cptitle.getTitleButton().setIcon(SYSConst.icon22ledGreenOn);
        cpType.setCollapsible(true);
    } else {
        //            cptitle.getTitleButton().setIcon(SYSConst.icon22ledGreenOff);
        cpType.setCollapsible(false);
    }

    cpType.setHorizontalAlignment(SwingConstants.LEADING);
    cpType.setOpaque(false);
    //        cpType.setBackground(getColor(vtype, SYSConst.medium1));

    return cpType;
}

From source file:com.mirth.connect.client.ui.dependencies.ChannelDependenciesPanel.java

private void initComponents() {
    setBackground(UIConstants.BACKGROUND_COLOR);

    dependencyLabel = new JLabel("This channel depends upon:");

    dependencyTreeTable = new MirthTreeTable();

    DefaultTreeTableModel dependencyModel = new SortableTreeTableModel();
    DefaultMutableTreeTableNode dependencyRootNode = new DefaultMutableTreeTableNode();
    dependencyModel.setRoot(dependencyRootNode);

    dependencyTreeTable.setTreeTableModel(dependencyModel);
    dependencyTreeTable.setRootVisible(false);
    dependencyTreeTable.setDoubleBuffered(true);
    dependencyTreeTable.setDragEnabled(false);
    dependencyTreeTable.setRowSelectionAllowed(true);
    dependencyTreeTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dependencyTreeTable.setRowHeight(UIConstants.ROW_HEIGHT);
    dependencyTreeTable.setFocusable(true);
    dependencyTreeTable.setOpaque(true);
    dependencyTreeTable.setEditable(false);
    dependencyTreeTable.setSortable(true);
    dependencyTreeTable.putClientProperty("JTree.lineStyle", "Horizontal");
    dependencyTreeTable.setAutoCreateColumnsFromModel(false);
    dependencyTreeTable.setShowGrid(true, true);
    dependencyTreeTable.setTableHeader(null);

    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) {
        dependencyTreeTable.setHighlighters(HighlighterFactory
                .createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR, UIConstants.BACKGROUND_COLOR));
    }/*ww  w  .ja  v  a 2s .com*/

    dependencyTreeTable.setTreeCellRenderer(new DependencyTreeCellRenderer(dependencyTreeTable));

    dependencyTreeTable.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent evt) {
            checkSelection(evt);
        }

        @Override
        public void mouseReleased(MouseEvent evt) {
            checkSelection(evt);
        }

        private void checkSelection(MouseEvent evt) {
            if (dependencyTreeTable.rowAtPoint(new Point(evt.getX(), evt.getY())) < 0) {
                dependencyTreeTable.clearSelection();
            }
        }
    });

    dependencyTreeTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent evt) {
            if (!evt.getValueIsAdjusting()) {
                boolean removeEnabled = false;
                int[] rows = dependencyTreeTable.getSelectedModelRows();

                if (rows.length == 1) {
                    TreePath selectedPath = dependencyTreeTable.getPathForRow(rows[0]);

                    if (selectedPath != null) {
                        if (selectedPath.getPathCount() == 2) {
                            removeEnabled = true;
                        }
                    }
                }

                dependencyRemoveButton.setEnabled(removeEnabled);
            }
        }
    });

    dependencyScrollPane = new JScrollPane(dependencyTreeTable);

    dependencyExpandAllLabel = new JLabel("<html><u>Expand All</u></html>");
    dependencyExpandAllLabel.setForeground(Color.BLUE);
    dependencyExpandAllLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    dependencyExpandAllLabel.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent evt) {
            dependencyTreeTable.expandAll();
        }
    });

    dependencyCollapseAllLabel = new JLabel("<html><u>Collapse All</u></html>");
    dependencyCollapseAllLabel.setForeground(Color.BLUE);
    dependencyCollapseAllLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    dependencyCollapseAllLabel.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent evt) {
            dependencyTreeTable.collapseAll();
        }
    });

    dependencyAddButton = new JButton("Add");
    dependencyAddButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            Map<String, String> allowedChannelsMap = getAllowedChannels(true);

            if (MapUtils.isNotEmpty(allowedChannelsMap)) {
                AddDialog dialog = new AddDialog(allowedChannelsMap, true);

                if (dialog.wasSaved()) {
                    for (String dependencyId : dialog.getSelectedChannelIds()) {
                        dependencies.add(new ChannelDependency(channel.getId(), dependencyId));
                    }

                    updateTreeTable(true, dependencies);
                    updateAddButton();
                }
            }
        }
    });

    dependencyRemoveButton = new JButton("Remove");
    dependencyRemoveButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            int[] rows = dependencyTreeTable.getSelectedModelRows();

            if (rows.length == 1) {
                TreePath selectedPath = dependencyTreeTable.getPathForRow(rows[0]);

                if (selectedPath != null && selectedPath.getPathCount() == 2) {
                    Pair<String, String> pair = (Pair<String, String>) ((MutableTreeTableNode) selectedPath
                            .getLastPathComponent()).getUserObject();

                    for (Iterator<ChannelDependency> it = dependencies.iterator(); it.hasNext();) {
                        ChannelDependency dependency = it.next();
                        if (StringUtils.equals(channel.getId(), dependency.getDependentId())
                                && StringUtils.equals(pair.getLeft(), dependency.getDependencyId())) {
                            it.remove();
                        }
                    }

                    updateTreeTable(true, dependencies);
                    updateAddButton();
                }
            }
        }
    });
    dependencyRemoveButton.setEnabled(false);

    dependentLabel = new JLabel("This channel is depended upon by:");

    dependentTreeTable = new MirthTreeTable();

    DefaultTreeTableModel dependentModel = new SortableTreeTableModel();
    DefaultMutableTreeTableNode dependentRootNode = new DefaultMutableTreeTableNode();
    dependentModel.setRoot(dependentRootNode);

    dependentTreeTable.setTreeTableModel(dependentModel);
    dependentTreeTable.setRootVisible(false);
    dependentTreeTable.setDoubleBuffered(true);
    dependentTreeTable.setDragEnabled(false);
    dependentTreeTable.setRowSelectionAllowed(true);
    dependentTreeTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dependentTreeTable.setRowHeight(UIConstants.ROW_HEIGHT);
    dependentTreeTable.setFocusable(true);
    dependentTreeTable.setOpaque(true);
    dependentTreeTable.setEditable(false);
    dependentTreeTable.setSortable(true);
    dependentTreeTable.putClientProperty("JTree.lineStyle", "Horizontal");
    dependentTreeTable.setAutoCreateColumnsFromModel(false);
    dependentTreeTable.setShowGrid(true, true);
    dependentTreeTable.setTableHeader(null);

    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) {
        dependentTreeTable.setHighlighters(HighlighterFactory
                .createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR, UIConstants.BACKGROUND_COLOR));
    }

    dependentTreeTable.setTreeCellRenderer(new DependencyTreeCellRenderer(dependentTreeTable));

    dependentTreeTable.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent evt) {
            checkSelection(evt);
        }

        @Override
        public void mouseReleased(MouseEvent evt) {
            checkSelection(evt);
        }

        private void checkSelection(MouseEvent evt) {
            if (dependentTreeTable.rowAtPoint(new Point(evt.getX(), evt.getY())) < 0) {
                dependentTreeTable.clearSelection();
            }
        }
    });

    dependentTreeTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent evt) {
            if (!evt.getValueIsAdjusting()) {
                boolean removeEnabled = false;
                int[] rows = dependentTreeTable.getSelectedModelRows();

                if (rows.length == 1) {
                    TreePath selectedPath = dependentTreeTable.getPathForRow(rows[0]);

                    if (selectedPath != null) {
                        if (selectedPath.getPathCount() == 2) {
                            removeEnabled = true;
                        }
                    }
                }

                dependentRemoveButton.setEnabled(removeEnabled);
            }
        }
    });

    dependentScrollPane = new JScrollPane(dependentTreeTable);

    dependentExpandAllLabel = new JLabel("<html><u>Expand All</u></html>");
    dependentExpandAllLabel.setForeground(Color.BLUE);
    dependentExpandAllLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    dependentExpandAllLabel.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent evt) {
            dependentTreeTable.expandAll();
        }
    });

    dependentCollapseAllLabel = new JLabel("<html><u>Collapse All</u></html>");
    dependentCollapseAllLabel.setForeground(Color.BLUE);
    dependentCollapseAllLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    dependentCollapseAllLabel.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent evt) {
            dependentTreeTable.collapseAll();
        }
    });

    dependentAddButton = new JButton("Add");
    dependentAddButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            Map<String, String> allowedChannelsMap = getAllowedChannels(false);

            if (MapUtils.isNotEmpty(allowedChannelsMap)) {
                AddDialog dialog = new AddDialog(allowedChannelsMap, false);

                if (dialog.wasSaved()) {
                    for (String dependentId : dialog.getSelectedChannelIds()) {
                        dependencies.add(new ChannelDependency(dependentId, channel.getId()));
                    }

                    updateTreeTable(false, dependencies);
                    updateAddButton();
                }
            }
        }
    });

    dependentRemoveButton = new JButton("Remove");
    dependentRemoveButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            int[] rows = dependentTreeTable.getSelectedModelRows();

            if (rows.length == 1) {
                TreePath selectedPath = dependentTreeTable.getPathForRow(rows[0]);

                if (selectedPath != null && selectedPath.getPathCount() == 2) {
                    Pair<String, String> pair = (Pair<String, String>) ((MutableTreeTableNode) selectedPath
                            .getLastPathComponent()).getUserObject();

                    for (Iterator<ChannelDependency> it = dependencies.iterator(); it.hasNext();) {
                        ChannelDependency dependency = it.next();
                        if (StringUtils.equals(pair.getLeft(), dependency.getDependentId())
                                && StringUtils.equals(channel.getId(), dependency.getDependencyId())) {
                            it.remove();
                        }
                    }

                    updateTreeTable(false, dependencies);
                    updateAddButton();
                }
            }
        }
    });
    dependentRemoveButton.setEnabled(false);
}

From source file:com.konifar.material_icon_generator.MaterialDesignIconGenerateDialog.java

private void initLabelLink(JLabel label, final String url) {
    label.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    label.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent event) {
            if (event.getClickCount() > 0) {
                if (Desktop.isDesktopSupported()) {
                    Desktop desktop = Desktop.getDesktop();
                    try {
                        URI uri = new URI(url);
                        desktop.browse(uri);
                    } catch (IOException e) {
                        e.printStackTrace();
                    } catch (URISyntaxException e) {
                        e.printStackTrace();
                    }//w w w. j  a v a 2 s.  c  o m
                }
            }
        }
    });
}

From source file:op.care.nursingprocess.DlgNursingProcess.java

/**
 * This method is called from within the constructor to
 * initialize the form./*w w  w  .  j  a  v  a  2  s  .  c  om*/
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the PrinterForm Editor.
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    jPanel5 = new JPanel();
    lblTopic = new JLabel();
    txtStichwort = new JTextField();
    lblCat = new JLabel();
    cmbKategorie = new JComboBox<>();
    panel4 = new JPanel();
    lblSituation = new JLabel();
    btnPopoutSituation = new JButton();
    jScrollPane3 = new JScrollPane();
    txtSituation = new JTextArea();
    panel5 = new JPanel();
    lblGoal = new JLabel();
    btnPopoutGoal = new JButton();
    jScrollPane1 = new JScrollPane();
    txtZiele = new JTextArea();
    lblFirstRevision = new JLabel();
    jdcKontrolle = new JDateChooser();
    panel2 = new JPanel();
    jspPlanung = new JScrollPane();
    tblPlanung = new JTable();
    panel3 = new JPanel();
    btnAddIntervention = new JButton();
    panel1 = new JPanel();
    btnCancel = new JButton();
    btnSave = new JButton();

    //======== this ========
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    Container contentPane = getContentPane();
    contentPane.setLayout(new FormLayout("14dlu, $lcgap, 280dlu:grow, $ugap, pref, $lcgap, 14dlu",
            "fill:14dlu, $lgap, fill:default:grow, $rgap, pref, $lgap, 14dlu"));

    //======== jPanel5 ========
    {
        jPanel5.setLayout(new FormLayout("default, $lcgap, default:grow",
                "fill:default, $rgap, default, 2*($lgap, fill:default:grow), $lgap, 70dlu, $lgap, pref"));

        //---- lblTopic ----
        lblTopic.setFont(new Font("Arial", Font.PLAIN, 14));
        lblTopic.setText("Stichwort");
        jPanel5.add(lblTopic, CC.xy(1, 1, CC.DEFAULT, CC.TOP));

        //---- txtStichwort ----
        txtStichwort.setFont(new Font("Arial", Font.BOLD, 20));
        txtStichwort.addFocusListener(new FocusAdapter() {
            @Override
            public void focusGained(FocusEvent e) {
                txtStichwortFocusGained(e);
            }
        });
        jPanel5.add(txtStichwort, CC.xy(3, 1));

        //---- lblCat ----
        lblCat.setFont(new Font("Arial", Font.PLAIN, 14));
        lblCat.setText("Kategorie");
        jPanel5.add(lblCat, CC.xy(1, 3));

        //---- cmbKategorie ----
        cmbKategorie
                .setModel(new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        cmbKategorie.setFont(new Font("Arial", Font.PLAIN, 14));
        jPanel5.add(cmbKategorie, CC.xy(3, 3));

        //======== panel4 ========
        {
            panel4.setLayout(new BorderLayout());

            //---- lblSituation ----
            lblSituation.setFont(new Font("Arial", Font.PLAIN, 14));
            lblSituation.setText("Situation");
            panel4.add(lblSituation, BorderLayout.CENTER);

            //---- btnPopoutSituation ----
            btnPopoutSituation.setText(null);
            btnPopoutSituation.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/popup.png")));
            btnPopoutSituation.setBorderPainted(false);
            btnPopoutSituation.setContentAreaFilled(false);
            btnPopoutSituation
                    .setSelectedIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/pressed.png")));
            btnPopoutSituation.setBorder(null);
            btnPopoutSituation.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            btnPopoutSituation.addActionListener(e -> btnPopoutSituationActionPerformed(e));
            panel4.add(btnPopoutSituation, BorderLayout.EAST);
        }
        jPanel5.add(panel4, CC.xy(1, 5, CC.DEFAULT, CC.TOP));

        //======== jScrollPane3 ========
        {

            //---- txtSituation ----
            txtSituation.setColumns(20);
            txtSituation.setLineWrap(true);
            txtSituation.setRows(5);
            txtSituation.setWrapStyleWord(true);
            txtSituation.setFont(new Font("Arial", Font.PLAIN, 14));
            txtSituation.addFocusListener(new FocusAdapter() {
                @Override
                public void focusGained(FocusEvent e) {
                    txtSituationFocusGained(e);
                }
            });
            jScrollPane3.setViewportView(txtSituation);
        }
        jPanel5.add(jScrollPane3, CC.xy(3, 5));

        //======== panel5 ========
        {
            panel5.setLayout(new BorderLayout());

            //---- lblGoal ----
            lblGoal.setFont(new Font("Arial", Font.PLAIN, 14));
            lblGoal.setText("Ziele");
            panel5.add(lblGoal, BorderLayout.CENTER);

            //---- btnPopoutGoal ----
            btnPopoutGoal.setText(null);
            btnPopoutGoal.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/popup.png")));
            btnPopoutGoal.setBorderPainted(false);
            btnPopoutGoal.setContentAreaFilled(false);
            btnPopoutGoal
                    .setSelectedIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/pressed.png")));
            btnPopoutGoal.setBorder(null);
            btnPopoutGoal.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            btnPopoutGoal.addActionListener(e -> btnPopoutGoalActionPerformed(e));
            panel5.add(btnPopoutGoal, BorderLayout.EAST);
        }
        jPanel5.add(panel5, CC.xy(1, 7, CC.DEFAULT, CC.TOP));

        //======== jScrollPane1 ========
        {

            //---- txtZiele ----
            txtZiele.setColumns(20);
            txtZiele.setLineWrap(true);
            txtZiele.setRows(5);
            txtZiele.setWrapStyleWord(true);
            txtZiele.setFont(new Font("Arial", Font.PLAIN, 14));
            txtZiele.addFocusListener(new FocusAdapter() {
                @Override
                public void focusGained(FocusEvent e) {
                    txtZieleFocusGained(e);
                }
            });
            jScrollPane1.setViewportView(txtZiele);
        }
        jPanel5.add(jScrollPane1, CC.xy(3, 7));

        //---- lblFirstRevision ----
        lblFirstRevision.setFont(new Font("Arial", Font.PLAIN, 14));
        lblFirstRevision.setText("Erste Kontrolle am");
        jPanel5.add(lblFirstRevision, CC.xy(1, 11));

        //---- jdcKontrolle ----
        jdcKontrolle.setFont(new Font("Arial", Font.PLAIN, 14));
        jPanel5.add(jdcKontrolle, CC.xy(3, 11));
    }
    contentPane.add(jPanel5, CC.xy(3, 3, CC.DEFAULT, CC.FILL));

    //======== panel2 ========
    {
        panel2.setLayout(new FormLayout("default:grow", "default, $lgap, default"));

        //======== jspPlanung ========
        {
            jspPlanung.addComponentListener(new ComponentAdapter() {
                @Override
                public void componentResized(ComponentEvent e) {
                    jspPlanungComponentResized(e);
                }
            });

            //---- tblPlanung ----
            tblPlanung.setModel(new DefaultTableModel(
                    new Object[][] { { null, null, null, null }, { null, null, null, null },
                            { null, null, null, null }, { null, null, null, null }, },
                    new String[] { "Title 1", "Title 2", "Title 3", "Title 4" }));
            tblPlanung.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
            tblPlanung.addMouseListener(new MouseAdapter() {
                @Override
                public void mousePressed(MouseEvent e) {
                    tblPlanungMousePressed(e);
                }
            });
            jspPlanung.setViewportView(tblPlanung);
        }
        panel2.add(jspPlanung, CC.xy(1, 1));

        //======== panel3 ========
        {
            panel3.setLayout(new BoxLayout(panel3, BoxLayout.X_AXIS));

            //---- btnAddIntervention ----
            btnAddIntervention.setText(null);
            btnAddIntervention.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png")));
            btnAddIntervention.setContentAreaFilled(false);
            btnAddIntervention.setBorderPainted(false);
            btnAddIntervention.setBorder(null);
            btnAddIntervention
                    .setPressedIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add-pressed.png")));
            btnAddIntervention.addActionListener(e -> btnAddInterventionActionPerformed(e));
            panel3.add(btnAddIntervention);
        }
        panel2.add(panel3, CC.xy(1, 3));
    }
    contentPane.add(panel2, CC.xy(5, 3));

    //======== panel1 ========
    {
        panel1.setLayout(new HorizontalLayout(5));

        //---- btnCancel ----
        btnCancel.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/cancel.png")));
        btnCancel.setText(null);
        btnCancel.addActionListener(e -> btnCancelActionPerformed(e));
        panel1.add(btnCancel);

        //---- btnSave ----
        btnSave.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/apply.png")));
        btnSave.setText(null);
        btnSave.addActionListener(e -> btnSaveActionPerformed(e));
        panel1.add(btnSave);
    }
    contentPane.add(panel1, CC.xy(5, 5, CC.RIGHT, CC.DEFAULT));
    setSize(1145, 695);
    setLocationRelativeTo(getOwner());
}

From source file:edu.ku.brc.af.tasks.BaseTask.java

/**
 * @param navBox/*from  www.j  a  v  a  2s. co  m*/
 * @param labelText
 * @param iconNameArg
 * @param toolTip
 * @param cmdAction
 * @param delCmdAction
 * @param makeDraggable
 * @param position
 * @param addSorted
 * @return
 */
public static NavBoxItemIFace makeDnDNavBtn(final NavBox navBox, final String labelText,
        final String iconNameArg, final String toolTip, final CommandAction cmdAction,
        final CommandAction delCmdAction, final boolean makeDraggable, final int position,
        final boolean addSorted) {
    NavBoxItemIFace nb = NavBox.createBtn(labelText, iconNameArg, IconManager.STD_ICON_SIZE);
    if (StringUtils.isNotEmpty(toolTip)) {
        ((RolloverCommand) nb).setToolTip(toolTip);
    }
    if (cmdAction != null) {
        NavBoxButton nbb = (NavBoxButton) nb;
        nbb.addActionListener(new CommandActionWrapper(cmdAction));
        nbb.setData(cmdAction);
    }

    if (delCmdAction != null) {
        ((NavBoxButton) nb).setDeleteCommandAction(delCmdAction);
    }

    if (addSorted) {
        navBox.insertSorted(nb);

    } else if (position == -1) {
        navBox.add(nb);

    } else {
        navBox.insert(nb, false, false, position);
    }

    // Make the Btn Draggable
    if (nb instanceof GhostActionable) {
        GhostActionable ga = (GhostActionable) nb;
        if (makeDraggable) {
            ga.createMouseInputAdapter(); // this makes it draggable
            ((RolloverCommand) nb).setCursor(new Cursor(Cursor.HAND_CURSOR));
        } else {
            //UIRegistry.getGlassPane().add(ga);
        }
    }
    return nb;
}