@Override
 public JComponent getPreferredFocusedComponent() {
   if (myNameField.getText().length() == 0) {
     return myNameField;
   } else if (myValueField.isVisible()) {
     return myValueField;
   } else if (myModuleCombo.isVisible()) {
     return myModuleCombo;
   } else {
     return myFileNameCombo;
   }
 }
Exemplo n.º 2
0
  private void renameSelectedItem(int index) {
    if (!_textName.isVisible() || _textName.getText().trim().length() == 0) {
      return;
    }

    Playlist selectedPlaylist = getSelectedPlaylist();

    selectedPlaylist.setName(_textName.getText().trim());
    selectedPlaylist.save();

    _list.repaint();
    _textName.setVisible(false);
  }
Exemplo n.º 3
0
  private void createNewPlaylist() {
    if (!_textName.isVisible()) {
      return;
    }

    String name = _textName.getText();

    Library library = LibraryMediator.getLibrary();

    Playlist playlist = library.newPlaylist(name, name);
    playlist.save();
    LibraryPlaylistsListCell cell =
        new LibraryPlaylistsListCell(
            null, null, GUIMediator.getThemeImage("playlist"), playlist, _selectedPlaylistAction);
    _model.addElement(cell);
    _list.setSelectedValue(cell, true);

    _textName.setVisible(false);
  }