List of usage examples for com.jgoodies.forms.layout FormSpecs LABEL_COMPONENT_GAP_ROWSPEC
RowSpec LABEL_COMPONENT_GAP_ROWSPEC
To view the source code for com.jgoodies.forms.layout FormSpecs LABEL_COMPONENT_GAP_ROWSPEC.
Click Source Link
From source file:at.becast.youploader.gui.EditPanel.java
License:Open Source License
private void initComponents() { JLabel lblTemplate = new JLabel(); cmbTemplate = new JComboBox<Item>(); loadTemplates();/*from www. j av a2 s. c o m*/ cmbTemplate.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { templateCmbChanged(e); } }); setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("110px"), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("center:max(51dlu;default):grow"), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("center:max(28dlu;pref):grow"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("center:max(10dlu;pref):grow"), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("right:30px"), ColumnSpec.decode("2dlu"), ColumnSpec.decode("right:30px"), ColumnSpec.decode("2dlu"), ColumnSpec.decode("right:30px"), }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("25px"), FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, RowSpec.decode("25px"), FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, RowSpec.decode("25px"), FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, RowSpec.decode("25px"), FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, RowSpec.decode("25px"), FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, RowSpec.decode("25px"), FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, RowSpec.decode("25px"), FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, RowSpec.decode("25px"), FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, RowSpec.decode("25px"), FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, RowSpec.decode("20px"), RowSpec.decode("1dlu"), RowSpec.decode("20px"), FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, RowSpec.decode("20px"), FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, RowSpec.decode("20px"), FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, RowSpec.decode("20px"), FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, RowSpec.decode("20px"), })); lblTemplate.setText(LANG.getString("EditPanel.Template") + ":"); add(lblTemplate, "2, 2, right, center"); add(cmbTemplate, "4, 2, 5, 1, fill, fill"); JButton btnDeleteTemplate = new JButton(""); btnDeleteTemplate.setToolTipText(LANG.getString("EditPanel.DeleteTemplate")); btnDeleteTemplate.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { deleteTemplate(); } }); JButton btnNewTemplate = new JButton(""); btnNewTemplate.setToolTipText(LANG.getString("EditPanel.SaveNewTemplate")); btnNewTemplate.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { addTemplate(); } }); JButton btnSaveTemplate = new JButton(""); btnSaveTemplate.setToolTipText(LANG.getString("EditPanel.SaveTemplate")); btnSaveTemplate.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { saveTemplate(); } }); btnSaveTemplate.setIcon(new ImageIcon(getClass().getResource("/disk.png"))); add(btnSaveTemplate, "10, 2, fill, fill"); btnNewTemplate.setIcon(new ImageIcon(getClass().getResource("/add.png"))); add(btnNewTemplate, "12, 2, fill, fill"); btnDeleteTemplate.setIcon(new ImageIcon(getClass().getResource("/cross.png"))); add(btnDeleteTemplate, "14, 2, fill, fill"); JLabel lblStartDirectory = new JLabel(LANG.getString("EditPanel.StartDir") + ":"); add(lblStartDirectory, "2, 4, right, center"); txtStartDir = new JTextField(); add(txtStartDir, "4, 4, 5, 1, fill, fill"); txtStartDir.setColumns(10); JButton btnStartDir = new JButton(""); btnStartDir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { NativeJFileChooser chooser = new NativeJFileChooser(); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int returnVal = chooser.showOpenDialog(getParent()); if (returnVal == JFileChooser.APPROVE_OPTION) { txtStartDir.setText(chooser.getSelectedFile().getAbsolutePath().toString()); } } }); btnStartDir.setIcon(new ImageIcon(getClass().getResource("/folder.png"))); add(btnStartDir, "10, 4, fill, fill"); JLabel lblEndDirectory = new JLabel(LANG.getString("EditPanel.EndDir") + ":"); add(lblEndDirectory, "2, 6, right, center"); txtEndDir = new JTextField(); add(txtEndDir, "4, 6, 5, 1, fill, fill"); txtEndDir.setColumns(10); JButton btnEndDir = new JButton(""); btnEndDir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { NativeJFileChooser chooser = new NativeJFileChooser(); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int returnVal = chooser.showOpenDialog(getParent()); if (returnVal == JFileChooser.APPROVE_OPTION) { txtEndDir.setText(chooser.getSelectedFile().getAbsolutePath().toString()); } } }); btnEndDir.setIcon(new ImageIcon(getClass().getResource("/folder.png"))); add(btnEndDir, "10, 6, fill, fill"); JLabel lblVisibility = new JLabel(LANG.getString("EditPanel.Visibility") + ":"); add(lblVisibility, "2, 8, right, default"); dateTimePicker = new DateTimePicker(new Date()); dateTimePicker.setEnabled(false); dateTimePicker.getEditor().setEnabled(false); Calendar calendar = dateTimePicker.getMonthView().getCalendar(); // starting today if we are in a hurry calendar.setTime(new Date()); dateTimePicker.getMonthView().setLowerBound(calendar.getTime()); cmbVisibility = new JComboBox<VisibilityType>(); cmbVisibility.setModel(new DefaultComboBoxModel<VisibilityType>(VisibilityType.values())); add(cmbVisibility, "4, 8, 5, 1, fill, fill"); JLabel lblReleaseAt = new JLabel(LANG.getString("EditPanel.Relase") + ":"); add(lblReleaseAt, "2, 10, right, default"); add(dateTimePicker, "4, 10, 5, 1, fill, fill"); JLabel lblLicense = new JLabel(LANG.getString("EditPanel.License") + ":"); add(lblLicense, "2, 12, right, default"); cmbLicense = new JComboBox<LicenseType>(); cmbLicense.setModel(new DefaultComboBoxModel<LicenseType>(LicenseType.values())); add(cmbLicense, "4, 12, 5, 1, fill, fill"); cmbLicense.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (cmbLicense.getSelectedItem() == LicenseType.CC) { parent.monetisation(true); } else { parent.monetisation(chckbxAgeRestriction.isSelected()); } } }); JLabel lblThumbnail = new JLabel(LANG.getString("EditPanel.Thumbnail") + ":"); add(lblThumbnail, "2, 14, right, default"); txtThumbnail = new JTextField(); txtThumbnail.setDragEnabled(true); txtThumbnail.setDropTarget(new DropTarget() { private static final long serialVersionUID = 8809983794742040683L; public synchronized void drop(DropTargetDropEvent evt) { try { evt.acceptDrop(DnDConstants.ACTION_COPY); @SuppressWarnings("unchecked") List<File> droppedFiles = (List<File>) evt.getTransferable() .getTransferData(DataFlavor.javaFileListFlavor); for (File file : droppedFiles) { if (file.getName().endsWith(".jpg") || file.getName().endsWith(".png") || file.getName().endsWith(".jpeg")) { txtThumbnail.setText(file.getAbsolutePath()); } } } catch (Exception ex) { LOG.error("Error dropping thumbnail", ex); } } }); add(txtThumbnail, "4, 14, 5, 1, fill, fill"); txtThumbnail.setColumns(10); JButton btnThumbnail = new JButton(""); btnThumbnail.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { NativeJFileChooser chooser = new NativeJFileChooser(); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); chooser.setFileFilter(new FileNameExtensionFilter("Image Files", "jpg", "jpeg", "png")); int returnVal = chooser.showOpenDialog(getParent()); if (returnVal == JFileChooser.APPROVE_OPTION) { txtThumbnail.setText(chooser.getSelectedFile().getAbsolutePath().toString()); } } }); btnThumbnail.setIcon(new ImageIcon(getClass().getResource("/folder.png"))); add(btnThumbnail, "10, 14, fill, fill"); JLabel lblStartUploadAt = new JLabel(LANG.getString("EditPanel.StartUpload") + ":"); add(lblStartUploadAt, "2, 16, right, default"); dateTimePickerStart = new DateTimePicker(new Date()); dateTimePickerStart.getMonthView().setLowerBound(calendar.getTime()); add(dateTimePickerStart, "4, 16, 5, 1, fill, fill"); JLabel lblGameTitle = new JLabel(LANG.getString("EditPanel.Gametitle") + ":"); add(lblGameTitle, "2, 18, right, default"); cmbGameTitle = new AutocompleteComboBox(); add(cmbGameTitle, "4, 18, 5, 1, fill, fill"); JLabel lblAdditionalSettings = new JLabel(LANG.getString("EditPanel.OtherSettings") + ":"); add(lblAdditionalSettings, "2, 20, right, default"); chckbxAllowEmbedding = new JCheckBox(LANG.getString("EditPanel.embedding")); chckbxAllowEmbedding.setToolTipText(LANG.getString("EditPanel.embedding")); add(chckbxAllowEmbedding, "4, 20, 3, 1"); chckbxAgeRestriction = new JCheckBox(LANG.getString("EditPanel.AgeRestriction")); chckbxAgeRestriction.setToolTipText(LANG.getString("EditPanel.AgeRestriction")); chckbxAgeRestriction.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { if (chckbxAgeRestriction.isSelected()) { parent.monetisation(chckbxAgeRestriction.isSelected()); } else { parent.monetisation(cmbLicense.getSelectedItem() == LicenseType.CC); } } }); add(chckbxAgeRestriction, "8, 20, 3, 1, left, default"); chckbxMakeStatisticsPublic = new JCheckBox(LANG.getString("EditPanel.Statistics")); chckbxMakeStatisticsPublic.setToolTipText(LANG.getString("EditPanel.Statistics")); chckbxMakeStatisticsPublic.setVerticalAlignment(SwingConstants.TOP); add(chckbxMakeStatisticsPublic, "4, 22, 3, 1, fill, default"); chckbxAllowComments = new JCheckBox(LANG.getString("EditPanel.AllowComments")); chckbxAllowComments.setToolTipText(LANG.getString("EditPanel.AllowComments")); chckbxAllowComments.setSelected(true); add(chckbxAllowComments, "8, 22, 3, 1, left, default"); JLabel lblMessage = new JLabel(LANG.getString("EditPanel.Message") + ":"); add(lblMessage, "2, 24, right, default"); JScrollPane scrollPane = new JScrollPane(); add(scrollPane, "4, 24, 5, 7, fill, fill"); txtMessage = new JTextPane(); txtMessage.setFont(new Font("SansSerif", Font.PLAIN, 13)); txtMessage.setEnabled(false); scrollPane.setViewportView(txtMessage); txtMessage.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { calcNotifies(); } }); lblSociallenght = new JLabel("(0/110)"); add(lblSociallenght, "10, 24, 3, 1"); chckbxGoogle = new JCheckBox("Google+"); chckbxGoogle.setSelected(true); chckbxGoogle.setEnabled(false); add(chckbxGoogle, "2, 26, fill, default"); chckbxTwitter = new JCheckBox("Twitter"); chckbxTwitter.setSelected(true); chckbxTwitter.setEnabled(false); add(chckbxTwitter, "2, 28, fill, default"); chckbxFacebook = new JCheckBox("Facebook"); chckbxFacebook.setSelected(true); chckbxFacebook.setEnabled(false); add(chckbxFacebook, "2, 30, fill, default"); cmbVisibility.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent arg0) { if (cmbVisibility.getSelectedItem() == VisibilityType.SCHEDULED) { setDateEnabled(true); setMessageEnabled(true); } else if (cmbVisibility.getSelectedItem() == VisibilityType.PUBLIC) { setDateEnabled(false); setMessageEnabled(true); } else { setDateEnabled(false); setMessageEnabled(false); } } }); }
From source file:org.tinymediamanager.ui.movies.dialogs.MovieDownloadSubtitleDialog.java
License:Apache License
public MovieDownloadSubtitleDialog(String title) { super(title, "downloadSubtitle"); setMinimumSize(new Dimension(getWidth(), getHeight())); JPanel panelCenter = new JPanel(); getContentPane().add(panelCenter, BorderLayout.CENTER); panelCenter.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("200dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("75dlu"), FormSpecs.RELATED_GAP_ROWSPEC, })); JPanel panelScraper = new JPanel(); panelCenter.add(panelScraper, "2, 2, default, fill"); panelScraper.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.PARAGRAPH_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormSpecs.RELATED_GAP_ROWSPEC, })); JLabel lblScraper = new JLabel(BUNDLE.getString("scraper")); //$NON-NLS-1$ panelScraper.add(lblScraper, "2, 2, right, default"); cbSubtitleScraper = new MediaScraperCheckComboBox(); cbSubtitleScraper.setTextFor(CheckComboBox.NONE, BUNDLE.getString("scraper.selected.none")); //$NON-NLS-1$ cbSubtitleScraper.setTextFor(CheckComboBox.MULTIPLE, BUNDLE.getString("scraper.selected.multiple")); //$NON-NLS-1$ cbSubtitleScraper.setTextFor(CheckComboBox.ALL, BUNDLE.getString("scraper.selected.all")); //$NON-NLS-1$ panelScraper.add(cbSubtitleScraper, "4, 2"); JLabel lblLanguage = new JLabel(BUNDLE.getString("metatag.language")); //$NON-NLS-1$ panelScraper.add(lblLanguage, "2, 4, right, default"); cbLanguage = new JComboBox(MediaLanguages.values()); panelScraper.add(cbLanguage, "4, 4"); JTextArea taHint = new JTextArea(); taHint.setLineWrap(true);/*from w w w .j av a2 s . c o m*/ taHint.setWrapStyleWord(true); taHint.setText(BUNDLE.getString("movie.download.subtitles.hint")); //$NON-NLS-1$ taHint.setOpaque(false); panelScraper.add(taHint, "2, 6, 3, 1, fill, fill"); JPanel panelButtons = new JPanel(); panelButtons.setLayout(new EqualsLayout(5)); panelButtons.setBorder(new EmptyBorder(4, 4, 4, 4)); getContentPane().add(panelButtons, BorderLayout.SOUTH); JButton btnStart = new JButton(BUNDLE.getString("scraper.start")); //$NON-NLS-1$ btnStart.setIcon(IconManager.APPLY); btnStart.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { startDownload = true; setVisible(false); } }); panelButtons.add(btnStart); JButton btnCancel = new JButton(BUNDLE.getString("Button.cancel")); //$NON-NLS-1$ btnCancel.setIcon(IconManager.CANCEL); btnCancel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { startDownload = false; setVisible(false); } }); panelButtons.add(btnCancel); // set data // scraper ListCheckModel model = cbSubtitleScraper.getModel(); for (MediaScraper subtitleScraper : MovieList.getInstance().getAvailableSubtitleScrapers()) { model.addElement(subtitleScraper); if (MovieModuleManager.MOVIE_SETTINGS.getMovieSubtitleScrapers().contains(subtitleScraper.getId())) { model.addCheck(subtitleScraper); } } cbLanguage.setSelectedItem(MovieModuleManager.MOVIE_SETTINGS.getSubtitleScraperLanguage()); }
From source file:org.tinymediamanager.ui.movies.dialogs.MovieSubtitleChooserDialog.java
License:Apache License
private void initComponents() { getContentPane().setLayout(new BorderLayout()); final JPanel panelContent = new JPanel(); getContentPane().add(panelContent, BorderLayout.CENTER); panelContent.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("100dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("200dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.UNRELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("120dlu:grow"), FormSpecs.RELATED_GAP_ROWSPEC, })); final JLabel lblMovieTitle = new JLabel(movieToScrape.getTitle()); TmmFontHelper.changeFont(lblMovieTitle, 1.33, Font.BOLD); panelContent.add(lblMovieTitle, "2, 2, 9, 1"); final JLabel lblMediaFileNameT = new JLabel(BUNDLE.getString("metatag.filename")); //$NON-NLS-1$ panelContent.add(lblMediaFileNameT, "2, 4, right, default"); final JLabel lblMediaFileName = new JLabel(fileToScrape.getFilename()); panelContent.add(lblMediaFileName, "4, 4, 7, 1"); final JLabel lblRuntimeT = new JLabel(BUNDLE.getString("metatag.runtime")); //$NON-NLS-1$ panelContent.add(lblRuntimeT, "2, 6, right, default"); final JLabel lblRuntime = new JLabel(fileToScrape.getDurationHHMMSS()); panelContent.add(lblRuntime, "4, 6"); final JLabel lblImdbIdT = new JLabel(BUNDLE.getString("metatag.imdb")); //$NON-NLS-1$ panelContent.add(lblImdbIdT, "6, 6, right, default"); final JLabel lblImdbId = new JLabel(movieToScrape.getImdbId()); panelContent.add(lblImdbId, "8, 6"); final JLabel lblScraperT = new JLabel(BUNDLE.getString("scraper")); //$NON-NLS-1$ panelContent.add(lblScraperT, "2, 8, right, default"); cbScraper = new MediaScraperCheckComboBox(); panelContent.add(cbScraper, "4, 8, fill, default"); tfSearchQuery = new JTextField(movieToScrape.getTitle()); panelContent.add(tfSearchQuery, "6, 8, 3, 1, fill, default"); tfSearchQuery.setColumns(10);//from w w w .j a va 2 s .c o m final JButton btnSearch = new JButton(BUNDLE.getString("Button.search")); //$NON-NLS-1$ btnSearch.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { searchSubtitle(null, "", tfSearchQuery.getText()); } }); panelContent.add(btnSearch, "10, 8"); final JLabel lblLanguageT = new JLabel(BUNDLE.getString("metatag.language")); //$NON-NLS-1$ panelContent.add(lblLanguageT, "2, 10, right, default"); cbLanguage = new JComboBox<>(); cbLanguage.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { searchSubtitle(null, "", tfSearchQuery.getText()); } }); panelContent.add(cbLanguage, "4, 10, fill, default"); final JScrollPane scrollPaneSubs = new JScrollPane(); panelContent.add(scrollPaneSubs, "2, 12, 9, 1, fill, fill"); tableSubs = new JTable(subtitleTableModel); tableSubs.setDefaultRenderer(ImageIcon.class, new Renderer()); scrollPaneSubs.setViewportView(tableSubs); { JPanel panelBottom = new JPanel(); getContentPane().add(panelBottom, BorderLayout.SOUTH); panelBottom.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("max(82dlu;default)"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormFactory.DEFAULT_COLSPEC, }, new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC })); progressBar = new JProgressBar(); panelBottom.add(progressBar, "2, 2"); lblProgressAction = new JLabel(""); panelBottom.add(lblProgressAction, "4, 2"); { final JPanel panelButtons = new JPanel(); EqualsLayout layout = new EqualsLayout(5); layout.setMinWidth(100); panelButtons.setLayout(layout); panelBottom.add(panelButtons, "5, 2, fill, fill"); JButton btnDone = new JButton(BUNDLE.getString("Button.close")); //$NON-NLS-1$ btnDone.setIcon(IconManager.APPLY); btnDone.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setVisible(false); } }); panelButtons.add(btnDone); if (inQueue) { JButton btnAbortQueue = new JButton(BUNDLE.getString("Button.abortqueue")); //$NON-NLS-1$ btnAbortQueue.setIcon(IconManager.PROCESS_STOP); btnAbortQueue.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { continueQueue = false; setVisible(false); } }); panelButtons.add(btnAbortQueue); } } } }
From source file:org.tinymediamanager.ui.movies.settings.MovieTrailerSettingsPanel.java
License:Apache License
public MovieTrailerSettingsPanel() { // data init//from ww w. j a va 2s . co m List<String> enabledTrailerProviders = settings.getMovieTrailerScrapers(); int selectedIndex = -1; int counter = 0; for (MediaScraper scraper : MovieList.getInstance().getAvailableTrailerScrapers()) { TrailerScraper trailerScraper = new TrailerScraper(scraper); if (enabledTrailerProviders.contains(trailerScraper.getScraperId())) { trailerScraper.active = true; if (selectedIndex < 0) { selectedIndex = counter; } } scrapers.add(trailerScraper); counter++; } // UI init setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormSpecs.RELATED_GAP_ROWSPEC, })); JPanel panelTrailerScrapers = new JPanel(); panelTrailerScrapers.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), BUNDLE.getString("scraper.trailer"), TitledBorder.LEADING, TitledBorder.TOP, null, null)); // $NON-NLS-1$ add(panelTrailerScrapers, "2, 2, fill, fill"); panelTrailerScrapers.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.UNRELATED_GAP_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("200dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("100dlu:grow"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.UNRELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, })); final JScrollPane scrollPaneScraperDetails = new JScrollPane(); scrollPaneScraperDetails.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPaneScraperDetails.setBorder(null); panelTrailerScrapers.add(scrollPaneScraperDetails, "8, 1, 1, 2, fill, fill"); JPanel panelScraperDetails = new JPanel(); scrollPaneScraperDetails.setViewportView(panelScraperDetails); panelScraperDetails.setLayout(new FormLayout(new ColumnSpec[] { ColumnSpec.decode("default:grow"), }, new RowSpec[] { RowSpec.decode("default:grow"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, })); { // add a CSS rule to force body tags to use the default label font // instead of the value in javax.swing.text.html.default.csss Font font = UIManager.getFont("Label.font"); String bodyRule = "body { font-family: " + font.getFamily() + "; " + "font-size: " + font.getSize() + "pt; }"; tpScraperDescription = new JTextPane(); tpScraperDescription.setOpaque(false); tpScraperDescription.setEditorKit(new HTMLEditorKit()); ((HTMLDocument) tpScraperDescription.getDocument()).getStyleSheet().addRule(bodyRule); panelScraperDetails.add(tpScraperDescription, "1, 1, fill, top"); } panelScraperOptions = new ScrollablePanel(); panelScraperOptions.setLayout(new FlowLayout(FlowLayout.LEFT)); panelScraperDetails.add(panelScraperOptions, "1, 3, fill, top"); JScrollPane scrollPaneScraper = new JScrollPane(); panelTrailerScrapers.add(scrollPaneScraper, "2, 2, 5, 1, fill, fill"); tableTrailerScraper = new JTable(); tableTrailerScraper.setRowHeight(29); scrollPaneScraper.setViewportView(tableTrailerScraper); JSeparator separator = new JSeparator(); panelTrailerScrapers.add(separator, "2, 4, 7, 1"); checkBox = new JCheckBox(BUNDLE.getString("Settings.trailer.preferred")); //$NON-NLS-1$ panelTrailerScrapers.add(checkBox, "2, 6, 7, 1"); JLabel lblTrailerSource = new JLabel(BUNDLE.getString("Settings.trailer.source")); //$NON-NLS-1$ panelTrailerScrapers.add(lblTrailerSource, "4, 8, right, default"); cbTrailerSource = new JComboBox<>(); cbTrailerSource.setModel(new DefaultComboBoxModel<>(MovieTrailerSources.values())); panelTrailerScrapers.add(cbTrailerSource, "6, 8, fill, default"); JLabel lblTrailerQuality = new JLabel(BUNDLE.getString("Settings.trailer.quality")); //$NON-NLS-1$ panelTrailerScrapers.add(lblTrailerQuality, "4, 10, right, default"); cbTrailerQuality = new JComboBox<>(); cbTrailerQuality.setModel(new DefaultComboBoxModel<>(MovieTrailerQuality.values())); panelTrailerScrapers.add(cbTrailerQuality, "6, 10, fill, default"); chckbxAutomaticTrailerDownload = new JCheckBox(BUNDLE.getString("Settings.trailer.automaticdownload")); //$NON-NLS-1$ panelTrailerScrapers.add(chckbxAutomaticTrailerDownload, "2, 12, 7, 1"); JLabel lblAutomaticTrailerDownloadHint = new JLabel( BUNDLE.getString("Settings.trailer.automaticdownload.hint")); //$NON-NLS-1$ TmmFontHelper.changeFont(lblAutomaticTrailerDownloadHint, 0.833); panelTrailerScrapers.add(lblAutomaticTrailerDownloadHint, "4, 14, 5, 1"); initDataBindings(); // adjust table columns // Checkbox and Logo shall have minimal width TableColumnResizer.setMaxWidthForColumn(tableTrailerScraper, 0, 2); TableColumnResizer.setMaxWidthForColumn(tableTrailerScraper, 1, 2); TableColumnResizer.adjustColumnPreferredWidths(tableTrailerScraper, 5); tableTrailerScraper.getModel().addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent arg0) { // click on the checkbox if (arg0.getColumn() == 0) { int row = arg0.getFirstRow(); TrailerScraper changedScraper = scrapers.get(row); if (changedScraper.active) { settings.addMovieTrailerScraper(changedScraper.getScraperId()); } else { settings.removeMovieTrailerScraper(changedScraper.getScraperId()); } } } }); // implement selection listener to load settings tableTrailerScraper.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { int index = tableTrailerScraper.convertRowIndexToModel(tableTrailerScraper.getSelectedRow()); if (index > -1) { panelScraperOptions.removeAll(); if (scrapers.get(index).getMediaProvider().getProviderInfo().getConfig().hasConfig()) { panelScraperOptions .add(new MediaScraperConfigurationPanel(scrapers.get(index).getMediaProvider())); } panelScraperOptions.revalidate(); } } }); // select default movie scraper if (selectedIndex < 0) { selectedIndex = 0; } if (counter > 0) { tableTrailerScraper.getSelectionModel().setSelectionInterval(selectedIndex, selectedIndex); } }
From source file:org.tinymediamanager.ui.tvshows.dialogs.TvShowDownloadSubtitleDialog.java
License:Apache License
public TvShowDownloadSubtitleDialog(String title) { super(title, "downloadSubtitle"); setMinimumSize(new Dimension(getWidth(), getHeight())); JPanel panelCenter = new JPanel(); getContentPane().add(panelCenter, BorderLayout.CENTER); panelCenter.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("200dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("75dlu"), FormSpecs.RELATED_GAP_ROWSPEC, })); JPanel panelScraper = new JPanel(); panelCenter.add(panelScraper, "2, 2, default, fill"); panelScraper.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.PARAGRAPH_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormSpecs.RELATED_GAP_ROWSPEC, })); JLabel lblScraper = new JLabel(BUNDLE.getString("scraper")); //$NON-NLS-1$ panelScraper.add(lblScraper, "2, 2, right, default"); cbSubtitleScraper = new MediaScraperCheckComboBox(); cbSubtitleScraper.setTextFor(CheckComboBox.NONE, BUNDLE.getString("scraper.selected.none")); //$NON-NLS-1$ cbSubtitleScraper.setTextFor(CheckComboBox.MULTIPLE, BUNDLE.getString("scraper.selected.multiple")); //$NON-NLS-1$ cbSubtitleScraper.setTextFor(CheckComboBox.ALL, BUNDLE.getString("scraper.selected.all")); //$NON-NLS-1$ panelScraper.add(cbSubtitleScraper, "4, 2"); JLabel lblLanguage = new JLabel(BUNDLE.getString("metatag.language")); //$NON-NLS-1$ panelScraper.add(lblLanguage, "2, 4, right, default"); cbLanguage = new JComboBox(MediaLanguages.values()); panelScraper.add(cbLanguage, "4, 4"); JTextArea taHint = new JTextArea(); taHint.setLineWrap(true);// w w w. j a v a2 s . c o m taHint.setWrapStyleWord(true); taHint.setText(BUNDLE.getString("tvshow.download.subtitles.hint")); //$NON-NLS-1$ taHint.setOpaque(false); panelScraper.add(taHint, "2, 6, 3, 1, fill, fill"); JPanel panelButtons = new JPanel(); panelButtons.setLayout(new EqualsLayout(5)); panelButtons.setBorder(new EmptyBorder(4, 4, 4, 4)); getContentPane().add(panelButtons, BorderLayout.SOUTH); JButton btnStart = new JButton(BUNDLE.getString("scraper.start")); //$NON-NLS-1$ btnStart.setIcon(IconManager.APPLY); btnStart.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { startDownload = true; setVisible(false); } }); panelButtons.add(btnStart); JButton btnCancel = new JButton(BUNDLE.getString("Button.cancel")); //$NON-NLS-1$ btnCancel.setIcon(IconManager.CANCEL); btnCancel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { startDownload = false; setVisible(false); } }); panelButtons.add(btnCancel); // set data // scraper ListCheckModel model = cbSubtitleScraper.getModel(); for (MediaScraper subtitleScraper : TvShowList.getInstance().getAvailableSubtitleScrapers()) { model.addElement(subtitleScraper); if (TvShowModuleManager.SETTINGS.getTvShowSubtitleScrapers().contains(subtitleScraper.getId())) { model.addCheck(subtitleScraper); } } cbLanguage.setSelectedItem(TvShowModuleManager.SETTINGS.getSubtitleScraperLanguage()); }
From source file:org.tinymediamanager.ui.tvshows.dialogs.TvShowSubtitleChooserDialog.java
License:Apache License
private void initComponents() { getContentPane().setLayout(new BorderLayout()); final JPanel panelContent = new JPanel(); getContentPane().add(panelContent, BorderLayout.CENTER); panelContent.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("100dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("200dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.UNRELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("120dlu:grow"), FormSpecs.RELATED_GAP_ROWSPEC, })); final JLabel lblEpisodeTitle = new JLabel(episodeToScrape.getTitle()); TmmFontHelper.changeFont(lblEpisodeTitle, 1.33, Font.BOLD); panelContent.add(lblEpisodeTitle, "2, 2, 9, 1"); JLabel lblSeasonT = new JLabel(BUNDLE.getString("metatag.season")); //$NON-NLS-1$ panelContent.add(lblSeasonT, "2, 4, right, default"); JLabel lblSeason = new JLabel(String.valueOf(episodeToScrape.getSeason())); panelContent.add(lblSeason, "4, 4"); JLabel lblEpisodeT = new JLabel(BUNDLE.getString("metatag.episode")); //$NON-NLS-1$ panelContent.add(lblEpisodeT, "2, 6, right, default"); JLabel lblEpisode = new JLabel(String.valueOf(episodeToScrape.getEpisode())); panelContent.add(lblEpisode, "4, 6"); final JLabel lblMediaFileNameT = new JLabel(BUNDLE.getString("metatag.filename")); //$NON-NLS-1$ panelContent.add(lblMediaFileNameT, "2, 8, right, default"); final JLabel lblMediaFileName = new JLabel(fileToScrape.getFilename()); panelContent.add(lblMediaFileName, "4, 8, 7, 1"); final JLabel lblScraperT = new JLabel(BUNDLE.getString("scraper")); //$NON-NLS-1$ panelContent.add(lblScraperT, "2, 10, right, default"); cbScraper = new MediaScraperCheckComboBox(); panelContent.add(cbScraper, "4, 10, fill, default"); final JLabel lblLanguageT = new JLabel(BUNDLE.getString("metatag.language")); //$NON-NLS-1$ panelContent.add(lblLanguageT, "2, 12, right, default"); cbLanguage = new JComboBox<>(); panelContent.add(cbLanguage, "4, 12, fill, default"); final JButton btnSearch = new JButton(BUNDLE.getString("Button.search")); //$NON-NLS-1$ btnSearch.addActionListener(new ActionListener() { @Override/* www . j av a 2 s . c o m*/ public void actionPerformed(ActionEvent e) { searchSubtitle(fileToScrape.getFileAsPath().toFile(), episodeToScrape.getTvShow().getImdbId(), episodeToScrape.getSeason(), episodeToScrape.getEpisode()); } }); panelContent.add(btnSearch, "8, 12"); final JScrollPane scrollPaneSubs = new JScrollPane(); panelContent.add(scrollPaneSubs, "2, 14, 9, 1, fill, fill"); tableSubs = new JTable(subtitleTableModel); scrollPaneSubs.setViewportView(tableSubs); { JPanel panelBottom = new JPanel(); getContentPane().add(panelBottom, BorderLayout.SOUTH); panelBottom.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("max(82dlu;default)"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormFactory.DEFAULT_COLSPEC, }, new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC })); progressBar = new JProgressBar(); panelBottom.add(progressBar, "2, 2"); lblProgressAction = new JLabel(""); panelBottom.add(lblProgressAction, "4, 2"); { final JPanel panelButtons = new JPanel(); EqualsLayout layout = new EqualsLayout(5); layout.setMinWidth(100); panelButtons.setLayout(layout); panelBottom.add(panelButtons, "5, 2, fill, fill"); JButton btnDone = new JButton(BUNDLE.getString("Button.done")); //$NON-NLS-1$ btnDone.setIcon(IconManager.APPLY); btnDone.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setVisible(false); } }); panelButtons.add(btnDone); if (inQueue) { JButton btnAbortQueue = new JButton(BUNDLE.getString("Button.abortqueue")); //$NON-NLS-1$ btnAbortQueue.setIcon(IconManager.PROCESS_STOP); btnAbortQueue.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { continueQueue = false; setVisible(false); } }); panelButtons.add(btnAbortQueue); } } } }
From source file:org.tinymediamanager.ui.wizard.MovieScraperPanel.java
License:Apache License
private void initComponents() { setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.LINE_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormSpecs.LINE_GAP_ROWSPEC, })); JPanel panelMovieScrapers = new JPanel(); add(panelMovieScrapers, "2, 2, fill, fill"); panelMovieScrapers.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("80dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("50dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("120dlu:grow"), FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, })); lblMovieScraper = new JLabel(BUNDLE.getString("wizard.movie.scraper")); //$NON-NLS-1$ panelMovieScrapers.add(lblMovieScraper, "2, 2, 11, 1"); JScrollPane scrollPaneScraper = new JScrollPane(); panelMovieScrapers.add(scrollPaneScraper, "2, 4, 5, 1, fill, fill"); tableScraper = new JTable() { private static final long serialVersionUID = -144223066269069772L; @Override//from w w w .j av a 2s . com public Component prepareRenderer(TableCellRenderer renderer, int row, int col) { Component comp = super.prepareRenderer(renderer, row, col); String value = getModel().getValueAt(row, 2).toString(); if (!Globals.isDonator() && value.startsWith("Kodi")) { comp.setBackground(Color.lightGray); comp.setEnabled(false); } else { comp.setBackground(Color.white); comp.setEnabled(true); } return comp; } }; tableScraper.setRowHeight(29); scrollPaneScraper.setViewportView(tableScraper); JPanel panelScraperDetails = new JPanel(); panelMovieScrapers.add(panelScraperDetails, "8, 4, 5, 1, fill, fill"); panelScraperDetails.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormSpecs.RELATED_GAP_ROWSPEC, })); tpScraperDescription = new JTextPane(); tpScraperDescription.setOpaque(false); tpScraperDescription.setEditorKit(new HTMLEditorKit()); panelScraperDetails.add(tpScraperDescription, "2, 2, default, top"); panelMovieScrapers.add(new JSeparator(), "2, 6, 11, 1"); JLabel lblScraperLanguage = new JLabel(BUNDLE.getString("Settings.preferredLanguage")); //$NON-NLS-1$ panelMovieScrapers.add(lblScraperLanguage, "2, 7, right, default"); cbScraperLanguage = new JComboBox<>(); cbScraperLanguage.setModel(new DefaultComboBoxModel<>(MediaLanguages.values())); panelMovieScrapers.add(cbScraperLanguage, "4, 7"); JLabel lblCountry = new JLabel(BUNDLE.getString("Settings.certificationCountry")); //$NON-NLS-1$ panelMovieScrapers.add(lblCountry, "8, 7, right, default"); cbCertificationCountry = new JComboBox<>(); cbCertificationCountry.setModel(new DefaultComboBoxModel<>(CountryCode.values())); panelMovieScrapers.add(cbCertificationCountry, "10, 7, fill, default"); chckbxScraperFallback = new JCheckBox(BUNDLE.getString("Settings.scraperfallback")); //$NON-NLS-1$ panelMovieScrapers.add(chckbxScraperFallback, "2, 9, 11, 1"); panelMovieScrapers.add(new JSeparator(), "2, 11, 11, 1"); JLabel lblNfoFileNaming = new JLabel(BUNDLE.getString("Settings.nofFileNaming")); //$NON-NLS-1$ panelMovieScrapers.add(lblNfoFileNaming, "2, 13"); cbMovieNfoFilename1 = new JCheckBox(BUNDLE.getString("Settings.moviefilename") + ".nfo"); //$NON-NLS-1$ panelMovieScrapers.add(cbMovieNfoFilename1, "4, 13, 3, 1"); cbMovieNfoFilename3 = new JCheckBox(BUNDLE.getString("Settings.nfo.discstyle")); //$NON-NLS-1$ panelMovieScrapers.add(cbMovieNfoFilename3, "8, 13, 3, 3, default, center"); cbMovieNfoFilename2 = new JCheckBox("movie.nfo"); panelMovieScrapers.add(cbMovieNfoFilename2, "4, 15, 3, 1"); }
From source file:org.tinymediamanager.ui.wizard.TvShowScraperPanel.java
License:Apache License
private void initComponents() { setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.LINE_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormSpecs.LINE_GAP_ROWSPEC, })); JPanel panelTvShowScrapers = new JPanel(); add(panelTvShowScrapers, "2, 2, fill, fill"); panelTvShowScrapers.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("20dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("200dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("80dlu:grow"), FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow(3)"), FormSpecs.LINE_GAP_ROWSPEC, })); lblTvShowScraper = new JLabel(BUNDLE.getString("wizard.tvshow.scraper")); //$NON-NLS-1$ panelTvShowScrapers.add(lblTvShowScraper, "2, 2, 11, 1"); JScrollPane scrollPaneScraper = new JScrollPane(); panelTvShowScrapers.add(scrollPaneScraper, "2, 4, 5, 1, fill, fill"); tableScraper = new JTable() { private static final long serialVersionUID = -144223066269069772L; @Override/* w ww. ja v a2s . co m*/ public Component prepareRenderer(TableCellRenderer renderer, int row, int col) { Component comp = super.prepareRenderer(renderer, row, col); String value = getModel().getValueAt(row, 2).toString(); if (!Globals.isDonator() && value.startsWith("Kodi")) { comp.setBackground(Color.lightGray); comp.setEnabled(false); } else { comp.setBackground(Color.white); comp.setEnabled(true); } return comp; } }; tableScraper.setRowHeight(29); scrollPaneScraper.setViewportView(tableScraper); JPanel panelScraperDetails = new JPanel(); panelTvShowScrapers.add(panelScraperDetails, "8, 4, 5, 1, fill, fill"); panelScraperDetails.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormSpecs.RELATED_GAP_ROWSPEC, })); tpScraperDescription = new JTextPane(); tpScraperDescription.setOpaque(false); tpScraperDescription.setEditorKit(new HTMLEditorKit()); panelScraperDetails.add(tpScraperDescription, "2, 2, default, top"); panelTvShowScrapers.add(new JSeparator(), "2, 6, 11, 1"); JLabel lblScraperLanguage = new JLabel(BUNDLE.getString("Settings.preferredLanguage")); //$NON-NLS-1$ panelTvShowScrapers.add(lblScraperLanguage, "2, 7, right, default"); cbScraperLanguage = new JComboBox<>(); cbScraperLanguage.setModel(new DefaultComboBoxModel<>(MediaLanguages.values())); panelTvShowScrapers.add(cbScraperLanguage, "4, 7"); JLabel lblCountry = new JLabel(BUNDLE.getString("Settings.certificationCountry")); //$NON-NLS-1$ panelTvShowScrapers.add(lblCountry, "2, 9, right, default"); cbCertificationCountry = new JComboBox<>(); cbCertificationCountry.setModel(new DefaultComboBoxModel<>(CountryCode.values())); panelTvShowScrapers.add(cbCertificationCountry, "4, 9, fill, default"); }