List of usage examples for java.awt Cursor getPredefinedCursor
public static Cursor getPredefinedCursor(int type)
From source file:com.sshtools.common.ui.SshToolsApplication.java
/** * Show an 'About' dialog/* www . j a v a 2s. co m*/ * * */ public void showAbout(final Component parent) { JPanel p = new JPanel(new GridBagLayout()); p.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); GridBagConstraints gBC = new GridBagConstraints(); gBC.anchor = GridBagConstraints.CENTER; gBC.fill = GridBagConstraints.HORIZONTAL; gBC.insets = new Insets(1, 1, 1, 1); JLabel a = new JLabel(getApplicationName()); a.setFont(a.getFont().deriveFont(24f)); UIUtil.jGridBagAdd(p, a, gBC, GridBagConstraints.REMAINDER); MultilineLabel v = new MultilineLabel(getApplicationName() + " " + getApplicationVersion()); v.setFont(v.getFont().deriveFont(10f)); UIUtil.jGridBagAdd(p, v, gBC, GridBagConstraints.REMAINDER); MultilineLabel x = new MultilineLabel(getAboutAuthors()); x.setBorder(BorderFactory.createEmptyBorder(8, 0, 8, 0)); x.setFont(x.getFont().deriveFont(12f)); UIUtil.jGridBagAdd(p, x, gBC, GridBagConstraints.REMAINDER); MultilineLabel c = new MultilineLabel(getAboutLicenseDetails()); c.setFont(c.getFont().deriveFont(10f)); UIUtil.jGridBagAdd(p, c, gBC, GridBagConstraints.REMAINDER); final JLabel h = new JLabel(getAboutURL()); h.setForeground(Color.blue); h.setFont(new Font(h.getFont().getName(), Font.BOLD, 10)); h.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); h.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { try { BrowserLauncher.openURL(getAboutURL()); } catch (IOException ioe) { ioe.printStackTrace(); } } }); UIUtil.jGridBagAdd(p, h, gBC, GridBagConstraints.REMAINDER); JOptionPane.showMessageDialog(parent, p, "About", JOptionPane.PLAIN_MESSAGE, getApplicationLargeIcon()); }
From source file:org.tinymediamanager.ui.tvshows.dialogs.TvShowEditorDialog.java
/** * Instantiates a new tv show editor dialog. * /*from w w w . j a v a 2 s. c om*/ * @param tvShow * the tv show * @param inQueue * the in queue */ public TvShowEditorDialog(TvShow tvShow, boolean inQueue) { super(BUNDLE.getString("tvshow.edit"), "tvShowEditor"); //$NON-NLS-1$ setBounds(5, 5, 950, 700); tvShowToEdit = tvShow; ids = MediaIdTable.convertIdMapToEventList(tvShowToEdit.getIds()); getContentPane().setLayout(new BorderLayout()); { JPanel panelPath = new JPanel(); getContentPane().add(panelPath, BorderLayout.NORTH); panelPath.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, RowSpec.decode("15px"), FormFactory.RELATED_GAP_ROWSPEC, })); JLabel lblTvShowPathT = new JLabel(BUNDLE.getString("metatag.path")); //$NON-NLS-1$ panelPath.add(lblTvShowPathT, "2, 2, left, top"); lvlTvShowPath = new JLabel(""); TmmFontHelper.changeFont(lblTvShowPathT, 1.166, Font.BOLD); panelPath.add(lvlTvShowPath, "5, 2, left, top"); } JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.NORTH); tabbedPane.addTab(BUNDLE.getString("metatag.details"), details1Panel); //$NON-NLS-1$ getContentPane().add(tabbedPane, BorderLayout.CENTER); details1Panel.setBorder(new EmptyBorder(5, 5, 5, 5)); details1Panel.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(40dlu;default)"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("50px:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("50px:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("30dlu"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.UNRELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("250px:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("15dlu:grow"), FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("top:max(30dlu;default)"), FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("20dlu:grow"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("fill:30px:grow(2)"), })); { JLabel lblTitle = new JLabel(BUNDLE.getString("metatag.title")); //$NON-NLS-1$ details1Panel.add(lblTitle, "2, 2, right, default"); } { tfTitle = new JTextField(); details1Panel.add(tfTitle, "4, 2, 15, 1, fill, default"); tfTitle.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) { ImageChooserDialog dialog = new ImageChooserDialog(tvShowToEdit.getIds(), ImageType.POSTER, tvShowList.getAvailableArtworkScrapers(), lblPoster, null, null, MediaType.TV_SHOW); dialog.setLocationRelativeTo(MainWindow.getActiveInstance()); dialog.setVisible(true); } }); lblPoster.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); details1Panel.add(lblPoster, "22, 2, 3, 19, fill, fill"); } { JLabel lblSortTitle = new JLabel(BUNDLE.getString("metatag.sorttitle")); //$NON-NLS-1$ details1Panel.add(lblSortTitle, "2, 4, right, default"); } { tfSorttitle = new JTextField(); details1Panel.add(tfSorttitle, "4, 4, 15, 1, fill, default"); tfSorttitle.setColumns(10); } { JLabel lblYear = new JLabel(BUNDLE.getString("metatag.year")); //$NON-NLS-1$ details1Panel.add(lblYear, "2, 6, right, default"); } { spYear = new YearSpinner(); details1Panel.add(spYear, "4, 6, fill, top"); } { JLabel lblpremiered = new JLabel(BUNDLE.getString("metatag.premiered")); //$NON-NLS-1$ details1Panel.add(lblpremiered, "8, 6, right, default"); } { dpPremiered = new DatePicker(tvShow.getFirstAired()); details1Panel.add(dpPremiered, "10, 6, fill, default"); } { JLabel lblRuntime = new JLabel(BUNDLE.getString("metatag.runtime")); //$NON-NLS-1$ details1Panel.add(lblRuntime, "14, 6, right, default"); } { spRuntime = new JSpinner(); details1Panel.add(spRuntime, "16, 6, fill, default"); } spRuntime.setValue(tvShow.getRuntime()); { JLabel lblMin = new JLabel(BUNDLE.getString("metatag.minutes")); //$NON-NLS-1$ details1Panel.add(lblMin, "18, 6"); } { JLabel lblRating = new JLabel(BUNDLE.getString("metatag.rating")); //$NON-NLS-1$ details1Panel.add(lblRating, "2, 8, right, default"); } { spRating = new JSpinner(); details1Panel.add(spRating, "4, 8"); } spRating.setModel(new SpinnerNumberModel(tvShow.getRating(), 0.0, 10.0, 0.1)); { { JLabel lblCertification = new JLabel(BUNDLE.getString("metatag.certification")); //$NON-NLS-1$ details1Panel.add(lblCertification, "8, 8, right, default"); } } cbCertification = new JComboBox(); for (Certification cert : Certification .getCertificationsforCountry(TvShowModuleManager.SETTINGS.getCertificationCountry())) { cbCertification.addItem(cert); } details1Panel.add(cbCertification, "10, 8, fill, default"); cbCertification.setSelectedItem(tvShow.getCertification()); { JLabel lblStatus = new JLabel(BUNDLE.getString("metatag.status")); //$NON-NLS-1$ details1Panel.add(lblStatus, "14, 8, right, default"); } { cbStatus = new JComboBox(new String[] { "", "Continuing", "Ended" }); details1Panel.add(cbStatus, "16, 8, 3, 1, fill, default"); } cbStatus.setSelectedItem(tvShow.getStatus()); { JLabel lblDateAdded = new JLabel(BUNDLE.getString("metatag.dateadded")); //$NON-NLS-1$ details1Panel.add(lblDateAdded, "2, 10, right, default"); } { spDateAdded = new JSpinner(new SpinnerDateModel()); details1Panel.add(spDateAdded, "4, 10"); } { JLabel lblIds = new JLabel("Ids"); details1Panel.add(lblIds, "2, 12, right, default"); } { JScrollPane scrollPaneIds = new JScrollPane(); details1Panel.add(scrollPaneIds, "4, 12, 9, 5, fill, fill"); { tableIds = new MediaIdTable(ids, ScraperType.TV_SHOW); scrollPaneIds.setViewportView(tableIds); } } { JButton btnAddId = new JButton(""); btnAddId.setAction(new AddIdAction()); btnAddId.setIcon(IconManager.LIST_ADD); btnAddId.setMargin(new Insets(2, 2, 2, 2)); details1Panel.add(btnAddId, "2, 14, right, top"); } { JButton btnRemoveId = new JButton("RemoveId"); btnRemoveId.setAction(new RemoveIdAction()); btnRemoveId.setIcon(IconManager.LIST_REMOVE); btnRemoveId.setMargin(new Insets(2, 2, 2, 2)); details1Panel.add(btnRemoveId, "2, 16, right, top"); } { JLabel lblPlot = new JLabel(BUNDLE.getString("metatag.plot")); //$NON-NLS-1$ details1Panel.add(lblPlot, "2, 18, right, top"); } { JScrollPane scrollPanePlot = new JScrollPane(); details1Panel.add(scrollPanePlot, "4, 18, 15, 3, fill, fill"); { tpPlot = new JTextPane(); scrollPanePlot.setViewportView(tpPlot); } } { JLabel lblStudio = new JLabel(BUNDLE.getString("metatag.studio")); //$NON-NLS-1$ details1Panel.add(lblStudio, "2, 22, right, top"); } { tfStudio = new JTextField(); details1Panel.add(tfStudio, "4, 22, 15, 1"); } /** * DetailsPanel 2 */ tabbedPane.addTab(BUNDLE.getString("metatag.details2"), details2Panel); //$NON-NLS-1$ details2Panel.setBorder(new EmptyBorder(5, 5, 5, 5)); details2Panel.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(40dlu;default)"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("100px:grow(2)"), FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("100px:grow"), FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("fill:30px: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, RowSpec.decode("default:grow"), FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow(2)"), })); { JLabel lblActors = new JLabel(BUNDLE.getString("metatag.actors")); //$NON-NLS-1$ details2Panel.add(lblActors, "2, 2, right, default"); } { JScrollPane scrollPane = new JScrollPane(); details2Panel.add(scrollPane, "4, 2, 1, 7"); { tableActors = new JTable(); tableActors.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE); scrollPane.setViewportView(tableActors); } } { JLabel lblGenres = new JLabel(BUNDLE.getString("metatag.genre")); //$NON-NLS-1$ details2Panel.add(lblGenres, "6, 2"); } { JButton btnAddActor = new JButton("Add Actor"); btnAddActor.setMargin(new Insets(2, 2, 2, 2)); btnAddActor.setAction(new AddActorAction()); btnAddActor.setIcon(IconManager.LIST_ADD); details2Panel.add(btnAddActor, "2, 4, right, top"); } { JScrollPane scrollPaneGenres = new JScrollPane(); details2Panel.add(scrollPaneGenres, "8, 2, 1, 5"); { listGenres = new JList(); scrollPaneGenres.setViewportView(listGenres); } } { JButton btnAddGenre = new JButton(""); btnAddGenre.setAction(new AddGenreAction()); btnAddGenre.setIcon(IconManager.LIST_ADD); btnAddGenre.setMargin(new Insets(2, 2, 2, 2)); details2Panel.add(btnAddGenre, "6, 4, right, top"); } { JButton btnRemoveActor = new JButton(BUNDLE.getString("cast.actor.remove")); //$NON-NLS-1$ btnRemoveActor.setMargin(new Insets(2, 2, 2, 2)); btnRemoveActor.setAction(new RemoveActorAction()); btnRemoveActor.setIcon(IconManager.LIST_REMOVE); details2Panel.add(btnRemoveActor, "2,6, right, top"); } { JButton btnRemoveGenre = new JButton(""); btnRemoveGenre.setAction(new RemoveGenreAction()); btnRemoveGenre.setMargin(new Insets(2, 2, 2, 2)); btnRemoveGenre.setIcon(IconManager.LIST_REMOVE); details2Panel.add(btnRemoveGenre, "6, 6, right, top"); } { cbGenres = new AutocompleteComboBox(MediaGenres.values()); cbGenres.setEditable(true); details2Panel.add(cbGenres, "8,8"); } { JLabel lblTags = new JLabel(BUNDLE.getString("metatag.tags")); //$NON-NLS-1$ details2Panel.add(lblTags, "2, 10, right, default"); } { JScrollPane scrollPaneTags = new JScrollPane(); details2Panel.add(scrollPaneTags, "4, 10, 1, 5"); listTags = new JList(); scrollPaneTags.setViewportView(listTags); } { JButton btnAddTag = new JButton(""); btnAddTag.setAction(new AddTagAction()); btnAddTag.setIcon(IconManager.LIST_ADD); btnAddTag.setMargin(new Insets(2, 2, 2, 2)); details2Panel.add(btnAddTag, "2, 12, right, top"); } { JButton btnRemoveTag = new JButton(""); btnRemoveTag.setAction(new RemoveTagAction()); btnRemoveTag.setIcon(IconManager.LIST_REMOVE); btnRemoveTag.setMargin(new Insets(2, 2, 2, 2)); details2Panel.add(btnRemoveTag, "2, 14, right, top"); } { cbTags = new AutocompleteComboBox(tvShowList.getTagsInTvShows().toArray()); cbTags.setEditable(true); details2Panel.add(cbTags, "4, 16"); } /** * extra 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, }, 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(tvShowToEdit.getIds(), ImageType.LOGO, tvShowList.getAvailableArtworkScrapers(), lblLogo, null, null, MediaType.TV_SHOW); 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(tvShowToEdit.getIds(), ImageType.CLEARLOGO, tvShowList.getAvailableArtworkScrapers(), lblClearlogo, null, null, MediaType.TV_SHOW); 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(tvShowToEdit.getIds(), ImageType.CLEARART, tvShowList.getAvailableArtworkScrapers(), lblClearart, null, null, MediaType.TV_SHOW); dialog.setLocationRelativeTo(MainWindow.getActiveInstance()); dialog.setVisible(true); } }); lblClearart.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); artworkPanel.add(lblClearart, "2, 8, fill, fill"); } { JLabel lblThumbT = new JLabel(BUNDLE.getString("mediafiletype.thumb")); //$NON-NLS-1$ artworkPanel.add(lblThumbT, "4, 6"); } { lblThumb = new ImageLabel(); lblThumb.setAlternativeText(BUNDLE.getString("image.notfound.thumb")); //$NON-NLS-1$ lblThumb.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { ImageChooserDialog dialog = new ImageChooserDialog(tvShowToEdit.getIds(), ImageType.THUMB, tvShowList.getAvailableArtworkScrapers(), lblThumb, null, null, MediaType.TV_SHOW); dialog.setLocationRelativeTo(MainWindow.getActiveInstance()); dialog.setVisible(true); } }); lblThumb.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); artworkPanel.add(lblThumb, "4, 8, fill, fill"); } } tabbedPane.addTab(BUNDLE.getString("metatag.episodes"), episodesPanel); //$NON-NLS-1$ episodesPanel.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), })); { JButton btnCloneEpisode = new JButton(""); btnCloneEpisode.setAction(new CloneEpisodeAction()); episodesPanel.add(btnCloneEpisode, "2, 2"); } { JScrollPane scrollPaneEpisodes = new JScrollPane(); episodesPanel.add(scrollPaneEpisodes, "4, 2, 1, 3, fill, fill"); { tableEpisodes = new JTable(); scrollPaneEpisodes.setViewportView(tableEpisodes); } } { JButton btnRemoveEpisode = new JButton(""); btnRemoveEpisode.setAction(new RemoveEpisodeAction()); btnRemoveEpisode.setIcon(IconManager.LIST_REMOVE); episodesPanel.add(btnRemoveEpisode, "2, 4, default, top"); } /** * Button pane */ { JPanel bottomPane = new JPanel(); getContentPane().add(bottomPane, BorderLayout.SOUTH); bottomPane.setLayout(new FormLayout( new ColumnSpec[] { ColumnSpec.decode("371px:grow"), FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, RowSpec.decode("25px"), FormFactory.RELATED_GAP_ROWSPEC, })); JPanel buttonPane = new JPanel(); bottomPane.add(buttonPane, "2, 2, left, top"); EqualsLayout layout = new EqualsLayout(5); layout.setMinWidth(100); buttonPane.setLayout(layout); { JButton okButton = new JButton(BUNDLE.getString("Button.ok")); //$NON-NLS-1$ buttonPane.add(okButton); okButton.setAction(new OKAction()); okButton.setActionCommand("OK"); getRootPane().setDefaultButton(okButton); } { JButton cancelButton = new JButton(BUNDLE.getString("Button.cancel")); //$NON-NLS-1$ buttonPane.add(cancelButton); cancelButton.setAction(new CancelAction()); cancelButton.setActionCommand("Cancel"); } if (inQueue) { JButton btnAbort = new JButton(BUNDLE.getString("Button.abortqueue")); //$NON-NLS-1$ btnAbort.setAction(new AbortAction()); buttonPane.add(btnAbort); } } initDataBindings(); { lvlTvShowPath.setText(tvShow.getPath()); tfTitle.setText(tvShow.getTitle()); tfSorttitle.setText(tvShow.getSortTitle()); tpPlot.setText(tvShow.getPlot()); lblPoster.setImagePath(tvShow.getArtworkFilename(MediaFileType.POSTER)); lblThumb.setImagePath(tvShowToEdit.getArtworkFilename(MediaFileType.THUMB)); lblLogo.setImagePath(tvShowToEdit.getArtworkFilename(MediaFileType.LOGO)); lblClearlogo.setImagePath(tvShowToEdit.getArtworkFilename(MediaFileType.CLEARLOGO)); lblClearart.setImagePath(tvShowToEdit.getArtworkFilename(MediaFileType.CLEARART)); tfStudio.setText(tvShow.getProductionCompany()); int year = 0; try { year = Integer.parseInt(tvShow.getYear()); } catch (Exception e) { } spYear.setValue(year); spDateAdded.setValue(tvShow.getDateAdded()); for (TvShowActor origCast : tvShow.getActors()) { TvShowActor actor = new TvShowActor(); actor.setName(origCast.getName()); actor.setCharacter(origCast.getCharacter()); actor.setThumbUrl(origCast.getThumbUrl()); actors.add(actor); } for (MediaGenres genre : tvShow.getGenres()) { genres.add(genre); } // for (MediaTrailer trailer : tvShow.getTrailers()) { // trailers.add(trailer); // } for (String tag : tvShowToEdit.getTags()) { tags.add(tag); } List<TvShowEpisode> epl = new ArrayList<>(tvShowToEdit.getEpisodes()); // custom sort per filename (just this time) // for unknown EPs (-1/-1) this is extremely useful to sort like on filesystem // and for already renamed ones, it makes no difference Collections.sort(epl, new Comparator<TvShowEpisode>() { public int compare(TvShowEpisode s1, TvShowEpisode s2) { return s1.getMediaFiles(MediaFileType.VIDEO).get(0).getFile() .compareTo(s2.getMediaFiles(MediaFileType.VIDEO).get(0).getFile()); } }); for (TvShowEpisode episode : epl) { TvShowEpisodeEditorContainer container = new TvShowEpisodeEditorContainer(); container.tvShowEpisode = episode; container.dvdOrder = episode.isDvdOrder(); container.season = episode.getSeason(); container.episode = episode.getEpisode(); episodes.add(container); } if (((DefaultComboBoxModel) cbCertification.getModel()).getIndexOf(tvShow.getCertification()) == -1) { cbCertification.addItem(tvShow.getCertification()); } } lblBanner = new ImageLabel(); lblBanner.setAlternativeText(BUNDLE.getString("image.notfound.banner")); //$NON-NLS-1$ lblBanner.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); lblBanner.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { ImageChooserDialog dialog = new ImageChooserDialog(tvShowToEdit.getIds(), ImageType.BANNER, tvShowList.getAvailableArtworkScrapers(), lblBanner, null, null, MediaType.TV_SHOW); dialog.setLocationRelativeTo(MainWindow.getActiveInstance()); dialog.setVisible(true); } }); details1Panel.add(lblBanner, "4, 24, 15, 3, fill, fill"); lblBanner.setImagePath(tvShow.getArtworkFilename(MediaFileType.BANNER)); { // JLabel lblFanart = new JLabel(""); lblFanart = new ImageLabel(); lblFanart.setAlternativeText(BUNDLE.getString("image.notfound.fanart")); //$NON-NLS-1$ lblFanart.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); lblFanart.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { ImageChooserDialog dialog = new ImageChooserDialog(tvShowToEdit.getIds(), ImageType.FANART, tvShowList.getAvailableArtworkScrapers(), lblFanart, null, null, MediaType.TV_SHOW); dialog.setLocationRelativeTo(MainWindow.getActiveInstance()); dialog.setVisible(true); } }); details1Panel.add(lblFanart, "22, 22, 3, 5, fill, fill"); } lblFanart.setImagePath(tvShow.getArtworkFilename(MediaFileType.FANART)); // adjust columnn titles - we have to do it this way - thx to windowbuilder pro tableActors.getColumnModel().getColumn(0).setHeaderValue(BUNDLE.getString("metatag.name")); //$NON-NLS-1$ tableActors.getColumnModel().getColumn(1).setHeaderValue(BUNDLE.getString("metatag.role")); //$NON-NLS-1$ tableEpisodes.getColumnModel().getColumn(0).setHeaderValue(BUNDLE.getString("metatag.title")); //$NON-NLS-1$ tableEpisodes.getColumnModel().getColumn(1).setHeaderValue(BUNDLE.getString("metatag.filename")); //$NON-NLS-1$ tableEpisodes.getColumnModel().getColumn(2).setHeaderValue(BUNDLE.getString("metatag.season")); //$NON-NLS-1$ tableEpisodes.getColumnModel().getColumn(3).setHeaderValue(BUNDLE.getString("metatag.episode")); //$NON-NLS-1$ tableEpisodes.getColumnModel().getColumn(4).setHeaderValue(BUNDLE.getString("metatag.dvdorder")); //$NON-NLS-1$ tableEpisodes.getColumnModel().getColumn(2).setMaxWidth(150); tableEpisodes.getColumnModel().getColumn(3).setMaxWidth(150); tableEpisodes.getColumnModel().getColumn(2).setCellEditor(new TableSpinnerEditor()); tableEpisodes.getColumnModel().getColumn(3).setCellEditor(new TableSpinnerEditor()); // adjust table columns TableColumnResizer.adjustColumnPreferredWidths(tableActors, 6); // TableColumnResizer.adjustColumnPreferredWidths(tableTrailer, 6); TableColumnResizer.adjustColumnPreferredWidths(tableEpisodes, 6); }
From source file:net.java.sip.communicator.impl.gui.main.chat.ChatWritePanel.java
private void initTextArea(JPanel centerPanel) { GridBagConstraints constraints = new GridBagConstraints(); editorPane.setContentType("text/html"); editorPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE); editorPane.setCaretPosition(0);// ww w . ja va 2s . c o m editorPane.setEditorKit(new SIPCommHTMLEditorKit(this)); editorPane.getDocument().addUndoableEditListener(this); editorPane.getDocument().addDocumentListener(this); editorPane.addKeyListener(this); editorPane.addMouseListener(this); editorPane.setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR)); editorPane.setDragEnabled(true); editorPane.setTransferHandler(new ChatTransferHandler(chatPanel)); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setOpaque(false); scrollPane.getViewport().setOpaque(false); scrollPane.setBorder(null); scrollPane.setViewportView(editorPane); constraints.anchor = GridBagConstraints.NORTHWEST; constraints.fill = GridBagConstraints.BOTH; constraints.gridx = 2; constraints.gridy = 0; constraints.weightx = 1f; constraints.weighty = 1f; constraints.gridheight = 1; constraints.gridwidth = 1; constraints.insets = new Insets(0, 0, 0, 0); centerPanel.add(scrollPane, constraints); }
From source file:op.care.prescription.PnlPrescription.java
private CollapsiblePane createCP4(final Prescription prescription) { /***/*from w w w .ja va2s .c om*/ * _ ____ ____ _ _ ______ _ _ _ __ * ___ _ __ ___ __ _| |_ ___ / ___| _ \| || | / / _ \ _ __ ___ ___ ___ _ __(_)_ __ | |_(_) ___ _ __\ \ * / __| '__/ _ \/ _` | __/ _ \ | | |_) | || |_| || |_) | '__/ _ \/ __|/ __| '__| | '_ \| __| |/ _ \| '_ \| | * | (__| | | __/ (_| | || __/ |___| __/|__ _| || __/| | | __/\__ \ (__| | | | |_) | |_| | (_) | | | | | * \___|_| \___|\__,_|\__\___|\____|_| |_| | ||_| |_| \___||___/\___|_| |_| .__/ \__|_|\___/|_| |_| | * \_\ |_| /_/ */ 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.//from w ww .j a v a 2 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.openscience.jmol.app.Jmol.java
Jmol(Splash splash, JFrame frame, Jmol parent, int startupWidth, int startupHeight, String commandOptions, Point loc) {/*from w w w . j a v a 2 s . c om*/ super(true); this.frame = frame; this.startupWidth = startupWidth; this.startupHeight = startupHeight; numWindows++; try { say("history file is " + historyFile.getFile().getAbsolutePath()); } catch (Exception e) { } frame.setTitle("Jmol"); frame.getContentPane().setBackground(Color.lightGray); frame.getContentPane().setLayout(new BorderLayout()); this.splash = splash; setBorder(BorderFactory.createEtchedBorder()); setLayout(new BorderLayout()); language = GT.getLanguage(); status = (StatusBar) createStatusBar(); say(GT._("Initializing 3D display...")); // display = new DisplayPanel(status, guimap, haveDisplay.booleanValue(), startupWidth, startupHeight); String adapter = System.getProperty("model"); if (adapter == null || adapter.length() == 0) adapter = "smarter"; if (adapter.equals("smarter")) { report("using Smarter Model Adapter"); modelAdapter = new SmarterJmolAdapter(); } else if (adapter.equals("cdk")) { report("the CDK Model Adapter is currently no longer supported. Check out http://bioclipse.net/. -- using Smarter"); // modelAdapter = new CdkJmolAdapter(null); modelAdapter = new SmarterJmolAdapter(); } else { report("unrecognized model adapter:" + adapter + " -- using Smarter"); modelAdapter = new SmarterJmolAdapter(); } appletContext = commandOptions; viewer = JmolViewer.allocateViewer(display, modelAdapter); viewer.setAppletContext("", null, null, commandOptions); if (display != null) display.setViewer(viewer); say(GT._("Initializing Preferences...")); preferencesDialog = new PreferencesDialog(frame, guimap, viewer); say(GT._("Initializing Recent Files...")); recentFiles = new RecentFilesDialog(frame); if (haveDisplay.booleanValue()) { say(GT._("Initializing Script Window...")); scriptWindow = new ScriptWindow(viewer, frame); } MyStatusListener myStatusListener; myStatusListener = new MyStatusListener(); viewer.setJmolStatusListener(myStatusListener); say(GT._("Initializing Measurements...")); measurementTable = new MeasurementTable(viewer, frame); // Setup Plugin system // say(GT._("Loading plugins...")); // pluginManager = new CDKPluginManager( // System.getProperty("user.home") + System.getProperty("file.separator") // + ".jmol", new JmolEditBus(viewer) // ); // pluginManager.loadPlugin("org.openscience.cdkplugin.dirbrowser.DirBrowserPlugin"); // pluginManager.loadPlugin("org.openscience.cdkplugin.dirbrowser.DadmlBrowserPlugin"); // pluginManager.loadPlugins( // System.getProperty("user.home") + System.getProperty("file.separator") // + ".jmol/plugins" // ); // feature to allow for globally installed plugins // if (System.getProperty("plugin.dir") != null) { // pluginManager.loadPlugins(System.getProperty("plugin.dir")); // } if (haveDisplay.booleanValue()) { // install the command table say(GT._("Building Command Hooks...")); commands = new Hashtable(); if (display != null) { Action[] actions = getActions(); for (int i = 0; i < actions.length; i++) { Action a = actions[i]; commands.put(a.getValue(Action.NAME), a); } } menuItems = new Hashtable(); say(GT._("Building Menubar...")); executeScriptAction = new ExecuteScriptAction(); menubar = createMenubar(); add("North", menubar); JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); panel.add("North", createToolbar()); JPanel ip = new JPanel(); ip.setLayout(new BorderLayout()); ip.add("Center", display); panel.add("Center", ip); add("Center", panel); add("South", status); say(GT._("Starting display...")); display.start(); //say(GT._("Setting up File Choosers...")); /* pcs.addPropertyChangeListener(chemFileProperty, exportAction); pcs.addPropertyChangeListener(chemFileProperty, povrayAction); pcs.addPropertyChangeListener(chemFileProperty, writeAction); pcs.addPropertyChangeListener(chemFileProperty, toWebAction); pcs.addPropertyChangeListener(chemFileProperty, printAction); pcs.addPropertyChangeListener(chemFileProperty, viewMeasurementTableAction); */ if (menuFile != null) { menuStructure = viewer.getFileAsString(menuFile); } jmolpopup = JmolPopup.newJmolPopup(viewer, true, menuStructure, true); } // prevent new Jmol from covering old Jmol if (loc != null) { frame.setLocation(loc); } else if (parent != null) { Point location = parent.frame.getLocationOnScreen(); int maxX = screenSize.width - 50; int maxY = screenSize.height - 50; location.x += 40; location.y += 40; if ((location.x > maxX) || (location.y > maxY)) { location.setLocation(0, 0); } frame.setLocation(location); } frame.getContentPane().add("Center", this); frame.addWindowListener(new Jmol.AppCloser()); frame.pack(); frame.setSize(startupWidth, startupHeight); ImageIcon jmolIcon = JmolResourceHandler.getIconX("icon"); Image iconImage = jmolIcon.getImage(); frame.setIconImage(iconImage); // Repositionning windows if (scriptWindow != null) historyFile.repositionWindow(SCRIPT_WINDOW_NAME, scriptWindow, 200, 100); say(GT._("Setting up Drag-and-Drop...")); FileDropper dropper = new FileDropper(); final JFrame f = frame; dropper.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { //System.out.println("Drop triggered..."); f.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (evt.getPropertyName().equals(FileDropper.FD_PROPERTY_FILENAME)) { final String filename = evt.getNewValue().toString(); viewer.openFile(filename); } else if (evt.getPropertyName().equals(FileDropper.FD_PROPERTY_INLINE)) { final String inline = evt.getNewValue().toString(); viewer.openStringInline(inline); } f.setCursor(Cursor.getDefaultCursor()); } }); this.setDropTarget(new DropTarget(this, dropper)); this.setEnabled(true); say(GT._("Launching main frame...")); }
From source file:org.sleuthkit.autopsy.casemodule.Case.java
/** * Updates the current case to the given case and fires off the appropriate * property-change/* w w w. j av a2 s . c o m*/ * * @param newCase the new current case or null if case is being closed * */ private static void changeCase(Case newCase) { // close the existing case Case oldCase = Case.currentCase; Case.currentCase = null; if (oldCase != null) { SwingUtilities.invokeLater(() -> { WindowManager.getDefault().getMainWindow() .setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); }); IngestManager.getInstance().cancelAllIngestJobs(); doCaseChange(null); //closes windows, etc if (null != oldCase.tskErrorReporter) { oldCase.tskErrorReporter.shutdown(); // stop listening for TSK errors for the old case oldCase.tskErrorReporter = null; } eventPublisher.publishLocally(new AutopsyEvent(Events.CURRENT_CASE.toString(), oldCase, null)); if (CaseType.MULTI_USER_CASE == oldCase.getCaseType()) { if (null != oldCase.collaborationMonitor) { oldCase.collaborationMonitor.shutdown(); } eventPublisher.closeRemoteEventChannel(); } } if (newCase != null) { currentCase = newCase; Logger.setLogDirectory(currentCase.getLogDirectoryPath()); // sanity check if (null != currentCase.tskErrorReporter) { currentCase.tskErrorReporter.shutdown(); } // start listening for TSK errors for the new case currentCase.tskErrorReporter = new IntervalErrorReportData(currentCase, MIN_SECONDS_BETWEEN_ERROR_REPORTS, NbBundle.getMessage(Case.class, "IntervalErrorReport.ErrorText")); doCaseChange(currentCase); SwingUtilities.invokeLater(() -> { RecentCases.getInstance().addRecentCase(currentCase.name, currentCase.configFilePath); // update the recent cases }); if (CaseType.MULTI_USER_CASE == newCase.getCaseType()) { try { /** * Use the text index name as the remote event channel name * prefix since it is unique, the same as the case database * name for a multiuser case, and is readily available * through the Case.getTextIndexName() API. */ eventPublisher .openRemoteEventChannel(String.format(EVENT_CHANNEL_NAME, newCase.getTextIndexName())); currentCase.collaborationMonitor = new CollaborationMonitor(); } catch (AutopsyEventException | CollaborationMonitor.CollaborationMonitorException ex) { logger.log(Level.SEVERE, "Failed to setup for collaboration", ex); MessageNotifyUtil.Notify.error( NbBundle.getMessage(Case.class, "Case.CollaborationSetup.FailNotify.Title"), NbBundle.getMessage(Case.class, "Case.CollaborationSetup.FailNotify.ErrMsg")); } } eventPublisher.publishLocally(new AutopsyEvent(Events.CURRENT_CASE.toString(), null, currentCase)); } else { Logger.setLogDirectory(PlatformUtil.getLogDirectory()); } SwingUtilities.invokeLater(() -> { WindowManager.getDefault().getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }); }
From source file:edu.harvard.mcz.imagecapture.ImageCaptureApp.java
/** * Carry out actions to set up system after a successful login. *//*from w w w.jav a 2s . c om*/ public static void doStartUp() { boolean isCurrentAllowed = false; try { isCurrentAllowed = AllowedVersionLifeCycle.isCurrentAllowed(); } catch (HibernateException e) { log.error(e.getMessage(), e); String allowed = AllowedVersionLifeCycle.listAllowedVersions(); if (allowed == null || allowed.trim().length() == 0) { Singleton.getSingletonInstance().getMainFrame() .setStatusMessage("Database does not support this version, schema update needed."); JOptionPane.showMessageDialog(Singleton.getSingletonInstance().getMainFrame(), "The database does not support" + APP_NAME + " version " + APP_VERSION + ". A database schema update to version 1.3 is required.", "Schema Update Required", JOptionPane.OK_OPTION); log.error("Database does not test for versioning. Added in 1.3.0 Schema, and required by " + ImageCaptureApp.APP_VERSION + " Unable to Start"); ImageCaptureApp.exit(EXIT_ERROR); } } if (isCurrentAllowed) { Singleton.getSingletonInstance().getMainFrame().setStatusMessage(ImageCaptureApp.APP_VERSION + " OK"); } else { String allowed = AllowedVersionLifeCycle.listAllowedVersions(); Singleton.getSingletonInstance().getMainFrame() .setStatusMessage("Database does not support version, update needed."); JOptionPane.showMessageDialog(Singleton.getSingletonInstance().getMainFrame(), "The database does not support" + APP_NAME + " version " + APP_VERSION + ". A software update to " + allowed + " is required.", "Update Required", JOptionPane.OK_OPTION); log.error("Database does not allow version " + ImageCaptureApp.APP_VERSION + " Unable to Start"); log.error("Database recognises version(s): " + allowed.toString()); ImageCaptureApp.exit(EXIT_ERROR); } // Setup to store a list of running RunnableJobs. Singleton.getSingletonInstance().setJobList(new RunnableJobTableModel()); Singleton.getSingletonInstance().getMainFrame() .setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); Singleton.getSingletonInstance().getMainFrame().setState(MainFrame.STATE_RUNNING); }
From source file:org.tinymediamanager.ui.moviesets.dialogs.MovieSetEditorDialog.java
/** * Instantiates a new movie set editor.// www . j a v a 2 s .c o m * * @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")); }