List of usage examples for javax.swing JButton setToolTipText
@BeanProperty(bound = false, preferred = true, description = "The text to display in a tool tip.") public void setToolTipText(String text)
From source file:org.richie.codeGen.ui.GenAndPreviewUI.java
/** * ??//from w ww .j a va2 s. c o m * * @param fileName * @param fileContent */ private void addPreviewTablePanel(String fileName, String fileContent) { final JScrollPane content = new JScrollPane(); JTextArea viewTextArea = new JTextArea(); viewTextArea.setText(fileContent); content.setViewportView(viewTextArea); JPanel tab = new JPanel(); tab.setOpaque(false); JLabel tabLabel = new JLabel(fileName); ImageIcon closeXIcon = new ImageIcon(ClassLoader.getSystemResource("resources/images/close.gif")); JButton tabCloseButton = new JButton(closeXIcon); tabCloseButton.setToolTipText("close"); tabCloseButton.setBorder(null); tabCloseButton.setContentAreaFilled(false); tabCloseButton.setPreferredSize(new Dimension(closeXIcon.getIconWidth(), closeXIcon.getIconHeight())); tabCloseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int closeTabNumber = mainPanel.indexOfComponent(content); mainPanel.removeTabAt(closeTabNumber); } }); tab.add(tabLabel, BorderLayout.WEST); tab.add(tabCloseButton, BorderLayout.EAST); mainPanel.addTab(null, content); mainPanel.setTabComponentAt(mainPanel.getTabCount() - 1, tab); mainPanel.setSelectedComponent(content); }
From source file:org.rivalry.swingui.RivalryUI.java
/** * @param imageName Image name./*from w w w .jav a2 s.c om*/ * @param toolTipText Tool tip text. * @param altText Alternate text. * @param actionListener Action listener. * * @return a new button. */ private JButton createButton(final String imageName, final String toolTipText, final String altText, final ActionListener actionListener) { // Look for the image. final String imgLocation = "images/" + imageName; final URL imageURL = getClass().getClassLoader().getResource(imgLocation); // Create and initialize the button. final JButton button = new JButton(); button.setToolTipText(toolTipText); button.addActionListener(actionListener); if (imageURL != null) { // image found button.setIcon(new ImageIcon(imageURL, altText)); } else { // no image found button.setText(altText); System.err.println("Resource not found: " + imgLocation); } return button; }
From source file:org.stanwood.nwn2.gui.MainWindow.java
private void createComponents(JPanel panel1) { BorderLayout layout = new BorderLayout(5, 5); panel1.setLayout(layout);/* ww w.ja v a 2 s.c o m*/ JLabel lblList = new JLabel("Neverwinter Nights 2 GUI XML files:"); panel1.add(lblList, BorderLayout.NORTH); JPanel panel = new JPanel(); panel.setLayout(new BorderLayout(5, 5)); guiFileListModel = new DefaultListModel(); guiFileList = new JList(guiFileListModel); guiFileList.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { updateEnabledState(); } }); JScrollPane pane = new JScrollPane(guiFileList); JPanel buttonPanel1 = new JPanel(); buttonPanel1.setLayout(new BorderLayout()); panel.add(buttonPanel1, BorderLayout.EAST); JPanel buttonPanel2 = new JPanel(); buttonPanel1.add(buttonPanel2, BorderLayout.NORTH); buttonPanel2.setLayout(new GridLayout(4, 1, 5, 5)); JButton cmdAdd = new JButton( IconManager.getInstance().getIcon(IconManager.SIZE_22, IconManager.ICON_LIST_ADD)); cmdAdd.setToolTipText("Add a XML GUI file to the list"); cmdAdd.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { addNewGUIFile(); } }); buttonPanel2.add(cmdAdd); cmdRemove = new JButton( IconManager.getInstance().getIcon(IconManager.SIZE_22, IconManager.ICON_LIST_REMOVE)); cmdRemove.setToolTipText("Remove the selected XML GUI file from the list"); cmdRemove.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { guiFileListModel.remove(guiFileList.getSelectedIndex()); updateEnabledState(); saveChanges(); } }); buttonPanel2.add(cmdRemove); cmdDisplay = new JButton( IconManager.getInstance().getIcon(IconManager.SIZE_22, IconManager.ICON_LIST_VIEW)); cmdDisplay.setToolTipText("Render the selected XML GUI file"); cmdDisplay.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { displayGUIFile(); } }); buttonPanel2.add(cmdDisplay); cmdEdit = new JButton( IconManager.getInstance().getIcon(IconManager.SIZE_22, IconManager.ICON_ACCESSORIES_TEXT_EDITOR)); cmdEdit.setToolTipText("Open the selected XML GUI file in a editor"); cmdEdit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { File guiFile = getSelectedFile(); try { Desktop.getDesktop().edit(guiFile); } catch (IOException e1) { JOptionPane.showMessageDialog(MainWindow.this, e1.getMessage(), "NWN2GUI Error", JOptionPane.ERROR_MESSAGE); log.error(e1.getMessage(), e1); } catch (UnsupportedOperationException e1) { //TODO add support for other platforms JOptionPane.showMessageDialog(MainWindow.this, "Unable to find the systems default editor", "NWN2GUI Error", JOptionPane.ERROR_MESSAGE); } } }); buttonPanel2.add(cmdEdit); panel.add(pane, BorderLayout.CENTER); panel1.add(panel, BorderLayout.CENTER); }
From source file:org.swiftexplorer.gui.AboutDlg.java
public static void show(Component parent, HasLocalizedStrings stringsBundle) { URI uri = null;/*from w w w . j av a 2 s.co m*/ try { uri = new URI("http://www.swiftexplorer.org"); } catch (URISyntaxException e) { logger.error("URL seems to be ill-formed", e); } final String buttontext = "www.swiftexplorer.org"; Box mainBox = Box.createVerticalBox(); mainBox.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0)); StringBuilder sb = loadResource("/about.html"); JLabel label = new JLabel(sb.toString()); label.getAccessibleContext().setAccessibleDescription(getTitle(stringsBundle)); mainBox.add(label); if (uri != null) { JButton button = new JButton(); button.setText(buttontext); button.setToolTipText(uri.toString()); button.addActionListener(new OpenUrlAction(uri)); FontMetrics metrics = button.getFontMetrics(button.getFont()); if (metrics != null) button.setSize(metrics.stringWidth(buttontext), button.getHeight()); button.getAccessibleContext().setAccessibleDescription(buttontext); mainBox.add(button); } mainBox.add(Box.createVerticalStrut(10)); JPanel panel = new JPanel(); panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); panel.add(mainBox); JOptionPane.showMessageDialog(parent, panel, getTitle(stringsBundle), JOptionPane.INFORMATION_MESSAGE, getIcon()); }
From source file:org.tinymediamanager.ui.dialogs.ImageChooserDialog.java
/** * Instantiates a new image chooser dialog. * //from ww w . jav a 2s . com * @param ids * the ids * @param type * the type * @param artworkScrapers * the artwork providers * @param imageLabel * the image label * @param extraThumbs * the extra thumbs * @param extraFanarts * the extra fanarts * @param mediaType * the media for for which artwork has to be chosen */ public ImageChooserDialog(final HashMap<String, Object> ids, ImageType type, List<MediaScraper> artworkScrapers, ImageLabel imageLabel, List<String> extraThumbs, List<String> extraFanarts, MediaType mediaType) { super("", "imageChooser"); this.imageLabel = imageLabel; this.type = type; this.mediaType = mediaType; this.artworkScrapers = artworkScrapers; this.extraThumbs = extraThumbs; this.extraFanarts = extraFanarts; switch (type) { case FANART: setTitle(BUNDLE.getString("image.choose.fanart")); //$NON-NLS-1$ break; case POSTER: setTitle(BUNDLE.getString("image.choose.poster")); //$NON-NLS-1$ break; case BANNER: setTitle(BUNDLE.getString("image.choose.banner")); //$NON-NLS-1$ break; case SEASON: Object season = ids.get("tvShowSeason"); if (season != null) { setTitle(BUNDLE.getString("image.choose.season") + " - " + BUNDLE.getString("metatag.season") + " " //$NON-NLS-1$ + season); } else { setTitle(BUNDLE.getString("image.choose.season")); //$NON-NLS-1$ } break; case CLEARART: setTitle(BUNDLE.getString("image.choose.clearart")); //$NON-NLS-1$ break; case DISC: setTitle(BUNDLE.getString("image.choose.disc")); //$NON-NLS-1$ break; case LOGO: setTitle(BUNDLE.getString("image.choose.logo")); //$NON-NLS-1$ break; case CLEARLOGO: setTitle(BUNDLE.getString("image.choose.clearlogo")); //$NON-NLS-1$ break; case THUMB: setTitle(BUNDLE.getString("image.choose.thumb")); //$NON-NLS-1$ break; } setBounds(5, 5, 1000, 590); getContentPane().setLayout(new BorderLayout()); getContentPane().add(contentPanel, BorderLayout.CENTER); contentPanel.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("258px:grow"), FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, }, new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, RowSpec.decode("fill:266px:grow"), FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, })); { scrollPane = new JScrollPane(); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); contentPanel.add(scrollPane, "2, 2, 3, 1, fill, fill"); { panelImages = new JPanel(); scrollPane.setViewportView(panelImages); scrollPane.getVerticalScrollBar().setUnitIncrement(16); panelImages.setLayout(new WrapLayout(FlowLayout.LEFT)); } } { tfImageUrl = new EnhancedTextField(BUNDLE.getString("image.inserturl")); //$NON-NLS-1$ contentPanel.add(tfImageUrl, "2, 4, fill, default"); tfImageUrl.setColumns(10); JButton btnAddImage = new JButton(BUNDLE.getString("image.downloadimage")); //$NON-NLS-1$ btnAddImage.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (StringUtils.isNotBlank(tfImageUrl.getText())) { downloadAndPreviewImage(tfImageUrl.getText()); } } }); contentPanel.add(btnAddImage, "4, 4"); } { JPanel bottomPane = new JPanel(); getContentPane().add(bottomPane, BorderLayout.SOUTH); bottomPane.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.NARROW_LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.NARROW_LINE_GAP_ROWSPEC, RowSpec.decode("23px:grow"), FormFactory.RELATED_GAP_ROWSPEC, })); { if (type == ImageType.FANART && extraFanarts != null && extraThumbs != null) { JPanel panelExtraButtons = new JPanel(); bottomPane.add(panelExtraButtons, "2, 2, fill, bottom"); panelExtraButtons.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 0)); { if (mediaType == MediaType.MOVIE && MovieModuleManager.MOVIE_SETTINGS.isImageExtraThumbs()) { JLabel labelThumbs = new JLabel("Extrathumbs:"); panelExtraButtons.add(labelThumbs); JButton btnMarkExtrathumbs = new JButton(""); btnMarkExtrathumbs.setMargin(new Insets(0, 0, 0, 0)); btnMarkExtrathumbs.setIcon(IconManager.CHECK_ALL); btnMarkExtrathumbs.setToolTipText(BUNDLE.getString("image.extrathumbs.markall")); //$NON-NLS-1$ btnMarkExtrathumbs.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { for (JToggleButton button : buttons) { if (button .getClientProperty("MediaArtworkExtrathumb") instanceof JCheckBox) { JCheckBox chkbx = (JCheckBox) button .getClientProperty("MediaArtworkExtrathumb"); chkbx.setSelected(true); } } } }); panelExtraButtons.add(btnMarkExtrathumbs); JButton btnUnMarkExtrathumbs = new JButton(""); btnUnMarkExtrathumbs.setMargin(new Insets(0, 0, 0, 0)); btnUnMarkExtrathumbs.setIcon(IconManager.UNCHECK_ALL); btnUnMarkExtrathumbs.setToolTipText(BUNDLE.getString("image.extrathumbs.unmarkall")); //$NON-NLS-1$ btnUnMarkExtrathumbs.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { for (JToggleButton button : buttons) { if (button .getClientProperty("MediaArtworkExtrathumb") instanceof JCheckBox) { JCheckBox chkbx = (JCheckBox) button .getClientProperty("MediaArtworkExtrathumb"); chkbx.setSelected(false); } } } }); panelExtraButtons.add(btnUnMarkExtrathumbs); } if (mediaType == MediaType.MOVIE && MovieModuleManager.MOVIE_SETTINGS.isImageExtraThumbs() && MovieModuleManager.MOVIE_SETTINGS.isImageExtraFanart()) { JSeparator separator = new JSeparator(SwingConstants.VERTICAL); separator.setPreferredSize(new Dimension(2, 16)); panelExtraButtons.add(separator); } if (mediaType == MediaType.MOVIE && MovieModuleManager.MOVIE_SETTINGS.isImageExtraFanart()) { JLabel labelFanart = new JLabel("Extrafanart:"); panelExtraButtons.add(labelFanart); JButton btnMarkExtrafanart = new JButton(""); btnMarkExtrafanart.setMargin(new Insets(0, 0, 0, 0)); btnMarkExtrafanart.setIcon(IconManager.CHECK_ALL); btnMarkExtrafanart.setToolTipText(BUNDLE.getString("image.extrafanart.markall")); //$NON-NLS-1$ btnMarkExtrafanart.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { for (JToggleButton button : buttons) { if (button.getClientProperty( "MediaArtworkExtrafanart") instanceof JCheckBox) { JCheckBox chkbx = (JCheckBox) button .getClientProperty("MediaArtworkExtrafanart"); chkbx.setSelected(true); } } } }); panelExtraButtons.add(btnMarkExtrafanart); JButton btnUnMarkExtrafanart = new JButton(""); btnUnMarkExtrafanart.setMargin(new Insets(0, 0, 0, 0)); btnUnMarkExtrafanart.setIcon(IconManager.UNCHECK_ALL); btnUnMarkExtrafanart.setToolTipText(BUNDLE.getString("image.extrafanart.unmarkall")); //$NON-NLS-1$ btnUnMarkExtrafanart.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { for (JToggleButton button : buttons) { if (button.getClientProperty( "MediaArtworkExtrafanart") instanceof JCheckBox) { JCheckBox chkbx = (JCheckBox) button .getClientProperty("MediaArtworkExtrafanart"); chkbx.setSelected(false); } } } }); panelExtraButtons.add(btnUnMarkExtrafanart); } } } } { progressBar = new JProgressBar(); bottomPane.add(progressBar, "2, 4"); } { lblProgressAction = new JLabel(""); bottomPane.add(lblProgressAction, "4, 4"); } { JPanel buttonPane = new JPanel(); EqualsLayout layout = new EqualsLayout(5); buttonPane.setLayout(layout); layout.setMinWidth(100); bottomPane.add(buttonPane, "6, 4, fill, top"); JButton okButton = new JButton(BUNDLE.getString("Button.ok")); //$NON-NLS-1$ okButton.setAction(actionOK); okButton.setActionCommand("OK"); buttonPane.add(okButton); getRootPane().setDefaultButton(okButton); JButton btnAddFile = new JButton(BUNDLE.getString("Button.addfile")); //$NON-NLS-1$ btnAddFile.setAction(actionLocalFile); buttonPane.add(btnAddFile); JButton cancelButton = new JButton(BUNDLE.getString("Button.cancel")); //$NON-NLS-1$ cancelButton.setAction(actionCancel); cancelButton.setActionCommand("Cancel"); buttonPane.add(cancelButton); } } task = new DownloadTask(ids, this.artworkScrapers); task.execute(); }
From source file:org.tinymediamanager.ui.movies.settings.MovieSettingsPanel.java
/** * Instantiates a new movie settings panel. *//*from w ww . jav a 2 s . c om*/ public MovieSettingsPanel() { setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, RowSpec.decode("default:grow"), })); JPanel panelGeneral = new JPanel(); panelGeneral.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.general"), TitledBorder.LEADING, //$NON-NLS-1$ TitledBorder.TOP, null, null)); add(panelGeneral, "2, 2, fill, fill"); panelGeneral.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.UNRELATED_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, })); JLabel lblVisiblecolumns = new JLabel(BUNDLE.getString("Settings.movie.visiblecolumns")); //$NON-NLS-1$ panelGeneral.add(lblVisiblecolumns, "2, 2, right, default"); chckbxYear = new JCheckBox(BUNDLE.getString("metatag.year")); //$NON-NLS-1$ panelGeneral.add(chckbxYear, "4, 2"); chckbxRating = new JCheckBox(BUNDLE.getString("metatag.rating")); //$NON-NLS-1$ panelGeneral.add(chckbxRating, "6, 2"); chckbxNfo = new JCheckBox(BUNDLE.getString("metatag.nfo")); //$NON-NLS-1$ panelGeneral.add(chckbxNfo, "8, 2"); chckbxMetadata = new JCheckBox(BUNDLE.getString("tmm.metadata")); //$NON-NLS-1$ panelGeneral.add(chckbxMetadata, "10, 2"); chckbxDateAdded = new JCheckBox(BUNDLE.getString("metatag.dateadded")); //$NON-NLS-1$ panelGeneral.add(chckbxDateAdded, "12, 2"); chckbxImages = new JCheckBox(BUNDLE.getString("metatag.images")); //$NON-NLS-1$ panelGeneral.add(chckbxImages, "4, 4"); chckbxTrailer = new JCheckBox(BUNDLE.getString("metatag.trailer")); //$NON-NLS-1$ panelGeneral.add(chckbxTrailer, "6, 4"); chckbxSubtitles = new JCheckBox(BUNDLE.getString("metatag.subtitles")); //$NON-NLS-1$ panelGeneral.add(chckbxSubtitles, "8, 4"); chckbxWatched = new JCheckBox(BUNDLE.getString("metatag.watched")); //$NON-NLS-1$ panelGeneral.add(chckbxWatched, "10, 4"); JLabel lblSaveUiFilter = new JLabel(BUNDLE.getString("Settings.movie.persistuifilter")); //$NON-NLS-1$ panelGeneral.add(lblSaveUiFilter, "2, 6, right, default"); chckbxSaveUiFilter = new JCheckBox(""); panelGeneral.add(chckbxSaveUiFilter, "4, 6"); JSeparator separator_4 = new JSeparator(); panelGeneral.add(separator_4, "2, 8, 11, 1"); JLabel lblImageCache = new JLabel(BUNDLE.getString("Settings.imagecacheimport")); panelGeneral.add(lblImageCache, "2, 10, right, default"); chckbxImageCache = new JCheckBox(BUNDLE.getString("Settings.imagecacheimporthint")); //$NON-NLS-1$ TmmFontHelper.changeFont(chckbxImageCache, 0.833); panelGeneral.add(chckbxImageCache, "4, 10, 7, 1"); JLabel lblRuntimeFromMedia = new JLabel(BUNDLE.getString("Settings.runtimefrommediafile")); panelGeneral.add(lblRuntimeFromMedia, "2, 12, right, default"); chckbxRuntimeFromMf = new JCheckBox(""); panelGeneral.add(chckbxRuntimeFromMf, "4, 12"); JSeparator separator = new JSeparator(); panelGeneral.add(separator, "2, 14, 11, 1"); final JLabel lblAutomaticRename = new JLabel(BUNDLE.getString("Settings.movie.automaticrename")); //$NON-NLS-1$ panelGeneral.add(lblAutomaticRename, "2, 16, right, default"); chckbxRename = new JCheckBox(BUNDLE.getString("Settings.movie.automaticrename.desc")); //$NON-NLS-1$ panelGeneral.add(chckbxRename, "4, 16, 7, 1"); JLabel lblTraktTv = new JLabel(BUNDLE.getString("Settings.trakt"));//$NON-NLS-1$ panelGeneral.add(lblTraktTv, "2, 18"); chckbxTraktTv = new JCheckBox(""); panelGeneral.add(chckbxTraktTv, "4, 18"); JButton btnClearTraktTvMovies = new JButton(BUNDLE.getString("Settings.trakt.clearmovies"));//$NON-NLS-1$ btnClearTraktTvMovies.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int confirm = JOptionPane.showOptionDialog(null, BUNDLE.getString("Settings.trakt.clearmovies.hint"), BUNDLE.getString("Settings.trakt.clearmovies"), JOptionPane.YES_NO_OPTION, //$NON-NLS-1$ JOptionPane.QUESTION_MESSAGE, null, null, null); if (confirm == JOptionPane.YES_OPTION) { TmmTask task = new ClearTraktTvTask(true, false); TmmTaskManager.getInstance().addUnnamedTask(task); } } }); panelGeneral.add(btnClearTraktTvMovies, "6, 18, 3, 1, left, default"); JPanel panelMovieDataSources = new JPanel(); panelMovieDataSources.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.movie.datasource"), //$NON-NLS-1$ TitledBorder.LEADING, TitledBorder.TOP, null, null)); add(panelMovieDataSources, "2, 4, 3, 1, fill, fill"); panelMovieDataSources.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("150dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.UNRELATED_GAP_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("150dlu:grow(2)"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, RowSpec.decode("100px:grow"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, })); JLabel lblDataSource = new JLabel(BUNDLE.getString("Settings.source")); //$NON-NLS-1$ panelMovieDataSources.add(lblDataSource, "2, 2, 5, 1"); JLabel lblIngore = new JLabel(BUNDLE.getString("Settings.ignore")); //$NON-NLS-1$ panelMovieDataSources.add(lblIngore, "12, 2"); JScrollPane scrollPaneDataSources = new JScrollPane(); panelMovieDataSources.add(scrollPaneDataSources, "2, 4, 5, 1, fill, fill"); listDataSources = new JList<>(); scrollPaneDataSources.setViewportView(listDataSources); JPanel panelMovieSourcesButtons = new JPanel(); panelMovieDataSources.add(panelMovieSourcesButtons, "8, 4, fill, top"); panelMovieSourcesButtons .setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.DEFAULT_COLSPEC, }, new RowSpec[] { FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, })); JButton btnAdd = new JButton(IconManager.LIST_ADD); btnAdd.setToolTipText(BUNDLE.getString("Button.add")); //$NON-NLS-1$ btnAdd.setMargin(new Insets(2, 2, 2, 2)); btnAdd.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { Path file = TmmUIHelper.selectDirectory(BUNDLE.getString("Settings.datasource.folderchooser")); //$NON-NLS-1$ if (file != null && Files.isDirectory(file)) { settings.addMovieDataSources(file.toAbsolutePath().toString()); } } }); panelMovieSourcesButtons.add(btnAdd, "1, 1, fill, top"); JButton btnRemove = new JButton(IconManager.LIST_REMOVE); btnRemove.setToolTipText(BUNDLE.getString("Button.remove")); //$NON-NLS-1$ btnRemove.setMargin(new Insets(2, 2, 2, 2)); btnRemove.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { int row = listDataSources.getSelectedIndex(); if (row != -1) { // nothing selected String path = MovieModuleManager.MOVIE_SETTINGS.getMovieDataSource().get(row); String[] choices = { BUNDLE.getString("Button.continue"), BUNDLE.getString("Button.abort") }; //$NON-NLS-1$ int decision = JOptionPane.showOptionDialog(null, String.format(BUNDLE.getString("Settings.movie.datasource.remove.info"), path), BUNDLE.getString("Settings.datasource.remove"), JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE, null, choices, BUNDLE.getString("Button.abort")); //$NON-NLS-1$ if (decision == 0) { setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); MovieModuleManager.MOVIE_SETTINGS.removeMovieDataSources(path); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } } }); panelMovieSourcesButtons.add(btnRemove, "1, 3, fill, top"); JScrollPane scrollPaneIgnore = new JScrollPane(); panelMovieDataSources.add(scrollPaneIgnore, "12, 4, fill, fill"); listIgnore = new JList<>(); scrollPaneIgnore.setViewportView(listIgnore); JPanel panelIgnoreButtons = new JPanel(); panelMovieDataSources.add(panelIgnoreButtons, "14, 4, fill, fill"); panelIgnoreButtons.setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.DEFAULT_COLSPEC, }, new RowSpec[] { FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, })); JButton btnAddIgnore = new JButton(IconManager.LIST_ADD); btnAddIgnore.setToolTipText(BUNDLE.getString("Settings.addignore")); //$NON-NLS-1$ btnAddIgnore.setMargin(new Insets(2, 2, 2, 2)); btnAddIgnore.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Path file = TmmUIHelper.selectDirectory(BUNDLE.getString("Settings.ignore")); //$NON-NLS-1$ if (file != null && Files.isDirectory(file)) { settings.addMovieSkipFolder(file.toAbsolutePath().toString()); } } }); panelIgnoreButtons.add(btnAddIgnore, "1, 1"); JButton btnRemoveIgnore = new JButton(IconManager.LIST_REMOVE); btnRemoveIgnore.setToolTipText(BUNDLE.getString("Settings.removeignore")); //$NON-NLS-1$ btnRemoveIgnore.setMargin(new Insets(2, 2, 2, 2)); btnRemoveIgnore.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int row = listIgnore.getSelectedIndex(); if (row != -1) { // nothing selected String ingore = settings.getMovieSkipFolders().get(row); settings.removeMovieSkipFolder(ingore); } } }); panelIgnoreButtons.add(btnRemoveIgnore, "1, 3"); JPanel panel = new JPanel(); panelMovieDataSources.add(panel, "2, 8, 13, 1, fill, fill"); panel.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("20dlu"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, }, new RowSpec[] { FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, })); JLabel lblNfoFormat = new JLabel(BUNDLE.getString("Settings.nfoFormat")); panel.add(lblNfoFormat, "1, 1, right, default"); cbNfoFormat = new JComboBox(MovieConnectors.values()); panel.add(cbNfoFormat, "3, 1, fill, default"); JLabel lblNfoFileNaming = new JLabel(BUNDLE.getString("Settings.nofFileNaming")); //$NON-NLS-1$ panel.add(lblNfoFileNaming, "7, 1, right, default"); cbMovieNfoFilename1 = new JCheckBox(BUNDLE.getString("Settings.moviefilename") + ".nfo"); //$NON-NLS-1$ panel.add(cbMovieNfoFilename1, "9, 1"); cbMovieNfoFilename2 = new JCheckBox("movie.nfo"); panel.add(cbMovieNfoFilename2, "9, 2"); cbMovieNfoFilename2.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { checkChanges(); } }); cbMovieNfoFilename3 = new JCheckBox(BUNDLE.getString("Settings.nfo.discstyle")); //$NON-NLS-1$ panel.add(cbMovieNfoFilename3, "9, 3"); cbMovieNfoFilename3.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { checkChanges(); } }); final JLabel lblCertificationStyle = new JLabel(BUNDLE.getString("Settings.certificationformat")); //$NON-NLS-1$ panel.add(lblCertificationStyle, "1, 5, right, default"); cbCertificationStyle = new JComboBox(); panel.add(cbCertificationStyle, "3, 5, 7, 1, fill, default"); JPanel panelBadWords = new JPanel(); panelBadWords.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.movie.badwords"), //$NON-NLS-1$ TitledBorder.LEADING, TitledBorder.TOP, null, null)); add(panelBadWords, "4, 2, fill, fill"); panelBadWords.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("50px:grow"), FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, }, new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, })); JTextPane txtpntBadWordsHint = new JTextPane(); txtpntBadWordsHint.setBackground(UIManager.getColor("Panel.background")); txtpntBadWordsHint.setText(BUNDLE.getString("Settings.movie.badwords.hint")); //$NON-NLS-1$ TmmFontHelper.changeFont(txtpntBadWordsHint, 0.833); panelBadWords.add(txtpntBadWordsHint, "2, 2, 3, 1, fill, default"); JScrollPane scpBadWords = new JScrollPane(); panelBadWords.add(scpBadWords, "2, 4, fill, fill"); listBadWords = new JList<>(); scpBadWords.setViewportView(listBadWords); JButton btnRemoveBadWord = new JButton(IconManager.LIST_REMOVE); btnRemoveBadWord.setToolTipText(BUNDLE.getString("Button.remove")); //$NON-NLS-1$ btnRemoveBadWord.setMargin(new Insets(2, 2, 2, 2)); btnRemoveBadWord.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { int row = listBadWords.getSelectedIndex(); if (row != -1) { String badWord = MovieModuleManager.MOVIE_SETTINGS.getBadWords().get(row); MovieModuleManager.MOVIE_SETTINGS.removeBadWord(badWord); } } }); panelBadWords.add(btnRemoveBadWord, "4, 4, default, bottom"); tfAddBadword = new JTextField(); tfAddBadword.setColumns(10); panelBadWords.add(tfAddBadword, "2, 6, fill, default"); JButton btnAddBadWord = new JButton(IconManager.LIST_ADD); btnAddBadWord.setToolTipText(BUNDLE.getString("Button.add")); //$NON-NLS-1$ btnAddBadWord.setMargin(new Insets(2, 2, 2, 2)); btnAddBadWord.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (StringUtils.isNotEmpty(tfAddBadword.getText())) { MovieModuleManager.MOVIE_SETTINGS.addBadWord(tfAddBadword.getText()); tfAddBadword.setText(""); } } }); panelBadWords.add(btnAddBadWord, "4, 6"); initDataBindings(); { // NFO filenames List<MovieNfoNaming> movieNfoFilenames = settings.getMovieNfoFilenames(); if (movieNfoFilenames.contains(MovieNfoNaming.FILENAME_NFO)) { cbMovieNfoFilename1.setSelected(true); } if (movieNfoFilenames.contains(MovieNfoNaming.MOVIE_NFO)) { cbMovieNfoFilename2.setSelected(true); } if (movieNfoFilenames.contains(MovieNfoNaming.DISC_NFO)) { cbMovieNfoFilename3.setSelected(true); } if (!Globals.isDonator()) { chckbxTraktTv.setSelected(false); chckbxTraktTv.setEnabled(false); btnClearTraktTvMovies.setEnabled(false); } // set default certification style cbNfoFormat.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (cbNfoFormat.getSelectedItem() == MovieConnectors.MP) { for (int i = 0; i < cbCertificationStyle.getItemCount(); i++) { CertificationStyleWrapper wrapper = cbCertificationStyle.getItemAt(i); if (wrapper.style == CertificationStyle.TECHNICAL) { cbCertificationStyle.setSelectedItem(wrapper); break; } } } else if (cbNfoFormat.getSelectedItem() == MovieConnectors.XBMC || cbNfoFormat.getSelectedItem() == MovieConnectors.KODI) { for (int i = 0; i < cbCertificationStyle.getItemCount(); i++) { CertificationStyleWrapper wrapper = cbCertificationStyle.getItemAt(i); if (wrapper.style == CertificationStyle.LARGE) { cbCertificationStyle.setSelectedItem(wrapper); break; } } } } }); // certification examples for (CertificationStyle style : CertificationStyle.values()) { CertificationStyleWrapper wrapper = new CertificationStyleWrapper(); wrapper.style = style; cbCertificationStyle.addItem(wrapper); if (style == settings.getMovieCertificationStyle()) { cbCertificationStyle.setSelectedItem(wrapper); } } cbCertificationStyle.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { checkChanges(); } }); // item listener cbMovieNfoFilename1.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { checkChanges(); } }); } }
From source file:org.tinymediamanager.ui.moviesets.dialogs.MovieSetChooserDialog.java
/** * Instantiates a new movie set chooser panel. * /*from w w w . j a v a 2 s. co m*/ * @param movieSet * the movie set */ public MovieSetChooserDialog(MovieSet movieSet, boolean inQueue) { super(BUNDLE.getString("movieset.search"), "movieSetChooser"); //$NON-NLS-1$ setBounds(5, 5, 865, 578); movieSetToScrape = movieSet; getContentPane().setLayout(new BorderLayout(0, 0)); JPanel panelHeader = new JPanel(); getContentPane().add(panelHeader, BorderLayout.NORTH); panelHeader.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("114px:grow"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("100px"), ColumnSpec.decode("2dlu"), }, new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, RowSpec.decode("25px"), FormFactory.RELATED_GAP_ROWSPEC, })); { tfMovieSetName = new JTextField(); panelHeader.add(tfMovieSetName, "2, 2, fill, fill"); tfMovieSetName.setColumns(10); } { JButton btnSearch = new JButton(""); btnSearch.setAction(actionSearch); panelHeader.add(btnSearch, "4, 2, fill, top"); } { JSplitPane splitPane = new JSplitPane(); splitPane.setContinuousLayout(true); splitPane.setResizeWeight(0.5); getContentPane().add(splitPane, BorderLayout.CENTER); { JPanel panelResults = new JPanel(); panelResults.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("300px:grow"), }, new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, RowSpec.decode("fill:403px:grow"), })); JScrollPane panelSearchResults = new JScrollPane(); panelResults.add(panelSearchResults, "2, 2, fill, fill"); splitPane.setLeftComponent(panelResults); { tableMovieSets = new JTable(); panelSearchResults.setViewportView(tableMovieSets); tableMovieSets.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); tableMovieSets.setBorder(new LineBorder(new Color(0, 0, 0))); ListSelectionModel rowSM = tableMovieSets.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { // Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel) e.getSource(); if (!lsm.isSelectionEmpty()) { int selectedRow = lsm.getMinSelectionIndex(); selectedRow = tableMovieSets.convertRowIndexToModel(selectedRow); try { MovieSetChooserModel model = movieSetsFound.get(selectedRow); if (model != MovieSetChooserModel.emptyResult && !model.isScraped()) { ScrapeTask task = new ScrapeTask(model); task.execute(); } } catch (Exception ex) { LOGGER.warn(ex.getMessage()); } } } }); } } { JPanel panelSearchDetail = new JPanel(); splitPane.setRightComponent(panelSearchDetail); panelSearchDetail.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("left:150px"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(300px;default):grow"), FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("250px"), FormFactory.PARAGRAPH_GAP_ROWSPEC, RowSpec.decode("top:default:grow"), FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC })); { lblMovieSetName = new JTextArea(""); lblMovieSetName.setLineWrap(true); lblMovieSetName.setOpaque(false); lblMovieSetName.setWrapStyleWord(true); TmmFontHelper.changeFont(lblMovieSetName, 1.166, Font.BOLD); panelSearchDetail.add(lblMovieSetName, "2, 1, 3, 1, fill, top"); } { lblMovieSetPoster = new ImageLabel(); lblMovieSetPoster.setAlternativeText(BUNDLE.getString("image.notfound.poster")); //$NON-NLS-1$ panelSearchDetail.add(lblMovieSetPoster, "2, 3, fill, fill"); } { JPanel panel = new JPanel(); panelSearchDetail.add(panel, "4, 3, fill, fill"); panel.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), }, new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, })); } { JScrollPane scrollPane = new JScrollPane(); panelSearchDetail.add(scrollPane, "2, 5, 3, 1, fill, fill"); { tableMovies = new JTable(); scrollPane.setViewportView(tableMovies); } } { cbAssignMovies = new JCheckBox(BUNDLE.getString("movieset.movie.assign")); //$NON-NLS-1$ cbAssignMovies.setSelected(true); panelSearchDetail.add(cbAssignMovies, "2, 7, 3, 1"); } } } { JPanel bottomPane = new JPanel(); getContentPane().add(bottomPane, BorderLayout.SOUTH); { bottomPane.setLayout(new FormLayout(new ColumnSpec[] { ColumnSpec.decode("2dlu"), ColumnSpec.decode("185px"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("18px:grow"), FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, ColumnSpec.decode("2dlu"), }, new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC })); { progressBar = new JProgressBar(); bottomPane.add(progressBar, "2, 2, fill, center"); } { lblProgressAction = new JLabel(""); bottomPane.add(lblProgressAction, "4, 2, fill, center"); } { JPanel buttonPane = new JPanel(); bottomPane.add(buttonPane, "6, 2, fill, fill"); EqualsLayout layout = new EqualsLayout(5); buttonPane.setBorder(new EmptyBorder(4, 4, 4, 4)); layout.setMinWidth(100); buttonPane.setLayout(layout); btnOk = new JButton(BUNDLE.getString("Button.ok")); //$NON-NLS-1$ btnOk.setActionCommand("Save"); btnOk.setToolTipText(BUNDLE.getString("Button.ok")); //$NON-NLS-1$ btnOk.setIcon(IconManager.APPLY); btnOk.addActionListener(this); buttonPane.add(btnOk); JButton btnCancel = new JButton(BUNDLE.getString("Button.cancel")); //$NON-NLS-1$ btnCancel.setActionCommand("Cancel"); btnCancel.setToolTipText(BUNDLE.getString("Button.cancel")); //$NON-NLS-1$ btnCancel.setIcon(IconManager.CANCEL); btnCancel.addActionListener(this); buttonPane.add(btnCancel); if (inQueue) { JButton btnAbort = new JButton(BUNDLE.getString("Button.abortqueue")); //$NON-NLS-1$ btnAbort.setActionCommand("Abort"); btnAbort.setToolTipText(BUNDLE.getString("Button.abortqueue")); //$NON-NLS-1$ btnAbort.setIcon(IconManager.PROCESS_STOP); btnAbort.addActionListener(this); buttonPane.add(btnAbort, "6, 1, fill, top"); } } } } initDataBindings(); // adjust table columns tableMovies.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); tableMovies.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); tableMovieSets.getColumnModel().getColumn(0).setHeaderValue(BUNDLE.getString("chooser.searchresult")); tfMovieSetName.setText(movieSet.getTitle()); searchMovie(); }
From source file:org.tinymediamanager.ui.settings.FileTypesSettingsPanel.java
/** * Instantiates a new general settings panel. *//*w w w. j av a 2s . co m*/ public FileTypesSettingsPanel() { setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("left:max(200px;min)"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(200px;default)"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(200px;default)"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(200px;default)"), }, new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("top:default"), FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("top:default"), FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), })); panelVideoFiletypes = new JPanel(); panelVideoFiletypes.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), //$NON-NLS-1$ BUNDLE.getString("Settings.videofiletypes"), TitledBorder.LEADING, TitledBorder.TOP, null, null)); panelVideoFiletypes.setLayout(new FormLayout(new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("100px:grow"), FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, })); JScrollPane scrollPaneVideoFiletypes = new JScrollPane(); panelVideoFiletypes.add(scrollPaneVideoFiletypes, "2, 2, 5, 1, fill, fill"); listVideoFiletypes = new JList(); scrollPaneVideoFiletypes.setViewportView(listVideoFiletypes); tfVideoFiletype = new JTextField(); panelVideoFiletypes.add(tfVideoFiletype, "2, 4, fill, default"); tfVideoFiletype.setColumns(10); JButton btnAddVideoFiletype = new JButton(IconManager.LIST_ADD); btnAddVideoFiletype.setToolTipText(BUNDLE.getString("Button.add")); //$NON-NLS-1$ btnAddVideoFiletype.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (StringUtils.isNotEmpty(tfVideoFiletype.getText())) { Globals.settings.addVideoFileTypes(tfVideoFiletype.getText()); tfVideoFiletype.setText(""); } } }); panelVideoFiletypes.add(btnAddVideoFiletype, "4, 4"); add(panelVideoFiletypes, "2, 2, fill, fill"); JButton btnRemoveVideoFiletype = new JButton(IconManager.LIST_REMOVE); btnRemoveVideoFiletype.setToolTipText(BUNDLE.getString("Button.remove")); //$NON-NLS-1$ btnRemoveVideoFiletype.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { int row = listVideoFiletypes.getSelectedIndex(); if (row != -1) { String prefix = Globals.settings.getVideoFileType().get(row); Globals.settings.removeVideoFileType(prefix); } } }); panelVideoFiletypes.add(btnRemoveVideoFiletype, "6, 4, default, bottom"); panelSubtitleFiletypes = new JPanel(); add(panelSubtitleFiletypes, "4, 2, fill, fill"); panelSubtitleFiletypes.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), //$NON-NLS-1$ BUNDLE.getString("Settings.extrafiletypes"), TitledBorder.LEADING, TitledBorder.TOP, null, null)); panelSubtitleFiletypes.setLayout(new FormLayout(new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("100px:grow"), FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, })); JScrollPane scrollPaneSubtitleFiletypes = new JScrollPane(); panelSubtitleFiletypes.add(scrollPaneSubtitleFiletypes, "2, 2, 5, 1, fill, fill"); listSubtitleFiletypes = new JList(); scrollPaneSubtitleFiletypes.setViewportView(listSubtitleFiletypes); tfSubtitleFiletype = new JTextField(); panelSubtitleFiletypes.add(tfSubtitleFiletype, "2, 4, fill, default"); tfSubtitleFiletype.setColumns(10); JButton btnAddSubtitleFiletype = new JButton(IconManager.LIST_ADD); btnAddSubtitleFiletype.setToolTipText(BUNDLE.getString("Button.add")); //$NON-NLS-1$ btnAddSubtitleFiletype.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (StringUtils.isNotEmpty(tfSubtitleFiletype.getText())) { Globals.settings.addSubtitleFileTypes(tfSubtitleFiletype.getText()); tfSubtitleFiletype.setText(""); } } }); panelSubtitleFiletypes.add(btnAddSubtitleFiletype, "4, 4"); JButton btnRemoveSubtitleFiletype = new JButton(IconManager.LIST_REMOVE); btnRemoveSubtitleFiletype.setToolTipText(BUNDLE.getString("Button.remove")); //$NON-NLS-1$ btnRemoveSubtitleFiletype.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { int row = listSubtitleFiletypes.getSelectedIndex(); if (row != -1) { String prefix = Globals.settings.getSubtitleFileType().get(row); Globals.settings.removeSubtitleFileType(prefix); } } }); panelSubtitleFiletypes.add(btnRemoveSubtitleFiletype, "6, 4, default, bottom"); panelAudioFiletypes = new JPanel(); add(panelAudioFiletypes, "6, 2, fill, fill"); panelAudioFiletypes.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), //$NON-NLS-1$ BUNDLE.getString("Settings.audiofiletypes"), TitledBorder.LEADING, TitledBorder.TOP, null, null)); panelAudioFiletypes.setLayout(new FormLayout(new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("100px:grow"), FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, })); JScrollPane scrollPaneAudioFiletypes = new JScrollPane(); panelAudioFiletypes.add(scrollPaneAudioFiletypes, "2, 2, 5, 1, fill, fill"); listAudioFiletypes = new JList(); scrollPaneAudioFiletypes.setViewportView(listAudioFiletypes); tfAudioFiletype = new JTextField(); panelAudioFiletypes.add(tfAudioFiletype, "2, 4, fill, default"); tfAudioFiletype.setColumns(10); JButton btnAddAudioFiletype = new JButton(IconManager.LIST_ADD); btnAddAudioFiletype.setToolTipText(BUNDLE.getString("Button.add")); //$NON-NLS-1$ btnAddAudioFiletype.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (StringUtils.isNotEmpty(tfAudioFiletype.getText())) { Globals.settings.addAudioFileTypes(tfAudioFiletype.getText()); tfAudioFiletype.setText(""); } } }); panelAudioFiletypes.add(btnAddAudioFiletype, "4, 4"); JButton btnRemoveAudioFiletype = new JButton(IconManager.LIST_REMOVE); btnRemoveAudioFiletype.setToolTipText(BUNDLE.getString("Button.remove")); //$NON-NLS-1$ btnRemoveAudioFiletype.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { int row = listAudioFiletypes.getSelectedIndex(); if (row != -1) { String prefix = Globals.settings.getAudioFileType().get(row); Globals.settings.removeAudioFileType(prefix); } } }); panelAudioFiletypes.add(btnRemoveAudioFiletype, "6, 4, default, bottom"); JPanel panelSortOptions = new JPanel(); panelSortOptions.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), BUNDLE.getString("Settings.sorting"), TitledBorder.LEADING, TitledBorder.TOP, null, null)); // $NON-NLS-1$ add(panelSortOptions, "2, 4, 3, 1, fill, fill"); panelSortOptions.setLayout(new FormLayout(new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, })); JScrollPane scrollPaneSortPrefixes = new JScrollPane(); panelSortOptions.add(scrollPaneSortPrefixes, "2, 2, 5, 1, fill, fill"); listSortPrefixes = new JList(); scrollPaneSortPrefixes.setViewportView(listSortPrefixes); tfSortPrefix = new JTextField(); panelSortOptions.add(tfSortPrefix, "2, 4, fill, default"); tfSortPrefix.setColumns(10); JButton btnAddSortPrefix = new JButton(IconManager.LIST_ADD); btnAddSortPrefix.setToolTipText(BUNDLE.getString("Button.add")); //$NON-NLS-1$ btnAddSortPrefix.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (StringUtils.isNotEmpty(tfSortPrefix.getText())) { Globals.settings.addTitlePrefix(tfSortPrefix.getText()); tfSortPrefix.setText(""); MovieList.getInstance().invalidateTitleSortable(); TvShowList.getInstance().invalidateTitleSortable(); } } }); panelSortOptions.add(btnAddSortPrefix, "4, 4"); JButton btnRemoveSortPrefix = new JButton(IconManager.LIST_REMOVE); btnRemoveSortPrefix.setToolTipText(BUNDLE.getString("Button.remove")); //$NON-NLS-1$ btnRemoveSortPrefix.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { int row = listSortPrefixes.getSelectedIndex(); if (row != -1) { String prefix = Globals.settings.getTitlePrefix().get(row); Globals.settings.removeTitlePrefix(prefix); MovieList.getInstance().invalidateTitleSortable(); TvShowList.getInstance().invalidateTitleSortable(); } } }); panelSortOptions.add(btnRemoveSortPrefix, "6, 4, default, bottom"); JTextPane tpSortingHints = new JTextPane(); TmmFontHelper.changeFont(tpSortingHints, 0.833); tpSortingHints.setText(BUNDLE.getString("Settings.sorting.info")); //$NON-NLS-1$ tpSortingHints.setBackground(UIManager.getColor("Panel.background")); panelSortOptions.add(tpSortingHints, "2, 6, 3, 1, fill, fill"); initDataBindings(); }
From source file:org.tinymediamanager.ui.tvshows.dialogs.TvShowEpisodeChooserDialog.java
public TvShowEpisodeChooserDialog(TvShowEpisode ep, MediaScraper mediaScraper) { super(BUNDLE.getString("tvshowepisode.choose"), "episodeChooser"); //$NON-NLS-1$ setBounds(5, 5, 600, 400);// ww w. jav a 2s .c o m this.episode = ep; this.mediaScraper = mediaScraper; this.metadata = new MediaEpisode(mediaScraper.getId()); episodeEventList = new ObservableElementList<>( GlazedLists.threadSafeList(new BasicEventList<TvShowEpisodeChooserModel>()), GlazedLists.beanConnector(TvShowEpisodeChooserModel.class)); sortedEpisodes = new SortedList<>(GlazedListsSwing.swingThreadProxyList(episodeEventList), new EpisodeComparator()); getContentPane().setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("590px:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("200dlu:grow"), FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("fill:37px"), FormSpecs.RELATED_GAP_ROWSPEC, })); { JSplitPane splitPane = new JSplitPane(); getContentPane().add(splitPane, "2, 2, fill, fill"); JPanel panelLeft = new JPanel(); panelLeft.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("150dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormSpecs.RELATED_GAP_ROWSPEC, })); textField = EnhancedTextField.createSearchTextField(); panelLeft.add(textField, "2, 2, fill, default"); textField.setColumns(10); JScrollPane scrollPane = new JScrollPane(); scrollPane.setMinimumSize(new Dimension(200, 23)); panelLeft.add(scrollPane, "2, 4, fill, fill"); splitPane.setLeftComponent(panelLeft); MatcherEditor<TvShowEpisodeChooserModel> textMatcherEditor = new TextComponentMatcherEditor<>(textField, new TvShowEpisodeChooserModelFilterator()); FilterList<TvShowEpisodeChooserModel> textFilteredEpisodes = new FilterList<>(sortedEpisodes, textMatcherEditor); AdvancedTableModel<TvShowEpisodeChooserModel> episodeTableModel = GlazedListsSwing .eventTableModelWithThreadProxyList(textFilteredEpisodes, new EpisodeTableFormat()); DefaultEventSelectionModel<TvShowEpisodeChooserModel> selectionModel = new DefaultEventSelectionModel<>( textFilteredEpisodes); selectedEpisodes = selectionModel.getSelected(); selectionModel.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting()) { return; } // display first selected episode if (!selectedEpisodes.isEmpty()) { TvShowEpisodeChooserModel episode = selectedEpisodes.get(0); taPlot.setText(episode.getOverview()); } else { taPlot.setText(""); } taPlot.setCaretPosition(0); } }); table = new JTable(episodeTableModel); table.setSelectionModel(selectionModel); scrollPane.setViewportView(table); JPanel panelRight = new JPanel(); panelRight.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("150dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.LINE_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormSpecs.RELATED_GAP_ROWSPEC, })); JScrollPane scrollPane_1 = new JScrollPane(); panelRight.add(scrollPane_1, "2, 2, fill, fill"); splitPane.setRightComponent(panelRight); taPlot = new JTextArea(); taPlot.setEditable(false); taPlot.setWrapStyleWord(true); taPlot.setLineWrap(true); scrollPane_1.setViewportView(taPlot); splitPane.setDividerLocation(300); } JPanel bottomPanel = new JPanel(); getContentPane().add(bottomPanel, "2, 4, fill, top"); bottomPanel.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default: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(); bottomPanel.add(buttonPane, "5, 2, fill, fill"); EqualsLayout layout = new EqualsLayout(5); layout.setMinWidth(100); buttonPane.setLayout(layout); final JButton okButton = new JButton(BUNDLE.getString("Button.ok")); //$NON-NLS-1$ okButton.setToolTipText(BUNDLE.getString("tvshow.change")); okButton.setIcon(IconManager.APPLY); buttonPane.add(okButton); okButton.setActionCommand("OK"); okButton.addActionListener(this); JButton cancelButton = new JButton(BUNDLE.getString("Button.cancel")); //$NON-NLS-1$ cancelButton.setToolTipText(BUNDLE.getString("edit.discard")); cancelButton.setIcon(IconManager.CANCEL); buttonPane.add(cancelButton); cancelButton.setActionCommand("Cancel"); cancelButton.addActionListener(this); // column widths table.getColumnModel().getColumn(0).setMaxWidth(50); table.getColumnModel().getColumn(1).setMaxWidth(50); SearchTask task = new SearchTask(); task.execute(); MouseListener mouseListener = new MouseListener() { @Override public void mouseReleased(MouseEvent e) { } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() >= 2 && !e.isConsumed() && e.getButton() == MouseEvent.BUTTON1) { actionPerformed(new ActionEvent(okButton, ActionEvent.ACTION_PERFORMED, "OK")); } } }; table.addMouseListener(mouseListener); }
From source file:org.tinymediamanager.ui.tvshows.dialogs.TvShowEpisodeEditorDialog.java
/** * Instantiates a new tv show episode scrape dialog. * //w ww.j a v a2 s . c o m * @param episode * the episode * @param inQueue * the in queue */ public TvShowEpisodeEditorDialog(TvShowEpisode episode, boolean inQueue) { super(BUNDLE.getString("tvshowepisode.scrape"), "tvShowEpisodeScraper"); //$NON-NLS-1$ setBounds(5, 5, 964, 632); for (MediaFile mf : episode.getMediaFiles()) { mediaFiles.add(new MediaFile(mf)); } this.episodeToEdit = episode; getContentPane().setLayout(new BorderLayout()); { JPanel panelFilename = new JPanel(); getContentPane().add(panelFilename, BorderLayout.NORTH); panelFilename.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 lblFilenameT = new JLabel(BUNDLE.getString("metatag.path")); //$NON-NLS-1$ panelFilename.add(lblFilenameT, "2, 2, left, top"); lblFilename = new JLabel(""); TmmFontHelper.changeFont(lblFilename, 1.166, Font.BOLD); panelFilename.add(lblFilename, "5, 2, left, top"); } JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.NORTH); getContentPane().add(tabbedPane, BorderLayout.CENTER); /** * DetailsPanel */ { JPanel detailsPanel = new JPanel(); tabbedPane.addTab(BUNDLE.getString("metatag.details"), detailsPanel); //$NON-NLS-1$ detailsPanel.setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("40dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("7dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("20dlu"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("30dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("7dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("100dlu:grow"), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.LINE_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, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("35dlu:grow"), 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("default:grow"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, })); JLabel lblTitle = new JLabel(BUNDLE.getString("metatag.title")); //$NON-NLS-1$ detailsPanel.add(lblTitle, "2, 4, right, default"); tfTitle = new JTextField(); detailsPanel.add(tfTitle, "4, 4, 19, 1"); tfTitle.setColumns(10); JLabel lblSeason = new JLabel(BUNDLE.getString("metatag.season")); //$NON-NLS-1$ detailsPanel.add(lblSeason, "2, 6, right, default"); spSeason = new JSpinner(); detailsPanel.add(spSeason, "4, 6"); JLabel lblEpisode = new JLabel(BUNDLE.getString("metatag.episode")); //$NON-NLS-1$ detailsPanel.add(lblEpisode, "8, 6, right, default"); spEpisode = new JSpinner(); detailsPanel.add(spEpisode, "10, 6"); JLabel lblDvdSeason = new JLabel(BUNDLE.getString("metatag.dvdseason")); //$NON-NLS-1$ detailsPanel.add(lblDvdSeason, "2, 8, right, default"); spDvdSeason = new JSpinner(); detailsPanel.add(spDvdSeason, "4, 8"); JLabel lblDvdEpisode = new JLabel(BUNDLE.getString("metatag.dvdepisode")); //$NON-NLS-1$ detailsPanel.add(lblDvdEpisode, "8, 8, right, default"); spDvdEpisode = new JSpinner(); detailsPanel.add(spDvdEpisode, "10, 8"); JLabel lblDvdOrder = new JLabel(BUNDLE.getString("metatag.dvdorder")); //$NON-NLS-1$ detailsPanel.add(lblDvdOrder, "14, 8, right, default"); cbDvdOrder = new JCheckBox(""); detailsPanel.add(cbDvdOrder, "16, 8"); cbDvdOrder.setSelected(episodeToEdit.isDvdOrder()); JLabel lblDisplaySeason = new JLabel(BUNDLE.getString("metatag.displayseason")); //$NON-NLS-1$ detailsPanel.add(lblDisplaySeason, "2, 10, right, default"); spDisplaySeason = new JSpinner(); detailsPanel.add(spDisplaySeason, "4, 10"); JLabel lblDisplayEpisode = new JLabel(BUNDLE.getString("metatag.displayepisode")); //$NON-NLS-1$ detailsPanel.add(lblDisplayEpisode, "8, 10, right, default"); spDisplayEpisode = new JSpinner(); detailsPanel.add(spDisplayEpisode, "10, 10"); JLabel lblRating = new JLabel(BUNDLE.getString("metatag.rating")); //$NON-NLS-1$ detailsPanel.add(lblRating, "2, 12, right, default"); spRating = new JSpinner(); detailsPanel.add(spRating, "4, 12"); JLabel lblFirstAired = new JLabel(BUNDLE.getString("metatag.aired")); //$NON-NLS-1$ detailsPanel.add(lblFirstAired, "8, 12, right, default"); dpFirstAired = new DatePicker(episode.getFirstAired()); detailsPanel.add(dpFirstAired, "10, 12, 3, 1, fill, default"); JLabel lblWatched = new JLabel(BUNDLE.getString("metatag.watched")); //$NON-NLS-1$ detailsPanel.add(lblWatched, "2, 14, right, default"); chckbxWatched = new JCheckBox(""); detailsPanel.add(chckbxWatched, "4, 14"); JLabel lblDateAdded = new JLabel(BUNDLE.getString("metatag.dateadded")); //$NON-NLS-1$ detailsPanel.add(lblDateAdded, "8, 14, right, default"); spDateAdded = new JSpinner(new SpinnerDateModel()); detailsPanel.add(spDateAdded, "10, 14, 3, 1, fill, default"); JLabel lblMediasource = new JLabel(BUNDLE.getString("metatag.source")); //$NON-NLS-1$ detailsPanel.add(lblMediasource, "2, 16, right, default"); cbMediaSource = new JComboBox(MediaSource.values()); detailsPanel.add(cbMediaSource, "4, 16, 4, 1, fill, default"); JLabel lblPlot = new JLabel(BUNDLE.getString("metatag.plot")); //$NON-NLS-1$ detailsPanel.add(lblPlot, "2, 18, right, top"); JScrollPane scrollPane = new JScrollPane(); detailsPanel.add(scrollPane, "4, 18, 13, 1, fill, fill"); taPlot = new JTextArea(); taPlot.setLineWrap(true); taPlot.setWrapStyleWord(true); scrollPane.setViewportView(taPlot); lblThumb = new ImageLabel(); lblThumb.setAlternativeText(BUNDLE.getString("image.notfound.thumb")); //$NON-NLS-1$ lblThumb.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { Path file = TmmUIHelper.selectFile(BUNDLE.getString("image.choose")); //$NON-NLS-1$ if (file != null && Utils.isRegularFile(file)) { String fileName = file.toAbsolutePath().toString(); lblThumb.setImageUrl("file:/" + fileName); } } }); lblThumb.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); detailsPanel.add(lblThumb, "20, 6, 3, 13"); JLabel lblDirector = new JLabel(BUNDLE.getString("metatag.director")); //$NON-NLS-1$ detailsPanel.add(lblDirector, "2, 20, right, default"); tfDirector = new JTextField(); tfDirector.setText((String) null); tfDirector.setColumns(10); detailsPanel.add(tfDirector, "4, 20, 13, 1, fill, default"); JLabel lblWriter = new JLabel(BUNDLE.getString("metatag.writer")); //$NON-NLS-1$ detailsPanel.add(lblWriter, "2, 22, right, default"); tfWriter = new JTextField(); tfWriter.setText((String) null); tfWriter.setColumns(10); detailsPanel.add(tfWriter, "4, 22, 13, 1, fill, default"); JLabel lblGuests = new JLabel(BUNDLE.getString("metatag.guests")); //$NON-NLS-1$ detailsPanel.add(lblGuests, "2, 24, right, top"); JScrollPane scrollPaneGuests = new JScrollPane(); detailsPanel.add(scrollPaneGuests, "4, 24, 13, 7, fill, fill"); tableGuests = new JTable(); tableGuests.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE); scrollPaneGuests.setViewportView(tableGuests); JLabel lblTags = new JLabel(BUNDLE.getString("metatag.tags")); //$NON-NLS-1$ detailsPanel.add(lblTags, "20, 24, default, top"); JScrollPane scrollPaneTags = new JScrollPane(); detailsPanel.add(scrollPaneTags, "22, 24, 1, 5, fill, fill"); listTags = new JList(); scrollPaneTags.setViewportView(listTags); JButton btnAddActor = new JButton(""); btnAddActor.setMargin(new Insets(2, 2, 2, 2)); btnAddActor.setAction(new AddActorAction()); btnAddActor.setIcon(IconManager.LIST_ADD); detailsPanel.add(btnAddActor, "2, 26, right, top"); JButton btnAddTag = new JButton(""); btnAddTag.setMargin(new Insets(2, 2, 2, 2)); btnAddTag.setAction(new AddTagAction()); btnAddTag.setIcon(IconManager.LIST_ADD); detailsPanel.add(btnAddTag, "20, 26, right, top"); JButton btnRemoveActor = new JButton(""); btnRemoveActor.setMargin(new Insets(2, 2, 2, 2)); btnRemoveActor.setAction(new RemoveActorAction()); btnRemoveActor.setIcon(IconManager.LIST_REMOVE); detailsPanel.add(btnRemoveActor, "2, 28, right, top"); JButton btnRemoveTag = new JButton(""); btnRemoveTag.setMargin(new Insets(2, 2, 2, 2)); btnRemoveTag.setAction(new RemoveTagAction()); btnRemoveTag.setIcon(IconManager.LIST_REMOVE); detailsPanel.add(btnRemoveTag, "20, 28, right, top"); cbTags = new AutocompleteComboBox(tvShowList.getTagsInEpisodes().toArray()); cbTags.setEditable(true); detailsPanel.add(cbTags, "22, 30, fill, default"); } /** * Media Files panel */ { mediaFilesPanel = new MediaFileEditorPanel(mediaFiles); tabbedPane.addTab(BUNDLE.getString("metatag.mediafiles"), null, mediaFilesPanel, null); //$NON-NLS-1$ } { JPanel bottomPanel = new JPanel(); getContentPane().add(bottomPanel, BorderLayout.SOUTH); bottomPanel.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, RowSpec.decode("25px"), FormFactory.RELATED_GAP_ROWSPEC, })); cbScraper = new MediaScraperComboBox(tvShowList.getAvailableMediaScrapers()); MediaScraper defaultScraper = tvShowList.getDefaultMediaScraper(); cbScraper.setSelectedItem(defaultScraper); bottomPanel.add(cbScraper, "2, 2, fill, default"); JButton btnScrape = new JButton(BUNDLE.getString("Button.scrape")); //$NON-NLS-1$ btnScrape.setPreferredSize(new Dimension(100, 23)); btnScrape.setMaximumSize(new Dimension(0, 0)); btnScrape.setMinimumSize(new Dimension(100, 23)); btnScrape.setActionCommand("Scrape"); btnScrape.addActionListener(this); bottomPanel.add(btnScrape, "4, 2, left, fill"); JButton btnSearch = new JButton(BUNDLE.getString("tvshowepisodechooser.search")); //$NON-NLS-1$ btnSearch.setActionCommand("Search"); btnSearch.addActionListener(this); btnSearch.setIcon(IconManager.SEARCH); bottomPanel.add(btnSearch, "6, 2, left, fill"); { JPanel buttonPane = new JPanel(); bottomPanel.add(buttonPane, "8, 2, fill, fill"); EqualsLayout layout = new EqualsLayout(5); layout.setMinWidth(100); buttonPane.setLayout(layout); JButton okButton = new JButton(BUNDLE.getString("Button.ok")); //$NON-NLS-1$ okButton.setToolTipText(BUNDLE.getString("tvshow.change")); okButton.setIcon(IconManager.APPLY); buttonPane.add(okButton); okButton.setActionCommand("OK"); okButton.addActionListener(this); JButton cancelButton = new JButton(BUNDLE.getString("Button.cancel")); //$NON-NLS-1$ cancelButton.setToolTipText(BUNDLE.getString("edit.discard")); cancelButton.setIcon(IconManager.CANCEL); buttonPane.add(cancelButton); cancelButton.setActionCommand("Cancel"); cancelButton.addActionListener(this); if (inQueue) { JButton abortButton = new JButton(BUNDLE.getString("Button.abortqueue")); //$NON-NLS-1$ abortButton.setToolTipText(BUNDLE.getString("tvshow.edit.abortqueue.desc")); //$NON-NLS-1$ abortButton.setIcon(IconManager.PROCESS_STOP); buttonPane.add(abortButton); abortButton.setActionCommand("Abort"); abortButton.addActionListener(this); } } } initDataBindings(); // fill data { MediaFile mediaFile = episodeToEdit.getMediaFiles().get(0); lblFilename.setText(mediaFile.getFileAsPath().toString()); tfTitle.setText(episodeToEdit.getTitle()); spSeason.setModel(new SpinnerNumberModel(episodeToEdit.getAiredSeason(), -1, Integer.MAX_VALUE, 1)); spEpisode.setModel(new SpinnerNumberModel(episodeToEdit.getAiredEpisode(), -1, Integer.MAX_VALUE, 1)); spDvdSeason.setModel(new SpinnerNumberModel(episodeToEdit.getDvdSeason(), -1, Integer.MAX_VALUE, 1)); spDvdEpisode.setModel(new SpinnerNumberModel(episodeToEdit.getDvdEpisode(), -1, Integer.MAX_VALUE, 1)); spDisplaySeason .setModel(new SpinnerNumberModel(episodeToEdit.getDisplaySeason(), -1, Integer.MAX_VALUE, 1)); spDisplayEpisode .setModel(new SpinnerNumberModel(episodeToEdit.getDisplayEpisode(), -1, Integer.MAX_VALUE, 1)); spDateAdded.setValue(episodeToEdit.getDateAdded()); lblThumb.setImagePath(episodeToEdit.getArtworkFilename(MediaFileType.THUMB)); spRating.setModel(new SpinnerNumberModel(episodeToEdit.getRating(), 0.0, 10.0, 0.1)); spRating.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { voteCount = 1; } }); voteCount = episodeToEdit.getVotes(); chckbxWatched.setSelected(episodeToEdit.isWatched()); taPlot.setText(episodeToEdit.getPlot()); taPlot.setCaretPosition(0); tfDirector.setText(episodeToEdit.getDirector()); tfWriter.setText(episodeToEdit.getWriter()); cbMediaSource.setSelectedItem(episodeToEdit.getMediaSource()); for (TvShowActor origCast : episodeToEdit.getGuests()) { TvShowActor actor = new TvShowActor(); actor.setName(origCast.getName()); actor.setCharacter(origCast.getCharacter()); actor.setThumbUrl(origCast.getThumbUrl()); cast.add(actor); } for (String tag : episodeToEdit.getTags()) { tags.add(tag); } } // adjust table columns tableGuests.getColumnModel().getColumn(0).setHeaderValue(BUNDLE.getString("metatag.name")); //$NON-NLS-1$ tableGuests.getColumnModel().getColumn(1).setHeaderValue(BUNDLE.getString("metatag.role")); //$NON-NLS-1$ }