List of usage examples for java.awt.event KeyAdapter KeyAdapter
KeyAdapter
From source file:com.sec.ose.osi.ui.frm.main.manage.dialog.JDlgProjectCreate.java
/** * This method initializes jComboBoxClonedFrom * //from w ww .jav a 2s .c o m * @return javax.swing.JComboBox */ private JComboBox<String> getJComboBoxClonedFrom() { if (jComboBoxClonedFrom == null) { jComboBoxClonedFrom = new JComboBox<String>(); jComboBoxClonedFrom.setRenderer(new ComboToopTip()); jComboBoxClonedFrom.setEditable(true); jComboBoxClonedFrom.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { log.debug("jComboBoxClonedFrom.actionPerformed()"); eventHandler.handleEvent(EventHandler.COMBO_CLONED_FROM); } }); refresh(jComboBoxClonedFrom); final JTextField editor; editor = (JTextField) jComboBoxClonedFrom.getEditor().getEditorComponent(); editor.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { char ch = e.getKeyChar(); if (ch != KeyEvent.VK_ENTER && ch != KeyEvent.VK_BACK_SPACE && (ch == KeyEvent.CHAR_UNDEFINED || Character.isISOControl(ch))) return; if (ch == KeyEvent.VK_ENTER) { jComboBoxClonedFrom.hidePopup(); return; } String str = editor.getText(); if (jComboBoxClonedFrom.getComponentCount() > 0) { jComboBoxClonedFrom.removeAllItems(); } jComboBoxClonedFrom.addItem(str); try { String tmpProjectName = null; if (str.length() > 0) { for (int i = 0; i < names.size(); i++) { tmpProjectName = names.get(i); if (tmpProjectName.toLowerCase().startsWith(str.toLowerCase())) jComboBoxClonedFrom.addItem(tmpProjectName); } } else { for (int i = 0; i < names.size(); i++) { jComboBoxClonedFrom.addItem(names.get(i)); } } } catch (Exception e1) { log.warn(e1.getMessage()); } jComboBoxClonedFrom.hidePopup(); if (str.length() > 0) jComboBoxClonedFrom.showPopup(); } }); editor.addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent e) { if (editor.getText().length() > 0) jComboBoxClonedFrom.showPopup(); } public void focusLost(FocusEvent e) { jComboBoxClonedFrom.hidePopup(); } }); } return jComboBoxClonedFrom; }
From source file:edu.ku.brc.specify.plugins.ipadexporter.iPadDBExporterPlugin.java
/** * //from w w w. jav a 2s . com */ private void createAccount() { Institution inst = iPadDBExporter.getCurrentInstitution(); if (StringUtils.isEmpty(inst.getGuid())) { UIRegistry.showError("Institution must have a GUID value."); return; } loadAndPushResourceBundle(RESOURCE_NAME); final JTextField userNameTF = createTextField(15); final JPasswordField passwordTF = createPasswordField(); final JLabel statusLbl = createLabel(" "); ImageIcon imgIcon = IconManager.getImage("SpecifySmalliPad128x128", IconManager.STD_ICON_SIZE.NonStd); JPanel loginPanel = DatabaseLoginPanel.createLoginPanel("Username", userNameTF, "USRNM_EMAIL_HINT", "Password", passwordTF, statusLbl, imgIcon); final CustomDialog dlg = new CustomDialog((Frame) getMostRecentWindow(), getResourceString("CREATE_INST_IN_CLOUD"), true, CustomDialog.OKCANCEL, loginPanel) { @Override protected void okButtonPressed() { // NOTE: THis call should fail indicating is is not being used // so it if is OK then it is an error String uName = userNameTF.getText(); if (iPadCloud.isUserNameOK(uName)) { setErrorMsg(statusLbl, getFormattedResStr("USRNM_IS_TAKEN", uName)); } else { super.okButtonPressed(); } } }; KeyAdapter ka = new KeyAdapter() { @Override public void keyTyped(KeyEvent e) { String pwd = new String(passwordTF.getPassword()); boolean isOK = UIHelper.isValidEmailAddress(userNameTF.getText()) && pwd.length() > 4; dlg.getOkBtn().setEnabled(isOK); } }; userNameTF.addKeyListener(ka); passwordTF.addKeyListener(ka); dlg.setOkLabel(getResourceString("NEW_ACCOUNT")); dlg.createUI(); dlg.getOkBtn().setEnabled(false); centerAndShow(dlg); popResourceBundle(); if (!dlg.isCancelled()) { cloudInstId = iPadCloud.createInstitution(inst.getName(), inst.getUri(), inst.getCode(), inst.getGuid()); if (cloudInstId != null) { createAccountBtn.setEnabled(false); loginBtn.setEnabled(true); enableRemoveDatasetBtn(); checkInstitutionInfo(false); String uName = userNameTF.getText(); String pwd = new String(passwordTF.getPassword()); if (iPadCloud.addNewUser(uName, pwd, inst.getGuid())) { if (iPadCloud.login(uName, pwd)) { login(new Pair<String, String>(uName, pwd)); } } else { setErrorMsg(statusLbl, kErrorCreatingAcctMsg); } } else { UIRegistry.showError(kErrorCreatingAcctMsg); } } }
From source file:com.intuit.tank.proxy.ProxyApp.java
private JPanel getTransactionTable() { JPanel frame = new JPanel(new BorderLayout()); model = new TransactionTableModel(); final JTable table = new TransactionTable(model); final TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(model); table.setRowSorter(sorter);//from w w w . j a v a2 s. c om final JPopupMenu pm = new JPopupMenu(); JMenuItem item = new JMenuItem("Delete Selected"); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { int[] selectedRows = table.getSelectedRows(); if (selectedRows.length != 0) { int response = JOptionPane.showConfirmDialog(ProxyApp.this, "Are you sure you want to delete " + selectedRows.length + " Transactions?", "Confirm Delete", JOptionPane.YES_NO_OPTION); if (response == JOptionPane.YES_OPTION) { int[] correctedRows = new int[selectedRows.length]; for (int i = selectedRows.length; --i >= 0;) { int row = selectedRows[i]; int index = (Integer) table.getValueAt(row, 0) - 1; correctedRows[i] = index; } Arrays.sort(correctedRows); for (int i = correctedRows.length; --i >= 0;) { int row = correctedRows[i]; Transaction transaction = model.getTransactionForIndex(row); if (transaction != null) { model.removeTransaction(transaction, row); isDirty = true; saveAction.setEnabled(isDirty && !stopAction.isEnabled()); } } } } } }); pm.add(item); table.add(pm); table.addMouseListener(new MouseAdapter() { boolean pressed = false; public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { Point p = e.getPoint(); int row = table.rowAtPoint(p); int index = (Integer) table.getValueAt(row, 0) - 1; Transaction transaction = model.getTransactionForIndex(index); if (transaction != null) { detailsTF.setText(transaction.toString()); detailsTF.setCaretPosition(0); detailsDialog.setVisible(true); } } } /** * @{inheritDoc */ @Override public void mousePressed(MouseEvent e) { if (e.isPopupTrigger()) { pressed = true; int[] selectedRows = table.getSelectedRows(); if (selectedRows.length != 0) { pm.show(e.getComponent(), e.getX(), e.getY()); } } } /** * @{inheritDoc */ @Override public void mouseReleased(MouseEvent e) { if (!pressed && e.isPopupTrigger()) { int[] selectedRows = table.getSelectedRows(); if (selectedRows.length != 0) { pm.show(e.getComponent(), e.getX(), e.getY()); } } } }); JScrollPane pane = new JScrollPane(table); frame.add(pane, BorderLayout.CENTER); JPanel panel = new JPanel(new BorderLayout()); JLabel label = new JLabel("Filter: "); panel.add(label, BorderLayout.WEST); final JLabel countLabel = new JLabel(" Count: 0 "); panel.add(countLabel, BorderLayout.EAST); final JTextField filterText = new JTextField(""); filterText.addKeyListener(new KeyAdapter() { public void keyTyped(KeyEvent e) { String text = filterText.getText(); if (text.length() == 0) { sorter.setRowFilter(null); } else { try { sorter.setRowFilter(RowFilter.regexFilter(text)); countLabel.setText(" Count: " + sorter.getViewRowCount() + " "); } catch (PatternSyntaxException pse) { System.err.println("Bad regex pattern"); } } } }); panel.add(filterText, BorderLayout.CENTER); frame.add(panel, BorderLayout.NORTH); return frame; }
From source file:edu.ku.brc.specify.plugins.ipadexporter.InstitutionConfigDlg.java
private JPanel createURLPanel() { //setTitle(getResourceString("IMAGE_SRC_TITLE")); useAttachTitle = getResourceString("ATTCH_MGR"); useDirectTitle = getResourceString("DIR_URL"); CellConstraints cc = new CellConstraints(); PanelBuilder pb = new PanelBuilder(new FormLayout("p,2px,p,f:p:g", "p,4px,p,4px,p,4px,p,4px,p,4px")); label = createLabel(useAttachTitle + ":"); urlTextField = new ValTextField(40); statusLbl = createLabel(""); useAttchmentMgrRB = createI18NRadioButton("USE_ATT_MGR"); useDirectUrlRB = createI18NRadioButton("USE_DIR_URL"); int y = 1;/* ww w .j a v a 2s. c o m*/ pb.add(createI18NLabel("HOW_IMG_ACCESS"), cc.xy(1, y)); y += 2; pb.add(useAttchmentMgrRB, cc.xyw(1, y, 4)); y += 2; pb.add(useDirectUrlRB, cc.xyw(1, y, 4)); y += 2; PanelBuilder pbInner = new PanelBuilder(new FormLayout("p,2px,f:p:g", "p")); pbInner.add(label, cc.xy(1, 1)); pbInner.add(urlTextField, cc.xy(3, 1)); pb.add(pbInner.getPanel(), cc.xyw(1, y, 4)); y += 2; pb.add(statusLbl, cc.xyw(1, y, 4)); y += 2; pb.setDefaultDialogBorder(); KeyAdapter ka = new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { updateOKBtn(); } }; urlTextField.addKeyListener(ka); super.createUI(); ButtonGroup group = new ButtonGroup(); group.add(useAttchmentMgrRB); group.add(useDirectUrlRB); ActionListener al = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { radBtnSelected(); } }; useAttchmentMgrRB.addActionListener(al); useDirectUrlRB.addActionListener(al); // Set Data into form or initialize it String typeStr = AppPreferences.getRemote().get(getRemoteImageURLTypePrefName(), null); String imgURLPath = AppPreferences.getRemote().get(getRemoteImageURLPrefName(), null); //System.out.println(String.format("%s=%s", getRemoteImageURLTypePrefName(), typeStr)); //System.out.println(String.format("%s=%s", getRemoteImageURLPrefName(), imgURLPath)); if (isNotEmpty(typeStr) && isNotEmpty(imgURLPath)) { urlTextField.setText(imgURLPath); boolean isAttachMgr = isNotEmpty(typeStr) && typeStr.equals(ATTMGR); useAttchmentMgrRB.setSelected(isAttachMgr); useDirectUrlRB.setSelected(!isAttachMgr); } else { fillWithDefaultAttMgr(); } return pb.getPanel(); }
From source file:net.pms.newgui.NavigationShareTab.java
private void initSimpleComponents(CellConstraints cc) { // Thumbnail seeking position seekpos = new JTextField("" + configuration.getThumbnailSeekPos()); seekpos.addKeyListener(new KeyAdapter() { @Override//from w ww.ja v a 2s . c o m public void keyReleased(KeyEvent e) { try { int ab = Integer.parseInt(seekpos.getText()); configuration.setThumbnailSeekPos(ab); if (configuration.getUseCache()) { PMS.get().getDatabase().init(true); } } catch (NumberFormatException nfe) { LOGGER.debug("Could not parse thumbnail seek position from \"" + seekpos.getText() + "\""); } } }); if (configuration.isThumbnailGenerationEnabled()) { seekpos.setEnabled(true); } else { seekpos.setEnabled(false); } // Generate thumbnails thumbgenCheckBox = new JCheckBox(Messages.getString("NetworkTab.2"), configuration.isThumbnailGenerationEnabled()); thumbgenCheckBox.setContentAreaFilled(false); thumbgenCheckBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setThumbnailGenerationEnabled((e.getStateChange() == ItemEvent.SELECTED)); seekpos.setEnabled(configuration.isThumbnailGenerationEnabled()); mplayer_thumb.setEnabled(configuration.isThumbnailGenerationEnabled()); } }); // Use MPlayer for video thumbnails mplayer_thumb = new JCheckBox(Messages.getString("FoldTab.14"), configuration.isUseMplayerForVideoThumbs()); mplayer_thumb.setToolTipText(Messages.getString("FoldTab.61")); mplayer_thumb.setContentAreaFilled(false); mplayer_thumb.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setUseMplayerForVideoThumbs((e.getStateChange() == ItemEvent.SELECTED)); } }); if (configuration.isThumbnailGenerationEnabled()) { mplayer_thumb.setEnabled(true); } else { mplayer_thumb.setEnabled(false); } // DVD ISO thumbnails dvdiso_thumb = new JCheckBox(Messages.getString("FoldTab.19"), configuration.isDvdIsoThumbnails()); dvdiso_thumb.setContentAreaFilled(false); dvdiso_thumb.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setDvdIsoThumbnails((e.getStateChange() == ItemEvent.SELECTED)); } }); // Image thumbnails image_thumb = new JCheckBox(Messages.getString("FoldTab.21"), configuration.getImageThumbnailsEnabled()); image_thumb.setContentAreaFilled(false); image_thumb.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setImageThumbnailsEnabled((e.getStateChange() == ItemEvent.SELECTED)); } }); // Audio thumbnails import final KeyedComboBoxModel<CoverSupplier, String> thumbKCBM = new KeyedComboBoxModel<>( new CoverSupplier[] { CoverSupplier.NONE, CoverSupplier.COVER_ART_ARCHIVE }, new String[] { Messages.getString("FoldTab.35"), Messages.getString("FoldTab.73") }); audiothumbnail = new JComboBox<>(thumbKCBM); audiothumbnail.setEditable(false); thumbKCBM.setSelectedKey(configuration.getAudioThumbnailMethod()); audiothumbnail.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { configuration.setAudioThumbnailMethod(thumbKCBM.getSelectedKey()); LOGGER.info("Setting {} {}", Messages.getRootString("FoldTab.26"), thumbKCBM.getSelectedValue()); } } }); // Alternate video cover art folder defaultThumbFolder = new JTextField(configuration.getAlternateThumbFolder()); defaultThumbFolder.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { configuration.setAlternateThumbFolder(defaultThumbFolder.getText()); } }); // Alternate video cover art folder button select = new CustomJButton("..."); select.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JFileChooser chooser; try { chooser = new JFileChooser(); } catch (Exception ee) { chooser = new JFileChooser(new RestrictedFileSystemView()); } chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int returnVal = chooser.showDialog((Component) e.getSource(), Messages.getString("FoldTab.28")); if (returnVal == JFileChooser.APPROVE_OPTION) { defaultThumbFolder.setText(chooser.getSelectedFile().getAbsolutePath()); configuration.setAlternateThumbFolder(chooser.getSelectedFile().getAbsolutePath()); } } }); // Show Server Settings folder isShowFolderServerSettings = new JCheckBox(Messages.getString("FoldTab.ShowServerSettingsFolder"), configuration.isShowServerSettingsFolder()); isShowFolderServerSettings.setContentAreaFilled(false); isShowFolderServerSettings.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setShowServerSettingsFolder((e.getStateChange() == ItemEvent.SELECTED)); } }); // Show #--TRANSCODE--# folder isShowFolderTranscode = new JCheckBox(Messages.getString("FoldTab.ShowTranscodeFolder"), configuration.isShowTranscodeFolder()); isShowFolderTranscode.setContentAreaFilled(false); isShowFolderTranscode.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setShowTranscodeFolder((e.getStateChange() == ItemEvent.SELECTED)); } }); // Show Media Library folder isShowFolderMediaLibrary = new JCheckBox(Messages.getString("FoldTab.ShowMediaLibraryFolder"), configuration.isShowMediaLibraryFolder()); isShowFolderMediaLibrary.setContentAreaFilled(false); isShowFolderMediaLibrary.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setShowMediaLibraryFolder((e.getStateChange() == ItemEvent.SELECTED)); } }); // Browse compressed archives archive = new JCheckBox(Messages.getString("NetworkTab.1"), configuration.isArchiveBrowsing()); archive.setContentAreaFilled(false); archive.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setArchiveBrowsing(e.getStateChange() == ItemEvent.SELECTED); } }); // Enable the Media Library cacheenable = new JCheckBox(Messages.getString("NetworkTab.EnableMediaLibrary"), configuration.getUseCache()); cacheenable.setToolTipText(Messages.getString("FoldTab.ShowMediaLibraryFolderTooltip")); cacheenable.setContentAreaFilled(false); cacheenable.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setUseCache((e.getStateChange() == ItemEvent.SELECTED)); cachereset.setEnabled(configuration.getUseCache()); setScanLibraryEnabled(configuration.getUseCache()); } }); // Reset cache cachereset = new CustomJButton(Messages.getString("NetworkTab.EmptyMediaLibrary")); cachereset.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int option = JOptionPane.showConfirmDialog(looksFrame, Messages.getString("NetworkTab.MediaLibraryEmptiedExceptFullyPlayed") + "\n" + Messages.getString("NetworkTab.19"), Messages.getString("Dialog.Question"), JOptionPane.YES_NO_OPTION); if (option == JOptionPane.YES_OPTION) { PMS.get().getDatabase().init(true); } } }); cachereset.setEnabled(configuration.getUseCache()); // Hide file extensions hideextensions = new JCheckBox(Messages.getString("FoldTab.5"), configuration.isHideExtensions()); hideextensions.setContentAreaFilled(false); if (configuration.isPrettifyFilenames()) { hideextensions.setEnabled(false); } hideextensions.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setHideExtensions((e.getStateChange() == ItemEvent.SELECTED)); } }); // Hide transcoding engine names hideengines = new JCheckBox(Messages.getString("FoldTab.8"), configuration.isHideEngineNames()); hideengines.setToolTipText(Messages.getString("FoldTab.46")); hideengines.setContentAreaFilled(false); hideengines.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setHideEngineNames((e.getStateChange() == ItemEvent.SELECTED)); } }); // Hide empty folders hideemptyfolders = new JCheckBox(Messages.getString("FoldTab.31"), configuration.isHideEmptyFolders()); hideemptyfolders.setToolTipText(Messages.getString("FoldTab.59")); hideemptyfolders.setContentAreaFilled(false); hideemptyfolders.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setHideEmptyFolders((e.getStateChange() == ItemEvent.SELECTED)); } }); // Show iTunes library itunes = new JCheckBox(Messages.getString("FoldTab.30"), configuration.isShowItunesLibrary()); itunes.setToolTipText(Messages.getString("FoldTab.47")); itunes.setContentAreaFilled(false); if (!(Platform.isMac() || Platform.isWindows())) { itunes.setEnabled(false); } itunes.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setShowItunesLibrary((e.getStateChange() == ItemEvent.SELECTED)); } }); // Show iPhoto library iphoto = new JCheckBox(Messages.getString("FoldTab.29"), configuration.isShowIphotoLibrary()); iphoto.setContentAreaFilled(false); if (!Platform.isMac()) { iphoto.setEnabled(false); } iphoto.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setShowIphotoLibrary((e.getStateChange() == ItemEvent.SELECTED)); } }); // Show aperture library aperture = new JCheckBox(Messages.getString("FoldTab.34"), configuration.isShowApertureLibrary()); aperture.setContentAreaFilled(false); if (!Platform.isMac()) { aperture.setEnabled(false); } aperture.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setShowApertureLibrary((e.getStateChange() == ItemEvent.SELECTED)); } }); // File order final KeyedComboBoxModel<Integer, String> kcbm = new KeyedComboBoxModel<>( new Integer[] { UMSUtils.SORT_LOC_SENS, // alphabetical UMSUtils.SORT_LOC_NAT, // natural sort UMSUtils.SORT_INS_ASCII, // ASCIIbetical UMSUtils.SORT_MOD_NEW, // newest first UMSUtils.SORT_MOD_OLD, // oldest first UMSUtils.SORT_RANDOM, // random UMSUtils.SORT_NO_SORT // no sorting }, new String[] { Messages.getString("FoldTab.15"), Messages.getString("FoldTab.22"), Messages.getString("FoldTab.20"), Messages.getString("FoldTab.16"), Messages.getString("FoldTab.17"), Messages.getString("FoldTab.58"), Messages.getString("FoldTab.62") }); sortmethod = new JComboBox<>(kcbm); sortmethod.setEditable(false); kcbm.setSelectedKey(configuration.getSortMethod(null)); sortmethod.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { configuration.setSortMethod(kcbm.getSelectedKey()); LOGGER.info("Setting {} {}", Messages.getRootString("FoldTab.18"), kcbm.getSelectedValue()); } } }); // Ignore the word "the" while sorting ignorethewordthe = new JCheckBox(Messages.getString("FoldTab.39"), configuration.isIgnoreTheWordAandThe()); ignorethewordthe.setToolTipText(Messages.getString("FoldTab.44")); ignorethewordthe.setContentAreaFilled(false); ignorethewordthe.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setIgnoreTheWordAandThe((e.getStateChange() == ItemEvent.SELECTED)); } }); atzLimit = new JTextField("" + configuration.getATZLimit()); atzLimit.setToolTipText(Messages.getString("FoldTab.49")); atzLimit.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { try { int ab = Integer.parseInt(atzLimit.getText()); configuration.setATZLimit(ab); } catch (NumberFormatException nfe) { LOGGER.debug("Could not parse ATZ limit from \"" + atzLimit.getText() + "\""); LOGGER.debug("The full error was: " + nfe); } } }); isShowFolderLiveSubtitles = new JCheckBox(Messages.getString("FoldTab.ShowLiveSubtitlesFolder"), configuration.isShowLiveSubtitlesFolder()); isShowFolderLiveSubtitles.setContentAreaFilled(false); isShowFolderLiveSubtitles.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setShowLiveSubtitlesFolder((e.getStateChange() == ItemEvent.SELECTED)); } }); prettifyfilenames = new JCheckBox(Messages.getString("FoldTab.43"), configuration.isPrettifyFilenames()); prettifyfilenames.setToolTipText(Messages.getString("FoldTab.45")); prettifyfilenames.setContentAreaFilled(false); prettifyfilenames.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setPrettifyFilenames((e.getStateChange() == ItemEvent.SELECTED)); hideextensions.setEnabled((e.getStateChange() != ItemEvent.SELECTED)); episodeTitles.setEnabled((e.getStateChange() == ItemEvent.SELECTED)); } }); episodeTitles = new JCheckBox(Messages.getString("FoldTab.74"), configuration.isUseInfoFromIMDb()); episodeTitles.setToolTipText(Messages.getString("FoldTab.64")); episodeTitles.setContentAreaFilled(false); if (!configuration.isPrettifyFilenames()) { episodeTitles.setEnabled(false); } episodeTitles.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setUseInfoFromIMDb((e.getStateChange() == ItemEvent.SELECTED)); } }); isShowFolderNewMedia = new JCheckBox(Messages.getString("FoldTab.ShowNewMediaFolder"), configuration.isShowNewMediaFolder()); isShowFolderNewMedia.setToolTipText(Messages.getString("FoldTab.66")); isShowFolderNewMedia.setContentAreaFilled(false); isShowFolderNewMedia.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setShowNewMediaFolder((e.getStateChange() == ItemEvent.SELECTED)); } }); resume = new JCheckBox(Messages.getString("NetworkTab.68"), configuration.isResumeEnabled()); resume.setToolTipText(Messages.getString("NetworkTab.69")); resume.setContentAreaFilled(false); resume.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setResume((e.getStateChange() == ItemEvent.SELECTED)); } }); isShowFolderRecentlyPlayed = new JCheckBox(Messages.getString("FoldTab.ShowRecentlyPlayedFolder"), configuration.isShowRecentlyPlayedFolder()); isShowFolderRecentlyPlayed.setContentAreaFilled(false); isShowFolderRecentlyPlayed.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setShowRecentlyPlayedFolder((e.getStateChange() == ItemEvent.SELECTED)); } }); // Fully played action final KeyedComboBoxModel<FullyPlayedAction, String> fullyPlayedActionModel = new KeyedComboBoxModel<>( new FullyPlayedAction[] { FullyPlayedAction.NO_ACTION, FullyPlayedAction.MARK, FullyPlayedAction.HIDE_VIDEO, FullyPlayedAction.MOVE_FOLDER, FullyPlayedAction.MOVE_TRASH }, new String[] { Messages.getString("FoldTab.67"), Messages.getString("FoldTab.68"), Messages.getString("FoldTab.69"), Messages.getString("FoldTab.70"), Messages.getString("FoldTab.71") }); fullyPlayedAction = new JComboBox<>(fullyPlayedActionModel); fullyPlayedAction.setEditable(false); fullyPlayedActionModel.setSelectedKey(configuration.getFullyPlayedAction()); fullyPlayedAction.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { configuration.setFullyPlayedAction(fullyPlayedActionModel.getSelectedKey()); fullyPlayedOutputDirectory .setEnabled(fullyPlayedActionModel.getSelectedKey() == FullyPlayedAction.MOVE_FOLDER); selectFullyPlayedOutputDirectory .setEnabled(fullyPlayedActionModel.getSelectedKey() == FullyPlayedAction.MOVE_FOLDER); if (configuration.getUseCache() && fullyPlayedActionModel.getSelectedKey() == FullyPlayedAction.NO_ACTION) { PMS.get().getDatabase().init(true); } } } }); // Watched video output directory fullyPlayedOutputDirectory = new JTextField(configuration.getFullyPlayedOutputDirectory()); fullyPlayedOutputDirectory.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { configuration.setFullyPlayedOutputDirectory(fullyPlayedOutputDirectory.getText()); } }); fullyPlayedOutputDirectory .setEnabled(configuration.getFullyPlayedAction() == FullyPlayedAction.MOVE_FOLDER); // Watched video output directory selection button selectFullyPlayedOutputDirectory = new CustomJButton("..."); selectFullyPlayedOutputDirectory.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JFileChooser chooser; try { chooser = new JFileChooser(); } catch (Exception ee) { chooser = new JFileChooser(new RestrictedFileSystemView()); } chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int returnVal = chooser.showDialog((Component) e.getSource(), Messages.getString("FoldTab.28")); if (returnVal == JFileChooser.APPROVE_OPTION) { fullyPlayedOutputDirectory.setText(chooser.getSelectedFile().getAbsolutePath()); configuration.setFullyPlayedOutputDirectory(chooser.getSelectedFile().getAbsolutePath()); } } }); selectFullyPlayedOutputDirectory .setEnabled(configuration.getFullyPlayedAction() == FullyPlayedAction.MOVE_FOLDER); }
From source file:com.eviware.soapui.SoapUI.java
private JComponent buildToolbar() { mainToolbar = new JXToolBar(); mainToolbar.setFloatable(false);// w ww .j av a 2 s. c o m mainToolbar.setRollover(true); mainToolbar.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH); mainToolbar.add(new NewWsdlProjectActionDelegate()); mainToolbar.add(new ImportWsdlProjectActionDelegate()); mainToolbar.add(new SaveAllActionDelegate()); mainToolbar.addSpace(2); mainToolbar.add(new ShowOnlineHelpAction("User Guide", HelpUrls.USERGUIDE_HELP_URL, "Opens the soapUI User-Guide in a browser")); mainToolbar.add(new ShowOnlineHelpAction("Forum", HelpUrls.FORUMS_HELP_URL, "Opens the soapUI Forum in a browser", "/group_go.png")); mainToolbar.addSpace(2); mainToolbar.add(new ShowOnlineHelpAction("Trial", HelpUrls.TRIAL_URL, "Apply for soapUI Pro Trial License", "/favicon.png")); mainToolbar.addSpace(2); mainToolbar.add(new PreferencesActionDelegate()); applyProxyButton = (JToggleButton) mainToolbar.add(new JToggleButton(new ApplyProxyButtonAction())); ProxyUtils.setProxyEnabled(getSettings().getBoolean(ProxySettings.ENABLE_PROXY)); if (ProxyUtils.isProxyEnabled()) { applyProxyButton.setIcon(UISupport.createImageIcon(PROXY_ENABLED_ICON)); applyProxyButton.setSelected(true); ProxyUtils.setProxyEnabled(true); } else { applyProxyButton.setIcon(UISupport.createImageIcon(PROXY_DISABLED_ICON)); ProxyUtils.setProxyEnabled(false); } launchLoadUIButton = mainToolbar.add(new LaunchLoadUIButtonAction()); // mainToolbar.add( new ExitButtonAction() ); mainToolbar.addGlue(); searchField = new JTextField(20); searchField.addKeyListener(new KeyAdapter() { @Override public void keyTyped(KeyEvent e) { if (e.getKeyChar() == '\n') { doForumSearch(searchField.getText()); } } }); mainToolbar.addLabeledFixed("Search Forum", searchField); mainToolbar.add(new ToolbarForumSearchAction()); mainToolbar.add(new ShowOnlineHelpAction(HelpUrls.USERGUIDE_HELP_URL)); for (int i = 0; i < mainToolbar.getComponentCount(); i++) { if (mainToolbar.getComponent(i) instanceof JComponent) { ((JComponent) mainToolbar.getComponent(i)).setBorder(BorderFactory.createEmptyBorder(4, 2, 4, 2)); } } mainToolbar.setBorder(BorderFactory.createEmptyBorder(3, 1, 3, 1)); return mainToolbar; }
From source file:tvbrowser.extras.reminderplugin.ReminderSettingsTab.java
/** * Creates the settings panel for this tab. *//*from w ww. j av a 2 s . com*/ public JPanel createSettingsPanel() { FormLayout layout = new FormLayout("5dlu,pref,5dlu,pref,pref:grow,3dlu,pref,3dlu,pref,5dlu", "pref,5dlu,pref,1dlu,pref,1dlu,pref,1dlu,pref,10dlu,pref,5dlu," + "pref,10dlu,pref,5dlu,pref,10dlu,pref,5dlu,pref,10dlu," + "pref,5dlu,pref,3dlu,pref,10dlu,pref,5dlu,pref"); layout.setColumnGroups(new int[][] { { 7, 9 } }); PanelBuilder pb = new PanelBuilder(layout, new ScrollableJPanel()); pb.setDefaultDialogBorder(); CellConstraints cc = new CellConstraints(); final String[] extArr = { ".wav", ".aif", ".rmf", ".au", ".mid" }; String soundFName = mSettings.getProperty("soundfile", "/"); String msg = mLocalizer.msg("soundFileFilter", "Sound file ({0})", "*" + StringUtils.join(extArr, ", *")); mReminderWindowChB = new JCheckBox(mLocalizer.msg("reminderWindow", "Reminder window"), mSettings.getProperty("usemsgbox", "false").equalsIgnoreCase("true")); mShowAlwaysOnTop = new JCheckBox(mLocalizer.msg("alwaysOnTop", "Show always on top"), mSettings.getProperty("alwaysOnTop", "true").equalsIgnoreCase("true")); mShowAlwaysOnTop.setEnabled(mReminderWindowChB.isSelected()); JPanel reminderWindowCfg = new JPanel(new FormLayout("12dlu,default:grow", "pref,1dlu,pref")); reminderWindowCfg.add(mReminderWindowChB, cc.xyw(1, 1, 2)); reminderWindowCfg.add(mShowAlwaysOnTop, cc.xy(2, 3)); mSoundFileChB = new FileCheckBox(mLocalizer.msg("playlingSound", "Play sound"), new File(soundFName), 0, false); JFileChooser soundChooser = new JFileChooser((String) null); soundChooser.setFileFilter(new ExtensionFileFilter(extArr, msg)); mSoundFileChB.setFileChooser(soundChooser); mSoundFileChB.setSelected(mSettings.getProperty("usesound", "false").equals("true")); mBeep = new JCheckBox(mLocalizer.msg("beep", "Speaker sound"), mSettings.getProperty("usebeep", "true").equalsIgnoreCase("true")); mExecFileStr = mSettings.getProperty("execfile", ""); mExecParamStr = mSettings.getProperty("execparam", ""); final JButton soundTestBt = new JButton(mLocalizer.msg("test", "Test")); mExecChB = new JCheckBox(mLocalizer.msg("executeProgram", "Execute program")); mExecChB.setSelected(mSettings.getProperty("useexec", "false").equals("true")); mExecFileDialogBtn = new JButton(mLocalizer.msg("executeConfig", "Configure")); mExecFileDialogBtn.setEnabled(mExecChB.isSelected()); mPluginLabel = new JLabel(); JButton choose = new JButton(mLocalizer.msg("selectPlugins", "Choose Plugins")); mClientPluginTargets = ReminderPlugin.getInstance().getClientPluginsTargets(); handlePluginSelection(); choose.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { Window parent = UiUtilities.getLastModalChildOf(MainFrame.getInstance()); PluginChooserDlg chooser = null; chooser = new PluginChooserDlg(parent, mClientPluginTargets, null, ReminderPluginProxy.getInstance()); chooser.setLocationRelativeTo(parent); chooser.setVisible(true); if (chooser.getReceiveTargets() != null) { mClientPluginTargets = chooser.getReceiveTargets(); } handlePluginSelection(); } catch (Exception ee) { ee.printStackTrace(); } } }); int autoCloseReminderTime = 10; try { String asString = mSettings.getProperty("autoCloseReminderTime", "10"); autoCloseReminderTime = Integer.parseInt(asString); if (autoCloseReminderTime == 0) { autoCloseReminderTime = 10; } } catch (Exception exc) { // ignore } mCloseOnEnd = new JRadioButton(mLocalizer.msg("autoCloseReminderAtProgramEnd", "Program end"), mSettings.getProperty("autoCloseBehaviour", "onEnd").equals("onEnd")); mCloseOnEnd.setEnabled(mReminderWindowChB.isSelected()); mCloseNever = new JRadioButton(mLocalizer.msg("autoCloseNever", "Never close"), mSettings.getProperty("autoCloseBehaviour", "onEnd").equals("never")); mCloseNever.setEnabled(mReminderWindowChB.isSelected()); mCloseOnTime = new JRadioButton(mLocalizer.ellipsisMsg("autoCloseAfterTime", "After time"), mSettings.getProperty("autoCloseBehaviour", "onEnd").equals("onTime")); mCloseOnTime.setEnabled(mReminderWindowChB.isSelected()); ButtonGroup bg = new ButtonGroup(); bg.add(mCloseOnEnd); bg.add(mCloseNever); bg.add(mCloseOnTime); mAutoCloseReminderTimeSp = new JSpinner( new SpinnerNumberModel(autoCloseReminderTime, autoCloseReminderTime < 5 ? 1 : 5, 600, 1)); mAutoCloseReminderTimeSp.setEnabled(mCloseOnTime.isSelected() && mReminderWindowChB.isSelected()); mShowTimeCounter = new JCheckBox(mLocalizer.msg("showTimeCounter", "Show time counter"), mSettings.getProperty("showTimeCounter", "false").compareTo("true") == 0); mShowTimeCounter.setEnabled(!mCloseNever.isSelected() && mReminderWindowChB.isSelected()); PanelBuilder autoClosePanel = new PanelBuilder( new FormLayout("12dlu,default,2dlu,default:grow", "pref,2dlu,pref,2dlu,pref,2dlu,pref,10dlu,pref")); autoClosePanel.add(mCloseOnEnd, cc.xyw(1, 1, 4)); autoClosePanel.add(mCloseNever, cc.xyw(1, 3, 4)); autoClosePanel.add(mCloseOnTime, cc.xyw(1, 5, 4)); autoClosePanel.add(mAutoCloseReminderTimeSp, cc.xy(2, 7)); final JLabel secondsLabel = autoClosePanel.addLabel(mLocalizer.msg("seconds", "seconds (0 = off)"), cc.xy(4, 7)); autoClosePanel.add(mShowTimeCounter, cc.xyw(1, 9, 4)); secondsLabel.setEnabled(mCloseOnTime.isSelected() && mReminderWindowChB.isSelected()); String defaultReminderEntryStr = (String) mSettings.get("defaultReminderEntry"); mDefaultReminderEntryList = new JComboBox(ReminderDialog.SMALL_REMIND_MSG_ARR); if (defaultReminderEntryStr != null) { try { int inx = Integer.parseInt(defaultReminderEntryStr); if (inx < ReminderDialog.SMALL_REMIND_MSG_ARR.length) { mDefaultReminderEntryList.setSelectedIndex(inx); } } catch (NumberFormatException e) { // ignore } } mShowTimeSelectionDlg = new JCheckBox( mLocalizer.msg("showTimeSelectionDialog", "Show time selection dialog")); mShowTimeSelectionDlg .setSelected(mSettings.getProperty("showTimeSelectionDialog", "true").compareTo("true") == 0); mShowRemovedDlg = new JCheckBox( mLocalizer.msg("showRemovedDialog", "Show removed reminders after data update")); mShowRemovedDlg.setSelected(mSettings.getProperty("showRemovedDialog", "true").compareTo("true") == 0); pb.addSeparator(mLocalizer.msg("remindBy", "Remind me by"), cc.xyw(1, 1, 10)); pb.add(reminderWindowCfg, cc.xyw(2, 3, 4)); pb.add(mSoundFileChB, cc.xyw(2, 5, 4)); pb.add(mSoundFileChB.getButton(), cc.xy(7, 5)); pb.add(soundTestBt, cc.xy(9, 5)); pb.add(mBeep, cc.xy(2, 7)); pb.add(mExecChB, cc.xyw(2, 9, 4)); pb.add(mExecFileDialogBtn, cc.xyw(7, 9, 3)); pb.addSeparator(mLocalizer.msg("sendToPlugin", "Send reminded program to"), cc.xyw(1, 11, 10)); pb.add(mPluginLabel, cc.xyw(2, 13, 4)); pb.add(choose, cc.xyw(7, 13, 3)); final JLabel c = (JLabel) pb .addSeparator(mLocalizer.msg("autoCloseReminder", "Automatically close reminder"), cc.xyw(1, 15, 10)) .getComponent(0); c.setEnabled(mReminderWindowChB.isSelected()); pb.add(autoClosePanel.getPanel(), cc.xyw(2, 17, 5)); JPanel reminderEntry = new JPanel(new FlowLayout(FlowLayout.LEADING, 0, 0)); reminderEntry.add(mDefaultReminderEntryList); pb.addSeparator(mLocalizer.msg("defaltReminderEntry", "Default reminder time"), cc.xyw(1, 19, 10)); pb.add(reminderEntry, cc.xyw(2, 21, 4)); pb.addSeparator(mLocalizer.msg("miscSettings", "Misc settings"), cc.xyw(1, 23, 10)); pb.add(mShowTimeSelectionDlg, cc.xyw(2, 25, 7)); pb.add(mShowRemovedDlg, cc.xyw(2, 27, 7)); pb.addSeparator(DefaultMarkingPrioritySelectionPanel.getTitle(), cc.xyw(1, 29, 10)); pb.add(mMarkingsPanel = DefaultMarkingPrioritySelectionPanel .createPanel(ReminderPlugin.getInstance().getMarkPriority(), false, false), cc.xyw(2, 31, 9)); mReminderWindowChB.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { mShowAlwaysOnTop.setEnabled(e.getStateChange() == ItemEvent.SELECTED); c.setEnabled(e.getStateChange() == ItemEvent.SELECTED); secondsLabel.setEnabled(e.getStateChange() == ItemEvent.SELECTED && mCloseOnTime.isSelected()); mCloseOnEnd.setEnabled(e.getStateChange() == ItemEvent.SELECTED); mCloseNever.setEnabled(e.getStateChange() == ItemEvent.SELECTED); mCloseOnTime.setEnabled(e.getStateChange() == ItemEvent.SELECTED); mShowTimeCounter.setEnabled(e.getStateChange() == ItemEvent.SELECTED && !mCloseNever.isSelected()); mAutoCloseReminderTimeSp .setEnabled(e.getStateChange() == ItemEvent.SELECTED && mCloseOnTime.isSelected()); } }); soundTestBt.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (evt.getActionCommand().compareTo(mLocalizer.msg("test", "Test")) == 0) { mTestSound = ReminderPlugin.playSound(mSoundFileChB.getTextField().getText()); if (mTestSound != null) { soundTestBt.setText(mLocalizer.msg("stop", "Stop")); } if (mTestSound != null) { if (mTestSound instanceof SourceDataLine) { ((SourceDataLine) mTestSound).addLineListener(new LineListener() { public void update(LineEvent event) { if (event.getType() == Type.CLOSE) { soundTestBt.setText(mLocalizer.msg("test", "Test")); } } }); } else if (mTestSound instanceof Sequencer) { new Thread("Test MIDI sound") { public void run() { setPriority(Thread.MIN_PRIORITY); while (((Sequencer) mTestSound).isRunning()) { try { Thread.sleep(100); } catch (Exception ee) { } } soundTestBt.setText(mLocalizer.msg("test", "Test")); } }.start(); } } } else if (mTestSound != null) { if (mTestSound instanceof SourceDataLine && ((SourceDataLine) mTestSound).isRunning()) { ((SourceDataLine) mTestSound).stop(); } else if (mTestSound instanceof Sequencer && ((Sequencer) mTestSound).isRunning()) { ((Sequencer) mTestSound).stop(); } } } }); mSoundFileChB.getCheckBox().addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { soundTestBt.setEnabled(mSoundFileChB.isSelected()); } }); mSoundFileChB.getTextField().addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { String text = mSoundFileChB.getTextField().getText(); if ((new File(text)).isFile()) { boolean notFound = true; for (String extension : extArr) { if (StringUtils.endsWithIgnoreCase(text, extension)) { notFound = false; break; } } if (notFound) { soundTestBt.setEnabled(false); } else { soundTestBt.setEnabled(true); } } else { soundTestBt.setEnabled(false); } } }); mSoundFileChB.getTextField().getKeyListeners()[0].keyReleased(null); mExecChB.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { mExecFileDialogBtn.setEnabled(mExecChB.isSelected()); if (mExecFileDialogBtn.isEnabled()) { showFileSettingsDialog(); } } }); mExecFileDialogBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { showFileSettingsDialog(); } }); ItemListener autoCloseListener = new ItemListener() { public void itemStateChanged(ItemEvent e) { mAutoCloseReminderTimeSp.setEnabled(mCloseOnTime.isSelected()); secondsLabel.setEnabled(mCloseOnTime.isSelected()); mShowTimeCounter.setEnabled(mCloseOnTime.isSelected() || mCloseOnEnd.isSelected()); } }; mCloseOnEnd.addItemListener(autoCloseListener); mCloseOnTime.addItemListener(autoCloseListener); mCloseOnTime.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { mShowTimeCounter.setEnabled(e.getStateChange() == ItemEvent.SELECTED); } }); JScrollPane scrollPane = new JScrollPane(pb.getPanel()); scrollPane.setBorder(null); scrollPane.setViewportBorder(null); JPanel scrollPanel = new JPanel(new FormLayout("default:grow", "default")); scrollPanel.add(scrollPane, cc.xy(1, 1)); return scrollPanel; }
From source file:net.pms.encoders.MEncoderVideo.java
@Override public JComponent config() { // Apply the orientation for the locale Locale locale = new Locale(configuration.getLanguage()); ComponentOrientation orientation = ComponentOrientation.getOrientation(locale); String colSpec = FormLayoutUtil.getColSpec(COL_SPEC, orientation); FormLayout layout = new FormLayout(colSpec, ROW_SPEC); PanelBuilder builder = new PanelBuilder(layout); builder.setBorder(Borders.EMPTY_BORDER); builder.setOpaque(false);/*from w w w . j a v a2 s . c o m*/ CellConstraints cc = new CellConstraints(); checkBox = new JCheckBox(Messages.getString("MEncoderVideo.0")); checkBox.setContentAreaFilled(false); if (configuration.getSkipLoopFilterEnabled()) { checkBox.setSelected(true); } checkBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setSkipLoopFilterEnabled((e.getStateChange() == ItemEvent.SELECTED)); } }); JComponent cmp = builder.addSeparator(Messages.getString("NetworkTab.5"), FormLayoutUtil.flip(cc.xyw(1, 1, 15), colSpec, orientation)); cmp = (JComponent) cmp.getComponent(0); cmp.setFont(cmp.getFont().deriveFont(Font.BOLD)); mencodermt = new JCheckBox(Messages.getString("MEncoderVideo.35")); mencodermt.setContentAreaFilled(false); if (configuration.getMencoderMT()) { mencodermt.setSelected(true); } mencodermt.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { configuration.setMencoderMT(mencodermt.isSelected()); } }); mencodermt.setEnabled(Platform.isWindows() || Platform.isMac()); builder.add(mencodermt, FormLayoutUtil.flip(cc.xy(1, 3), colSpec, orientation)); builder.add(checkBox, FormLayoutUtil.flip(cc.xyw(3, 3, 12), colSpec, orientation)); noskip = new JCheckBox(Messages.getString("MEncoderVideo.2")); noskip.setContentAreaFilled(false); if (configuration.isMencoderNoOutOfSync()) { noskip.setSelected(true); } noskip.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setMencoderNoOutOfSync((e.getStateChange() == ItemEvent.SELECTED)); } }); builder.add(noskip, FormLayoutUtil.flip(cc.xy(1, 5), colSpec, orientation)); JButton button = new JButton(Messages.getString("MEncoderVideo.29")); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JPanel codecPanel = new JPanel(new BorderLayout()); final JTextArea textArea = new JTextArea(); textArea.setText(configuration.getMencoderCodecSpecificConfig()); textArea.setFont(new Font("Courier", Font.PLAIN, 12)); JScrollPane scrollPane = new JScrollPane(textArea); scrollPane.setPreferredSize(new java.awt.Dimension(900, 100)); final JTextArea textAreaDefault = new JTextArea(); textAreaDefault.setText(DEFAULT_CODEC_CONF_SCRIPT); textAreaDefault.setBackground(Color.WHITE); textAreaDefault.setFont(new Font("Courier", Font.PLAIN, 12)); textAreaDefault.setEditable(false); textAreaDefault.setEnabled(configuration.isMencoderIntelligentSync()); JScrollPane scrollPaneDefault = new JScrollPane(textAreaDefault); scrollPaneDefault.setPreferredSize(new java.awt.Dimension(900, 450)); JPanel customPanel = new JPanel(new BorderLayout()); intelligentsync = new JCheckBox(Messages.getString("MEncoderVideo.3")); intelligentsync.setContentAreaFilled(false); if (configuration.isMencoderIntelligentSync()) { intelligentsync.setSelected(true); } intelligentsync.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setMencoderIntelligentSync((e.getStateChange() == ItemEvent.SELECTED)); textAreaDefault.setEnabled(configuration.isMencoderIntelligentSync()); } }); JLabel label = new JLabel(Messages.getString("MEncoderVideo.33")); customPanel.add(label, BorderLayout.NORTH); customPanel.add(scrollPane, BorderLayout.SOUTH); codecPanel.add(intelligentsync, BorderLayout.NORTH); codecPanel.add(scrollPaneDefault, BorderLayout.CENTER); codecPanel.add(customPanel, BorderLayout.SOUTH); while (JOptionPane.showOptionDialog( SwingUtilities.getWindowAncestor((Component) PMS.get().getFrame()), codecPanel, Messages.getString("MEncoderVideo.34"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, null, null) == JOptionPane.OK_OPTION) { String newCodecparam = textArea.getText(); DLNAMediaInfo fakemedia = new DLNAMediaInfo(); DLNAMediaAudio audio = new DLNAMediaAudio(); audio.setCodecA("ac3"); fakemedia.setCodecV("mpeg4"); fakemedia.setContainer("matroska"); fakemedia.setDuration(45d * 60); audio.getAudioProperties().setNumberOfChannels(2); fakemedia.setWidth(1280); fakemedia.setHeight(720); audio.setSampleFrequency("48000"); fakemedia.setFrameRate("23.976"); fakemedia.getAudioTracksList().add(audio); String result[] = getSpecificCodecOptions(newCodecparam, fakemedia, new OutputParams(configuration), "dummy.mpg", "dummy.srt", false, true); if (result.length > 0 && result[0].startsWith("@@")) { String errorMessage = result[0].substring(2); JOptionPane.showMessageDialog( SwingUtilities.getWindowAncestor((Component) PMS.get().getFrame()), errorMessage, Messages.getString("Dialog.Error"), JOptionPane.ERROR_MESSAGE); } else { configuration.setMencoderCodecSpecificConfig(newCodecparam); break; } } } }); builder.add(button, FormLayoutUtil.flip(cc.xy(1, 11), colSpec, orientation)); forcefps = new JCheckBox(Messages.getString("MEncoderVideo.4")); forcefps.setContentAreaFilled(false); if (configuration.isMencoderForceFps()) { forcefps.setSelected(true); } forcefps.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setMencoderForceFps(e.getStateChange() == ItemEvent.SELECTED); } }); builder.add(forcefps, FormLayoutUtil.flip(cc.xyw(1, 7, 2), colSpec, orientation)); yadif = new JCheckBox(Messages.getString("MEncoderVideo.26")); yadif.setContentAreaFilled(false); if (configuration.isMencoderYadif()) { yadif.setSelected(true); } yadif.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setMencoderYadif(e.getStateChange() == ItemEvent.SELECTED); } }); builder.add(yadif, FormLayoutUtil.flip(cc.xyw(3, 7, 7), colSpec, orientation)); scaler = new JCheckBox(Messages.getString("MEncoderVideo.27")); scaler.setContentAreaFilled(false); scaler.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setMencoderScaler(e.getStateChange() == ItemEvent.SELECTED); scaleX.setEnabled(configuration.isMencoderScaler()); scaleY.setEnabled(configuration.isMencoderScaler()); } }); builder.add(scaler, FormLayoutUtil.flip(cc.xyw(3, 5, 7), colSpec, orientation)); builder.addLabel(Messages.getString("MEncoderVideo.28"), FormLayoutUtil .flip(cc.xy(9, 5, CellConstraints.RIGHT, CellConstraints.CENTER), colSpec, orientation)); scaleX = new JTextField("" + configuration.getMencoderScaleX()); scaleX.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { try { configuration.setMencoderScaleX(Integer.parseInt(scaleX.getText())); } catch (NumberFormatException nfe) { logger.debug("Could not parse scaleX from \"" + scaleX.getText() + "\""); } } }); builder.add(scaleX, FormLayoutUtil.flip(cc.xy(11, 5), colSpec, orientation)); builder.addLabel(Messages.getString("MEncoderVideo.30"), FormLayoutUtil .flip(cc.xy(13, 5, CellConstraints.RIGHT, CellConstraints.CENTER), colSpec, orientation)); scaleY = new JTextField("" + configuration.getMencoderScaleY()); scaleY.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { try { configuration.setMencoderScaleY(Integer.parseInt(scaleY.getText())); } catch (NumberFormatException nfe) { logger.debug("Could not parse scaleY from \"" + scaleY.getText() + "\""); } } }); builder.add(scaleY, FormLayoutUtil.flip(cc.xy(15, 5), colSpec, orientation)); if (configuration.isMencoderScaler()) { scaler.setSelected(true); } else { scaleX.setEnabled(false); scaleY.setEnabled(false); } builder.addLabel(Messages.getString("MEncoderVideo.6"), FormLayoutUtil.flip(cc.xy(1, 13), colSpec, orientation)); mencoder_custom_options = new JTextField(configuration.getMencoderCustomOptions()); mencoder_custom_options.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { configuration.setMencoderCustomOptions(mencoder_custom_options.getText()); } }); builder.add(mencoder_custom_options, FormLayoutUtil.flip(cc.xyw(3, 13, 13), colSpec, orientation)); builder.addLabel(Messages.getString("MEncoderVideo.93"), FormLayoutUtil.flip(cc.xy(1, 15), colSpec, orientation)); builder.addLabel(Messages.getString("MEncoderVideo.28") + " (%)", FormLayoutUtil .flip(cc.xy(1, 15, CellConstraints.RIGHT, CellConstraints.CENTER), colSpec, orientation)); ocw = new JTextField(configuration.getMencoderOverscanCompensationWidth()); ocw.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { configuration.setMencoderOverscanCompensationWidth(ocw.getText()); } }); builder.add(ocw, FormLayoutUtil.flip(cc.xy(3, 15), colSpec, orientation)); builder.addLabel(Messages.getString("MEncoderVideo.30") + " (%)", FormLayoutUtil.flip(cc.xy(5, 15), colSpec, orientation)); och = new JTextField(configuration.getMencoderOverscanCompensationHeight()); och.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { configuration.setMencoderOverscanCompensationHeight(och.getText()); } }); builder.add(och, FormLayoutUtil.flip(cc.xy(7, 15), colSpec, orientation)); cmp = builder.addSeparator(Messages.getString("MEncoderVideo.8"), FormLayoutUtil.flip(cc.xyw(1, 17, 15), colSpec, orientation)); cmp = (JComponent) cmp.getComponent(0); cmp.setFont(cmp.getFont().deriveFont(Font.BOLD)); builder.addLabel(Messages.getString("MEncoderVideo.16"), FormLayoutUtil .flip(cc.xy(1, 27, CellConstraints.RIGHT, CellConstraints.CENTER), colSpec, orientation)); mencoder_noass_scale = new JTextField(configuration.getMencoderNoAssScale()); mencoder_noass_scale.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { configuration.setMencoderNoAssScale(mencoder_noass_scale.getText()); } }); builder.addLabel(Messages.getString("MEncoderVideo.17"), FormLayoutUtil.flip(cc.xy(5, 27), colSpec, orientation)); mencoder_noass_outline = new JTextField(configuration.getMencoderNoAssOutline()); mencoder_noass_outline.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { configuration.setMencoderNoAssOutline(mencoder_noass_outline.getText()); } }); builder.addLabel(Messages.getString("MEncoderVideo.18"), FormLayoutUtil.flip(cc.xy(9, 27), colSpec, orientation)); mencoder_noass_blur = new JTextField(configuration.getMencoderNoAssBlur()); mencoder_noass_blur.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { configuration.setMencoderNoAssBlur(mencoder_noass_blur.getText()); } }); builder.addLabel(Messages.getString("MEncoderVideo.19"), FormLayoutUtil.flip(cc.xy(13, 27), colSpec, orientation)); mencoder_noass_subpos = new JTextField(configuration.getMencoderNoAssSubPos()); mencoder_noass_subpos.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { configuration.setMencoderNoAssSubPos(mencoder_noass_subpos.getText()); } }); builder.add(mencoder_noass_scale, FormLayoutUtil.flip(cc.xy(3, 27), colSpec, orientation)); builder.add(mencoder_noass_outline, FormLayoutUtil.flip(cc.xy(7, 27), colSpec, orientation)); builder.add(mencoder_noass_blur, FormLayoutUtil.flip(cc.xy(11, 27), colSpec, orientation)); builder.add(mencoder_noass_subpos, FormLayoutUtil.flip(cc.xy(15, 27), colSpec, orientation)); ass = new JCheckBox(Messages.getString("MEncoderVideo.20")); ass.setContentAreaFilled(false); ass.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e != null) { configuration.setMencoderAss(e.getStateChange() == ItemEvent.SELECTED); } } }); builder.add(ass, FormLayoutUtil.flip(cc.xy(1, 23), colSpec, orientation)); ass.setSelected(configuration.isMencoderAss()); ass.getItemListeners()[0].itemStateChanged(null); fc = new JCheckBox(Messages.getString("MEncoderVideo.21")); fc.setContentAreaFilled(false); fc.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setMencoderFontConfig(e.getStateChange() == ItemEvent.SELECTED); } }); builder.add(fc, FormLayoutUtil.flip(cc.xyw(3, 23, 5), colSpec, orientation)); fc.setSelected(configuration.isMencoderFontConfig()); assdefaultstyle = new JCheckBox(Messages.getString("MEncoderVideo.36")); assdefaultstyle.setContentAreaFilled(false); assdefaultstyle.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setMencoderAssDefaultStyle(e.getStateChange() == ItemEvent.SELECTED); } }); builder.add(assdefaultstyle, FormLayoutUtil.flip(cc.xyw(8, 23, 4), colSpec, orientation)); assdefaultstyle.setSelected(configuration.isMencoderAssDefaultStyle()); builder.addLabel(Messages.getString("MEncoderVideo.92"), FormLayoutUtil.flip(cc.xy(1, 29), colSpec, orientation)); subq = new JTextField(configuration.getMencoderVobsubSubtitleQuality()); subq.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { configuration.setMencoderVobsubSubtitleQuality(subq.getText()); } }); builder.add(subq, FormLayoutUtil.flip(cc.xyw(3, 29, 1), colSpec, orientation)); configuration.addConfigurationListener(new ConfigurationListener() { @Override public void configurationChanged(ConfigurationEvent event) { if (event.getPropertyName() == null) { return; } if ((!event.isBeforeUpdate()) && event.getPropertyName().equals(PmsConfiguration.KEY_DISABLE_SUBTITLES)) { boolean enabled = !configuration.isDisableSubtitles(); ass.setEnabled(enabled); assdefaultstyle.setEnabled(enabled); fc.setEnabled(enabled); mencoder_noass_scale.setEnabled(enabled); mencoder_noass_outline.setEnabled(enabled); mencoder_noass_blur.setEnabled(enabled); mencoder_noass_subpos.setEnabled(enabled); ocw.setEnabled(enabled); och.setEnabled(enabled); subq.setEnabled(enabled); if (enabled) { ass.getItemListeners()[0].itemStateChanged(null); } } } }); JPanel panel = builder.getPanel(); // Apply the orientation to the panel and all components in it panel.applyComponentOrientation(orientation); return panel; }
From source file:edu.ku.brc.specify.datamodel.busrules.DeterminationBusRules.java
@Override public void initialize(Viewable viewableArg) { super.initialize(viewableArg); if (formViewObj != null) { GetSetValueIFace taxonField = (GetSetValueIFace) formViewObj.getControlByName("taxon"); if (taxonField instanceof ValComboBoxFromQuery) { final ValComboBoxFromQuery parentCBX = (ValComboBoxFromQuery) taxonField; final Component altNameComp = formViewObj.getControlByName("alternateName"); if (nameChangeKL == null) { nameChangeKL = new KeyAdapter() { @Override/*from ww w .j av a 2 s .c o m*/ public void keyTyped(final KeyEvent e) { SwingUtilities.invokeLater(new Runnable() { // @Override public void run() { nameChanged(e, parentCBX, altNameComp); } }); } }; } if (parentCBX != null) { parentCBX.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (e == null || !e.getValueIsAdjusting()) { taxonChanged(parentCBX, altNameComp); } } }); addListenerIfNecessary(nameChangeKL, parentCBX); } if (altNameComp != null) { addListenerIfNecessary(nameChangeKL, altNameComp); } } } }
From source file:at.becast.youploader.gui.FrmMain.java
public void initMainTab() { cmbCategory = new JComboBox<Categories>(); cmbCategory.setModel(new DefaultComboBoxModel<Categories>(Categories.values())); SideBar sideBar = new SideBar(SideBar.SideBarMode.TOP_LEVEL, true, 300, true); ss1 = new SidebarSection(sideBar, LANG.getString("frmMain.Sidebar.Settings"), new EditPanel(this), new ImageIcon(getClass().getResource("/pencil.png"))); ss2 = new SidebarSection(sideBar, LANG.getString("frmMain.Sidebar.Playlists"), new PlaylistPanel(this), new ImageIcon(getClass().getResource("/layers.png"))); ss3 = new SidebarSection(sideBar, LANG.getString("frmMain.Sidebar.Monetisation"), new MonetPanel(), new ImageIcon(getClass().getResource("/money.png"))); sideBar.addSection(ss1, false);/*from w w w.ja va2 s .c o m*/ sideBar.addSection(ss2); sideBar.addSection(ss3); JPanel mainTab = new JPanel(); JPanel panel = new JPanel(); GroupLayout mainTabLayout = new GroupLayout(mainTab); mainTabLayout.setHorizontalGroup(mainTabLayout.createParallelGroup(Alignment.TRAILING) .addGroup(mainTabLayout.createSequentialGroup() .addComponent(panel, GroupLayout.DEFAULT_SIZE, 465, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(sideBar, GroupLayout.DEFAULT_SIZE, 408, Short.MAX_VALUE))); mainTabLayout.setVerticalGroup(mainTabLayout.createParallelGroup(Alignment.LEADING) .addComponent(panel, GroupLayout.DEFAULT_SIZE, 492, Short.MAX_VALUE) .addGroup(mainTabLayout.createSequentialGroup() .addComponent(sideBar, GroupLayout.DEFAULT_SIZE, 469, Short.MAX_VALUE).addContainerGap())); panel.setLayout(new FormLayout( new ColumnSpec[] { ColumnSpec.decode("2px"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("20px:grow"), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("23px"), ColumnSpec.decode("33px"), FormSpecs.UNRELATED_GAP_COLSPEC, ColumnSpec.decode("61px"), FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("24px"), ColumnSpec.decode("28px"), ColumnSpec.decode("40px"), ColumnSpec.decode("36px"), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("28px"), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("58px"), }, new RowSpec[] { RowSpec.decode("2px"), FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("14px"), RowSpec.decode("25px"), FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("14px"), RowSpec.decode("25px"), FormSpecs.LINE_GAP_ROWSPEC, RowSpec.decode("14px"), RowSpec.decode("25px"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, RowSpec.decode("64dlu:grow"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, RowSpec.decode("max(64dlu;default)"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, RowSpec.decode("25px"), FormSpecs.PARAGRAPH_GAP_ROWSPEC, RowSpec.decode("24px"), RowSpec.decode("23px"), })); lbltitlelenght = new JLabel("(0/100)"); panel.add(lbltitlelenght, "14, 6, 3, 1, right, top"); txtTitle = new JTextField(); contextMenu.add(txtTitle); panel.add(txtTitle, "3, 7, 14, 1, fill, fill"); txtTitle.setColumns(10); txtTitle.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { calcNotifies(); } }); JLabel lblCategory = new JLabel(LANG.getString("frmMain.Category")); panel.add(lblCategory, "3, 9, 4, 1, left, bottom"); panel.add(cmbCategory, "3, 10, 14, 1, fill, fill"); JLabel lblDescription = new JLabel(LANG.getString("frmMain.Description")); panel.add(lblDescription, "3, 12, 4, 1, left, bottom"); lblDesclenght = new JLabel("(0/5000)"); panel.add(lblDesclenght, "14, 12, 3, 1, right, bottom"); JScrollPane DescriptionScrollPane = new JScrollPane(); panel.add(DescriptionScrollPane, "3, 13, 14, 1, fill, fill"); txtDescription = new JTextArea(); contextMenu.add(txtDescription); txtDescription.setFont(new Font("SansSerif", Font.PLAIN, 13)); DescriptionScrollPane.setViewportView(txtDescription); txtDescription.setWrapStyleWord(true); txtDescription.setLineWrap(true); txtDescription.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { calcNotifies(); } }); JLabel lblTags = new JLabel(LANG.getString("frmMain.Tags")); panel.add(lblTags, "3, 15, 4, 1, left, bottom"); lblTagslenght = new JLabel("(0/500)"); panel.add(lblTagslenght, "14, 15, 3, 1, right, top"); JScrollPane TagScrollPane = new JScrollPane(); panel.add(TagScrollPane, "3, 16, 14, 1, fill, fill"); txtTags = new JTextArea(); contextMenu.add(txtTags); txtTags.setFont(new Font("SansSerif", Font.PLAIN, 13)); TagScrollPane.setViewportView(txtTags); txtTags.setWrapStyleWord(true); txtTags.setLineWrap(true); txtTags.setBorder(BorderFactory.createEtchedBorder()); txtTags.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { calcNotifies(); } }); JLabel lblAccount = new JLabel(LANG.getString("frmMain.Account")); panel.add(lblAccount, "3, 18, 4, 1, left, bottom"); cmbAccount = new JComboBox<AccountType>(); panel.add(getCmbAccount(), "3, 19, 14, 1, fill, fill"); cmbAccount.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { changeUser(); } }); btnAddToQueue = new JButton(LANG.getString("frmMain.addtoQueue")); btnAddToQueue.setEnabled(false); panel.add(btnAddToQueue, "3, 21, 6, 1, fill, fill"); btnAddToQueue.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { queueButton(); } }); JLabel lblSelectVideo = new JLabel(); panel.add(lblSelectVideo, "3, 3, 4, 1, left, bottom"); lblSelectVideo.setText(LANG.getString("frmMain.selectVideoFile")); cmbFile = new JComboBox<String>(); cmbFile.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) { cmbFile.removeAllItems(); cmbFile.addItem(file.getAbsolutePath()); } } catch (Exception ex) { LOG.error("Error dropping video file", ex); } } }); panel.add(cmbFile, "3, 4, 14, 1, fill, fill"); JButton btnSelectMovie = new JButton(); btnSelectMovie.setToolTipText("Select Video File"); panel.add(btnSelectMovie, "18, 4, center, top"); btnSelectMovie.setIcon(new ImageIcon(getClass().getResource("/film_add.png"))); JLabel lblTitle = new JLabel(LANG.getString("frmMain.Title")); panel.add(lblTitle, "3, 6, 4, 1, left, bottom"); JButton btnReset = new JButton(LANG.getString("frmMain.Reset")); btnReset.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { resetEdit(); } }); panel.add(btnReset, "11, 21, 6, 1, fill, fill"); btnSelectMovie.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { EditPanel edit = (EditPanel) ss1.contentPane; NativeJFileChooser chooser; if (edit.getTxtStartDir() != null && !edit.getTxtStartDir().equals("")) { chooser = new NativeJFileChooser(edit.getTxtStartDir().getText().trim()); } else { chooser = new NativeJFileChooser(); } int returnVal = chooser.showOpenDialog((Component) self); if (returnVal == JFileChooser.APPROVE_OPTION) { cmbFile.removeAllItems(); cmbFile.addItem(chooser.getSelectedFile().getAbsolutePath().toString()); } } }); mainTab.setLayout(mainTabLayout); mainTab.revalidate(); mainTab.repaint(); TabbedPane.addTab(LANG.getString("frmMain.Tabs.VideoSettings"), mainTab); }