List of usage examples for javax.swing JOptionPane PLAIN_MESSAGE
int PLAIN_MESSAGE
To view the source code for javax.swing JOptionPane PLAIN_MESSAGE.
Click Source Link
From source file:org.sleuthkit.autopsy.experimental.autoingest.FileExporterSettingsPanel.java
/** * Handles clicking the "New Rule" button. * * @param evt The event which caused this call. *//* w ww . j a va2s.co m*/ private void bnNewRuleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnNewRuleActionPerformed if (hasRuleChanged()) { // if rule has changed without saving if (JOptionPane.showConfirmDialog(this, NbBundle.getMessage(FileExporterSettingsPanel.class, "FileExporterSettingsPanel.UnsavedChangesLost"), NbBundle.getMessage(FileExporterSettingsPanel.class, "FileExporterSettingsPanel.ChangesWillBeLost"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE) == JOptionPane.CANCEL_OPTION) { // they were not quite ready to navigate away yet, so clear the selection treeSelectionModel.clearSelection(); return; } } clearRuleEditor(); localRule = makeRuleFromUserInput(); }
From source file:org.sleuthkit.autopsy.experimental.autoingest.FileExporterSettingsPanel.java
/** * Handles clicking the "Delete Rule" button. * * @param evt The event which caused this call. *//*from www . jav a 2 s .c om*/ private void bnDeleteRuleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnDeleteRuleActionPerformed Item item = (Item) ((DefaultMutableTreeNode) trRuleList.getLastSelectedPathComponent()).getUserObject(); if (item != null) { if (item.getItemType() == ItemType.RULE) { String ruleName = item.getName(); if (JOptionPane.showConfirmDialog(this, NbBundle.getMessage(FileExporterSettingsPanel.class, "FileExporterSettingsPanel.ReallyDeleteRule") + " " + ruleName + NbBundle.getMessage(FileExporterSettingsPanel.class, "FileExporterSettingsPanel.QuestionMark"), NbBundle.getMessage(FileExporterSettingsPanel.class, "FileExporterSettingsPanel.ConfirmRuleDeletion"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE) == JOptionPane.OK_OPTION) { exportRuleSet.removeRule(ruleName); clearRuleEditor(); localRule = makeRuleFromUserInput(); populateRuleTree(ruleName); } } } else { logger.log(Level.WARNING, "Nothing selected to delete"); } }
From source file:org.sleuthkit.autopsy.experimental.autoingest.FileExporterSettingsPanel.java
private void bnDeleteAttributeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnDeleteAttributeActionPerformed String selection = lsAttributeList.getSelectedValue(); if (selection != null && !selection.isEmpty()) { Item item = (Item) ((DefaultMutableTreeNode) trRuleList.getLastSelectedPathComponent()).getUserObject(); if (item != null) { if (JOptionPane.showConfirmDialog(this, NbBundle.getMessage(FileExporterSettingsPanel.class, "FileExporterSettingsPanel.ReallyDeleteCondition") + " " + selection + NbBundle.getMessage(FileExporterSettingsPanel.class, "FileExporterSettingsPanel.QuestionMark"), NbBundle.getMessage(FileExporterSettingsPanel.class, "FileExporterSettingsPanel.ConfirmClauseDeletion"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE) == JOptionPane.OK_OPTION) { String ruleName = item.getRuleName(); // get the rule Rule rule = exportRuleSet.getRule(ruleName); // find the clause and remove it for (ArtifactCondition ac : rule.getArtifactConditions()) { if (selection.compareTo(ac.getTreeDisplayName()) == 0) { rule.removeArtifactCondition(ac); break; }/*from w w w . j a v a 2 s . co m*/ } if (isRuleEmpty(rule)) { exportRuleSet.removeRule(rule); } populateRuleTree(ruleName); } } } }
From source file:org.sleuthkit.autopsy.experimental.autoingest.FileExporterSettingsPanel.java
private void trRuleListValueChanged(javax.swing.event.TreeSelectionEvent evt) { int selectionCount = treeSelectionModel.getSelectionCount(); lsAttributeList.removeAll();/*from w w w .j a v a 2 s . c om*/ attributeListModel.removeAllElements(); if (selectionCount > 0) { if (hasRuleChanged()) { // and the rule has changed without saving if (JOptionPane.showConfirmDialog(this, NbBundle.getMessage(FileExporterSettingsPanel.class, "FileExporterSettingsPanel.UnsavedChangesLost"), NbBundle.getMessage(FileExporterSettingsPanel.class, "FileExporterSettingsPanel.ChangesWillBeLost"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE) == JOptionPane.CANCEL_OPTION) { // they were not quite ready to navigate away yet, so clear the selection trRuleList.clearSelection(); return; } } DefaultMutableTreeNode node = (DefaultMutableTreeNode) trRuleList.getLastSelectedPathComponent(); if (node == null) { // Nothing is selected return; } Item nodeInfo = (Item) node.getUserObject(); bnDeleteRule.setEnabled(nodeInfo.getItemType() == ItemType.RULE); if (nodeInfo.getItemType() == ItemType.RULE_SET) { tbRuleName.setText(null); clearSizeCondition(); clearMIMECondition(); clearArtifactCondition(); localRule = makeRuleFromUserInput(); return; } String selectedRuleName = nodeInfo.getRuleName(); Rule rule = exportRuleSet.getRules().get(selectedRuleName); if (rule != null) { // Read values for this rule and display them in the UI tbRuleName.setText(rule.getName()); FileMIMETypeCondition fileMIMETypeCondition = rule.getFileMIMETypeCondition(); if (fileMIMETypeCondition != null) { // if there is a MIME type condition cbMimeType.setSelected(true); comboBoxMimeTypeComparison.setSelectedItem(fileMIMETypeCondition.getRelationalOp().getSymbol()); comboBoxMimeValue.setSelectedItem(fileMIMETypeCondition.getMIMEType()); } else { // Clear the selection clearMIMECondition(); } List<FileSizeCondition> fileSizeCondition = rule.getFileSizeConditions(); if (fileSizeCondition != null && !fileSizeCondition.isEmpty()) { // if there is a file size condition FileSizeCondition condition = fileSizeCondition.get(0); cbFileSize.setSelected(true); spFileSizeValue.setValue(condition.getSize()); comboBoxFileSizeUnits.setSelectedItem(condition.getUnit().toString()); comboBoxFileSizeComparison.setSelectedItem(condition.getRelationalOperator().getSymbol()); } else { // Clear the selection clearSizeCondition(); } ArtifactCondition artifactConditionToPopulateWith = null; List<ArtifactCondition> artifactConditions = rule.getArtifactConditions(); if (nodeInfo.getItemType() != ItemType.ARTIFACT_CLAUSE) { // if there are any attribute clauses, populate the first one, otherwise clear artifact editor if (artifactConditions.isEmpty()) { clearArtifactCondition(); } else { artifactConditionToPopulateWith = artifactConditions.get(0); } } else { // an artifact clause is selected. populate it. for (ArtifactCondition artifact : artifactConditions) { if (artifact.getTreeDisplayName().compareTo(nodeInfo.getName()) == 0) { artifactConditionToPopulateWith = artifact; break; } } } if (artifactConditionToPopulateWith != null) { for (ArtifactCondition artifact : artifactConditions) { attributeListModel.addElement(artifact.getTreeDisplayName()); } // Don't let listSelectionListener respond lsAttributeList.removeListSelectionListener(listSelectionListener); lsAttributeList.setSelectedValue(artifactConditionToPopulateWith.getTreeDisplayName(), true); populateArtifactEditor(artifactConditionToPopulateWith); setDeleteAttributeButton(); lsAttributeList.addListSelectionListener(listSelectionListener); } } localRule = makeRuleFromUserInput(); } else { bnDeleteRule.setEnabled(false); } }
From source file:org.tinymediamanager.ui.movies.settings.MovieSettingsPanel.java
/** * Instantiates a new movie settings panel. *///from w w w .ja va 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.tvshows.settings.TvShowSettingsPanel.java
/** * Instantiates a new tv show settings panel. */// ww w.j a va2 s. c o m public TvShowSettingsPanel() { 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, RowSpec.decode("default:grow"), FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow(3)"), })); 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, 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.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, })); lblImageCache = new JLabel(BUNDLE.getString("Settings.imagecacheimport")); panelGeneral.add(lblImageCache, "2, 2"); chckbxImageCache = new JCheckBox(""); panelGeneral.add(chckbxImageCache, "4, 2"); lblImageCacheHint = new JLabel(BUNDLE.getString("Settings.imagecacheimporthint")); //$NON-NLS-1$ panelGeneral.add(lblImageCacheHint, "6, 2, 3, 1"); TmmFontHelper.changeFont(lblImageCacheHint, 0.833); final JSeparator separator = new JSeparator(); panelGeneral.add(separator, "2, 4, 7, 1"); JLabel lblTraktTv = new JLabel(BUNDLE.getString("Settings.trakt"));//$NON-NLS-1$ panelGeneral.add(lblTraktTv, "2, 6"); chckbxTraktTv = new JCheckBox(""); panelGeneral.add(chckbxTraktTv, "4, 6"); btnClearTraktTvShows = new JButton(BUNDLE.getString("Settings.trakt.cleartvshows"));//$NON-NLS-1$ btnClearTraktTvShows.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int confirm = JOptionPane.showOptionDialog(null, BUNDLE.getString("Settings.trakt.cleartvshows.hint"), BUNDLE.getString("Settings.trakt.cleartvshows"), JOptionPane.YES_NO_OPTION, //$NON-NLS-1$ JOptionPane.QUESTION_MESSAGE, null, null, null); if (confirm == JOptionPane.YES_OPTION) { TmmTask task = new ClearTraktTvTask(false, true); TmmTaskManager.getInstance().addUnnamedTask(task); } } }); panelGeneral.add(btnClearTraktTvShows, "6, 6"); JPanel panelBadWords = new JPanel(); panelBadWords.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.tvshow.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.tvshow.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 = TvShowModuleManager.SETTINGS.getBadWords().get(row); TvShowModuleManager.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())) { TvShowModuleManager.SETTINGS.addBadWord(tfAddBadword.getText()); tfAddBadword.setText(""); } } }); panelBadWords.add(btnAddBadWord, "4, 6"); { JPanel panelTvShowDataSources = new JPanel(); panelTvShowDataSources.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.tvshowdatasource"), //$NON-NLS-1$ TitledBorder.LEADING, TitledBorder.TOP, null, null)); add(panelTvShowDataSources, "2, 4, 3, 1, fill, top"); panelTvShowDataSources.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("50dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.UNRELATED_GAP_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("200dlu:grow(2)"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("160px:grow"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, })); JLabel lblDataSource = new JLabel(BUNDLE.getString("Settings.source")); //$NON-NLS-1$ panelTvShowDataSources.add(lblDataSource, "2, 2, 5, 1"); JLabel lblSkipFolders = new JLabel(BUNDLE.getString("Settings.ignore"));//$NON-NLS-1$ panelTvShowDataSources.add(lblSkipFolders, "12, 2, 3, 1"); JScrollPane scrollPaneDatasource = new JScrollPane(); panelTvShowDataSources.add(scrollPaneDatasource, "2, 4, 5, 1, fill, fill"); listDatasources = new JList<>(); scrollPaneDatasource.setViewportView(listDatasources); JPanel panelTvShowSourcesButtons = new JPanel(); panelTvShowDataSources.add(panelTvShowSourcesButtons, "8, 4, default, top"); panelTvShowSourcesButtons.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() { public void actionPerformed(ActionEvent arg0) { Path file = TmmUIHelper .selectDirectory(BUNDLE.getString("Settings.tvshowdatasource.folderchooser")); //$NON-NLS-1$ if (file != null && Files.isDirectory(file)) { settings.addTvShowDataSources(file.toAbsolutePath().toString()); } } }); panelTvShowSourcesButtons.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 = settings.getTvShowDataSource().get(row); String[] choices = { BUNDLE.getString("Button.continue"), //$NON-NLS-1$ BUNDLE.getString("Button.abort") }; int decision = JOptionPane.showOptionDialog(null, String.format(BUNDLE.getString("Settings.tvshowdatasource.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)); settings.removeTvShowDataSources(path); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } } }); panelTvShowSourcesButtons.add(btnRemove, "1, 3, fill, top"); JScrollPane scrollPane = new JScrollPane(); panelTvShowDataSources.add(scrollPane, "12, 4, fill, fill"); listExclude = new JList<>(); scrollPane.setViewportView(listExclude); JPanel panelSkipFolderButtons = new JPanel(); panelTvShowDataSources.add(panelSkipFolderButtons, "14, 4, fill, fill"); panelSkipFolderButtons.setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.DEFAULT_COLSPEC, }, new RowSpec[] { FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, })); JButton btnAddSkipFolder = new JButton(IconManager.LIST_ADD); btnAddSkipFolder.setToolTipText(BUNDLE.getString("Settings.addignore")); //$NON-NLS-1$ btnAddSkipFolder.setMargin(new Insets(2, 2, 2, 2)); btnAddSkipFolder.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.addTvShowSkipFolder(file.toAbsolutePath().toString()); } } }); panelSkipFolderButtons.add(btnAddSkipFolder, "1, 1"); JButton btnRemoveSkipFolder = new JButton(IconManager.LIST_REMOVE); btnRemoveSkipFolder.setToolTipText(BUNDLE.getString("Settings.removeignore")); //$NON-NLS-1$ btnRemoveSkipFolder.setMargin(new Insets(2, 2, 2, 2)); btnRemoveSkipFolder.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int row = listExclude.getSelectedIndex(); if (row != -1) { // nothing selected String ingore = settings.getTvShowSkipFolders().get(row); settings.removeTvShowSkipFolder(ingore); } } }); panelSkipFolderButtons.add(btnRemoveSkipFolder, "1, 3"); JLabel lblDvdOrder = new JLabel(BUNDLE.getString("Settings.dvdorder")); //$NON-NLS-1$ panelTvShowDataSources.add(lblDvdOrder, "2, 6, right, default"); cbDvdOrder = new JCheckBox(""); panelTvShowDataSources.add(cbDvdOrder, "4, 6"); } initDataBindings(); if (!Globals.isDonator()) { chckbxTraktTv.setSelected(false); chckbxTraktTv.setEnabled(false); btnClearTraktTvShows.setEnabled(false); } }
From source file:org.wandora.application.gui.topicpanels.ProcessingTopicPanel.java
private void showRichErrorDialog(String msg) { final JTextArea area = new JTextArea(); area.setFont(errorMessageFont);/*w w w.j a v a2 s . c om*/ //area.setPreferredSize(new Dimension(520, 180)); area.setEditable(false); area.setText(msg); // Make the JOptionPane resizable using the HierarchyListener area.addHierarchyListener(new HierarchyListener() { public void hierarchyChanged(HierarchyEvent e) { Window window = SwingUtilities.getWindowAncestor(area); if (window instanceof Dialog) { Dialog dialog = (Dialog) window; if (!dialog.isResizable()) { dialog.setResizable(true); } } } }); JScrollPane scroller = new JScrollPane(area); scroller.setPreferredSize(new Dimension(520, 180)); JOptionPane.showMessageDialog(Wandora.getWandora(), scroller, "Errors", JOptionPane.PLAIN_MESSAGE); }
From source file:pl.edu.pw.appt.GUI.java
private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed boolean zal = false; JTextField z1 = new JTextField(); JTextField z2 = new JTextField(); Object[] message = { "Zdarzenie 1", z1, "Zdarzenie 2", z2 }; JOptionPane pane = new JOptionPane(message, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION); pane.createDialog(null, "Badanie zdarze").setVisible(true); if (selectSystem.getSelectedIndex() != -1) { zal = server.messages.isDependent1(Integer.parseInt(z1.getText()), Integer.parseInt(z2.getText()), selectSystem.getSelectedItem().toString()); JOptionPane.showMessageDialog(null, zal ? "Zdarzenia s zalene" : "Zdarzenia s niezalene", "Badanie zdarze", JOptionPane.WARNING_MESSAGE); }// w w w . ja v a 2 s . c o m }
From source file:processing.app.Editor.java
public boolean serialPrompt() { int count = serialMenu.getItemCount(); Object[] names = new Object[count]; for (int i = 0; i < count; i++) { names[i] = ((JCheckBoxMenuItem) serialMenu.getItem(i)).getText(); }/* w w w .j ava 2s .co m*/ String result = (String) JOptionPane.showInputDialog(this, I18n.format(_("Serial port {0} not found.\n" + "Retry the upload with another serial port?"), PreferencesData.get("serial.port")), "Serial port not found", JOptionPane.PLAIN_MESSAGE, null, names, 0); if (result == null) return false; selectSerialPort(result); base.onBoardOrPortChange(); return true; }
From source file:put.semantic.fcanew.ui.MainWindow.java
private void downloadSomethingActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_downloadSomethingActionPerformed final Implication impl = mlExpert.getCurrentImplication(); new SwingWorker<List<String>, Object>() { @Override/*from w w w . j a v a2 s . c o m*/ protected List<String> doInBackground() throws Exception { List<String> result = downloader.select(0, toArray(impl.getPremises().iterator())); removeKnown(result); return result; } @Override protected void done() { try { List<String> uris = get(); if (uris.isEmpty()) { JOptionPane.showMessageDialog(MainWindow.this, "There are no objects fulifying premises and not available in considered context"); return; } Object result = JOptionPane.showInputDialog(MainWindow.this, "Select URI", "Downloaded something", JOptionPane.PLAIN_MESSAGE, null, uris.toArray(new String[0]), uris.get(0)); addNew((String) result); } catch (InterruptedException | ExecutionException ex) { //should never happen ex.printStackTrace(); } } }.execute(); }