use of com.limegroup.gnutella.gui.tables.DefaultMouseListener in project frostwire by frostwire.
the class LibraryExplorer method setupTree.
private void setupTree() {
tree = new LibraryIconTree(model);
tree.setRowHeight(TableSettings.DEFAULT_TABLE_ROW_HEIGHT.getValue());
tree.setRootVisible(false);
tree.setShowsRootHandles(false);
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
tree.setCellRenderer(new NodeRenderer());
tree.setDragEnabled(true);
tree.setTransferHandler(new LibraryFilesTransferHandler(tree));
((BasicTreeUI) tree.getUI()).setExpandedIcon(null);
((BasicTreeUI) tree.getUI()).setCollapsedIcon(null);
SkinPopupMenu popup = new SkinPopupMenu();
popup.add(new SkinMenuItem(refreshAction));
popup.add(new SkinMenuItem(exploreAction));
popup.add(new SkinMenuItem(new ConfigureOptionsAction(OptionsConstructor.SHARED_KEY, I18n.tr("Configure Options"), I18n.tr("You can configure the FrostWire\'s Options."))));
tree.addMouseListener(new DefaultMouseListener(new TreeMouseObserver(tree, popup)));
tree.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
if (LibraryUtils.isRefreshKeyEvent(e)) {
refreshSelection(true);
}
}
});
treeSelectionListener = new LibraryExplorerTreeSelectionListener();
tree.addTreeSelectionListener(treeSelectionListener);
ToolTipManager.sharedInstance().registerComponent(tree);
}
use of com.limegroup.gnutella.gui.tables.DefaultMouseListener in project frostwire by frostwire.
the class LibraryPlaylists method setupList.
private void setupList() {
LibraryPlaylistsMouseObserver _listMouseObserver = new LibraryPlaylistsMouseObserver();
listSelectionListener = new LibraryPlaylistsSelectionListener();
SortedListModel sortedModel = new SortedListModel(model, SortOrder.ASCENDING, new Comparator<LibraryPlaylistsListCell>() {
@Override
public int compare(LibraryPlaylistsListCell o1, LibraryPlaylistsListCell o2) {
if (o1 == newPlaylistCell || o1 == starredPlaylistCell) {
return -1;
}
if (o2 == newPlaylistCell || o2 == starredPlaylistCell) {
return 1;
}
return o1.getText().compareTo(o2.getText());
}
});
list = new LibraryIconList(sortedModel);
list.setFixedCellHeight(TableSettings.DEFAULT_TABLE_ROW_HEIGHT.getValue());
list.setCellRenderer(new LibraryPlaylistsCellRenderer());
list.addMouseListener(new DefaultMouseListener(_listMouseObserver));
list.addListSelectionListener(listSelectionListener);
list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
list.setLayoutOrientation(JList.VERTICAL);
list.setPrototypeCellValue(new LibraryPlaylistsListCell("test", "", GUIMediator.getThemeImage("playlist"), null, null));
list.setVisibleRowCount(-1);
list.setDragEnabled(true);
list.setTransferHandler(new LibraryPlaylistsTransferHandler(list));
ToolTipManager.sharedInstance().registerComponent(list);
list.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
list_keyPressed(e);
}
});
list.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() > 1) {
actionStartRename();
}
}
});
textName = new JTextField();
ThemeMediator.fixKeyStrokes(textName);
UIDefaults defaults = new UIDefaults();
defaults.put("TextField.contentMargins", new InsetsUIResource(0, 4, 0, 4));
textName.putClientProperty("Nimbus.Overrides.InheritDefaults", Boolean.TRUE);
textName.putClientProperty("Nimbus.Overrides", defaults);
textName.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
textName_keyPressed(e);
}
});
textName.setVisible(false);
list.add(textName);
}
Aggregations