Select several clients in the tree to move or kick them together
Desktop: Ctrl/Shift in the tree (ClientSelectionModel keeps a selection to
one row of any kind or several clients; a Shift range keeps its clients),
drag them onto a channel, or right-click for Kick Clients from Channel /
Server and Move Clients to own Channel. The selection survives rebuilds.
Android: long-press a client, tap more; a bar offers Move to…, Move to my
channel and both kicks (as far as we may), Back clears it.
Core sends one piped clientmove / clientkick. The server refuses the whole
pipe when one row fails ("already member of channel"), so it leaves out
clients already in the target, and for a channel kick those already in
the default channel, which the model now tracks (channel_flag_default).
Verified on a local 3.13.7 server with both frontends.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -42,10 +42,10 @@ final class ClientMenu {
|
||||
menu.add(complain);
|
||||
menu.addSeparator();
|
||||
JMenuItem kickChannel = new JMenuItem("Kick Client from Channel", Icons.of("KICK_FROM_CHANNEL"));
|
||||
kickChannel.addActionListener(a -> actions.kickClientFromChannel(client));
|
||||
kickChannel.addActionListener(a -> actions.kickClientsFromChannel(List.of(client)));
|
||||
menu.add(kickChannel);
|
||||
JMenuItem kickServer = new JMenuItem("Kick Client from Server", Icons.of("KICK_FROM_SERVER"));
|
||||
kickServer.addActionListener(a -> actions.kickClientFromServer(client));
|
||||
kickServer.addActionListener(a -> actions.kickClientsFromServer(List.of(client)));
|
||||
menu.add(kickServer);
|
||||
JMenuItem ban = new JMenuItem("Ban Client", Icons.of("BAN_CLIENT"));
|
||||
ban.addActionListener(a -> actions.banClient(client));
|
||||
@@ -93,12 +93,34 @@ final class ClientMenu {
|
||||
joinChannel.addActionListener(a -> actions.joinChannel(client.channelId));
|
||||
menu.add(joinChannel);
|
||||
JMenuItem moveHere = new JMenuItem("Move Client to own Channel", Icons.of("MOVE_CLIENT_TO_OWN_CHANNEL"));
|
||||
moveHere.addActionListener(a -> actions.moveClientToOwnChannel(client));
|
||||
moveHere.addActionListener(a -> actions.moveClientsToOwnChannel(List.of(client)));
|
||||
menu.add(moveHere);
|
||||
}
|
||||
return menu;
|
||||
}
|
||||
|
||||
/** The context menu for several clients selected together; we may be among them. */
|
||||
static JPopupMenu buildForMany(List<ClientEntry> clients, int selfId, ServerModel model,
|
||||
ServerTreePanel.Actions actions) {
|
||||
JPopupMenu menu = new JPopupMenu();
|
||||
boolean others = clients.stream().anyMatch(c -> c.id != selfId);
|
||||
int defaultChannel = model.defaultChannelId();
|
||||
JMenuItem kickChannel = new JMenuItem("Kick Clients from Channel", Icons.of("KICK_FROM_CHANNEL"));
|
||||
kickChannel.setEnabled(clients.stream().anyMatch(c -> c.id != selfId && c.channelId != defaultChannel));
|
||||
kickChannel.addActionListener(a -> actions.kickClientsFromChannel(clients));
|
||||
menu.add(kickChannel);
|
||||
JMenuItem kickServer = new JMenuItem("Kick Clients from Server", Icons.of("KICK_FROM_SERVER"));
|
||||
kickServer.setEnabled(others);
|
||||
kickServer.addActionListener(a -> actions.kickClientsFromServer(clients));
|
||||
menu.add(kickServer);
|
||||
menu.addSeparator();
|
||||
JMenuItem moveHere = new JMenuItem("Move Clients to own Channel", Icons.of("MOVE_CLIENT_TO_OWN_CHANNEL"));
|
||||
moveHere.setEnabled(others);
|
||||
moveHere.addActionListener(a -> actions.moveClientsToOwnChannel(clients));
|
||||
menu.add(moveHere);
|
||||
return menu;
|
||||
}
|
||||
|
||||
/**
|
||||
* The contact entries, as TeamSpeak offers them: a client not on the list can be
|
||||
* added as a friend or blocked; one on it can be edited or removed.
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package eu.lixko.ts3j.client.ui;
|
||||
|
||||
import eu.lixko.ts3j.client.net.ClientEntry;
|
||||
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import javax.swing.tree.DefaultTreeSelectionModel;
|
||||
import javax.swing.tree.TreePath;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The server tree's selection: one row of any kind, or several clients, for moving or
|
||||
* kicking them together. Ctrl adds a client to clients already selected, and a Shift range
|
||||
* keeps the clients in it; anything else that would mix kinds selects just the new row.
|
||||
*/
|
||||
final class ClientSelectionModel extends DefaultTreeSelectionModel {
|
||||
|
||||
@Override
|
||||
public void setSelectionPaths(TreePath[] paths) {
|
||||
super.setSelectionPaths(paths == null || paths.length < 2 ? paths : clientsOrLast(paths));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSelectionPaths(TreePath[] paths) {
|
||||
TreePath[] current = getSelectionPaths();
|
||||
if (paths == null || paths.length == 0 || current == null) {
|
||||
setSelectionPaths(paths);
|
||||
return;
|
||||
}
|
||||
if (allClients(current) && allClients(paths)) {
|
||||
super.addSelectionPaths(paths);
|
||||
} else {
|
||||
setSelectionPaths(new TreePath[]{paths[paths.length - 1]});
|
||||
}
|
||||
}
|
||||
|
||||
/** The client rows among {@code paths}, or the last path alone when there are none. */
|
||||
private static TreePath[] clientsOrLast(TreePath[] paths) {
|
||||
List<TreePath> clients = new ArrayList<>(paths.length);
|
||||
for (TreePath path : paths) {
|
||||
if (isClient(path)) clients.add(path);
|
||||
}
|
||||
return clients.isEmpty() ? new TreePath[]{paths[paths.length - 1]} : clients.toArray(new TreePath[0]);
|
||||
}
|
||||
|
||||
private static boolean allClients(TreePath[] paths) {
|
||||
return Arrays.stream(paths).allMatch(ClientSelectionModel::isClient);
|
||||
}
|
||||
|
||||
static boolean isClient(TreePath path) {
|
||||
return ((DefaultMutableTreeNode) path.getLastPathComponent()).getUserObject() instanceof ClientEntry;
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,8 @@ import eu.lixko.ts3j.client.text.TsLink;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
import java.awt.Component;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Context-menu and drag/drop actions for one server's tree, plus tracking which
|
||||
@@ -114,13 +116,8 @@ final class ServerTabTreeActions implements ServerTreePanel.Actions {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveClientToChannel(ClientEntry client, ChannelNode target) {
|
||||
if (!conn.isConnected()) return;
|
||||
if (client.id == conn.getSelfClientId()) {
|
||||
conn.joinChannel(target.id, null);
|
||||
} else {
|
||||
conn.moveClient(client.id, target.id, null);
|
||||
}
|
||||
public void moveClientsToChannel(List<ClientEntry> clients, ChannelNode target) {
|
||||
if (conn.isConnected()) conn.moveClients(ids(clients), target.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -149,21 +146,29 @@ final class ServerTabTreeActions implements ServerTreePanel.Actions {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void kickClientFromChannel(ClientEntry client) {
|
||||
String reason = kickReason("Kick Client from Channel", client);
|
||||
if (reason != null) conn.kickFromChannel(client.id, reason);
|
||||
public void kickClientsFromChannel(List<ClientEntry> clients) {
|
||||
String reason = kickReason("Channel", clients);
|
||||
if (reason != null) conn.kickFromChannel(ids(clients), reason);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void kickClientFromServer(ClientEntry client) {
|
||||
String reason = kickReason("Kick Client from Server", client);
|
||||
if (reason != null) conn.kickFromServer(client.id, reason);
|
||||
public void kickClientsFromServer(List<ClientEntry> clients) {
|
||||
String reason = kickReason("Server", clients);
|
||||
if (reason != null) conn.kickFromServer(ids(clients), reason);
|
||||
}
|
||||
|
||||
private String kickReason(String title, ClientEntry client) {
|
||||
private String kickReason(String from, List<ClientEntry> clients) {
|
||||
if (!conn.isConnected()) return null;
|
||||
return ReasonDialog.prompt(host, title, "Reason for kicking " + client.nickname + ":",
|
||||
TeamspeakConnection.KICK_REASON_LIMIT);
|
||||
boolean one = clients.size() == 1;
|
||||
String whom = one ? clients.get(0).nickname : clients.size() + " clients";
|
||||
return ReasonDialog.prompt(host, "Kick " + (one ? "Client" : "Clients") + " from " + from,
|
||||
"Reason for kicking " + whom + ":", TeamspeakConnection.KICK_REASON_LIMIT);
|
||||
}
|
||||
|
||||
private static List<Integer> ids(List<ClientEntry> clients) {
|
||||
List<Integer> ids = new ArrayList<>(clients.size());
|
||||
for (ClientEntry client : clients) ids.add(client.id);
|
||||
return ids;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -195,10 +200,10 @@ final class ServerTabTreeActions implements ServerTreePanel.Actions {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveClientToOwnChannel(ClientEntry client) {
|
||||
if (!conn.isConnected() || client.id == conn.getSelfClientId()) return;
|
||||
public void moveClientsToOwnChannel(List<ClientEntry> clients) {
|
||||
if (!conn.isConnected()) return;
|
||||
ClientEntry self = conn.getModel().getClient(conn.getSelfClientId());
|
||||
if (self != null) conn.moveClient(client.id, self.channelId, null);
|
||||
if (self != null) conn.moveClients(ids(clients), self.channelId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,11 +14,16 @@ import javax.swing.tree.TreePath;
|
||||
import java.awt.datatransfer.DataFlavor;
|
||||
import java.awt.datatransfer.Transferable;
|
||||
import java.awt.datatransfer.UnsupportedFlavorException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.StringJoiner;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* Drag-and-drop for the {@link ServerTreePanel} tree: dragging a client onto a
|
||||
* channel moves it there, dragging a channel reorders/reparents it, and dropping
|
||||
* Drag-and-drop for the {@link ServerTreePanel} tree: dragging clients onto a
|
||||
* channel moves them there, dragging a channel reorders/reparents it, and dropping
|
||||
* either outside the tree yields its TS3 link BBCode, which the chat input accepts
|
||||
* as plain text.
|
||||
*/
|
||||
@@ -52,10 +57,10 @@ final class ServerTreeDragAndDrop {
|
||||
}
|
||||
|
||||
/**
|
||||
* The channel a dragged client would land in, or {@code null} if the drop makes
|
||||
* no sense (outside a channel, or the channel the client is already in).
|
||||
* The channel dragged clients would land in, or {@code null} if the drop makes
|
||||
* no sense (outside a channel, or the channel all of them are already in).
|
||||
*/
|
||||
private ChannelNode resolveClientDrop(JTree.DropLocation loc, ClientEntry dragged) {
|
||||
private ChannelNode resolveClientDrop(JTree.DropLocation loc, List<ClientEntry> dragged) {
|
||||
DefaultMutableTreeNode target = nodeOf(loc.getPath());
|
||||
if (target == null) return null;
|
||||
Object obj = target.getUserObject();
|
||||
@@ -66,8 +71,8 @@ final class ServerTreeDragAndDrop {
|
||||
channel = model.getChannel(((ClientEntry) obj).channelId);
|
||||
}
|
||||
if (channel == null || Spacers.isSpacer(channel.name)) return null;
|
||||
if (channel.id == dragged.channelId) return null;
|
||||
return channel;
|
||||
int channelId = channel.id;
|
||||
return dragged.stream().allMatch(c -> c.channelId == channelId) ? null : channel;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -131,12 +136,19 @@ final class ServerTreeDragAndDrop {
|
||||
|
||||
@Override
|
||||
protected Transferable createTransferable(JComponent c) {
|
||||
TreePath path = tree.getSelectionPath();
|
||||
if (path == null) return null;
|
||||
Object obj = nodeOf(path).getUserObject();
|
||||
TreePath[] paths = tree.getSelectionPaths();
|
||||
if (paths == null) return null;
|
||||
Arrays.sort(paths, Comparator.comparingInt(tree::getRowForPath));
|
||||
Object obj = nodeOf(paths[0]).getUserObject();
|
||||
if (obj instanceof ClientEntry) {
|
||||
ClientEntry cl = (ClientEntry) obj;
|
||||
return new NodeTransferable(cl, TsLink.clientBBCode(cl.id, cl.uniqueId, cl.nickname));
|
||||
List<ClientEntry> clients = new ArrayList<>(paths.length);
|
||||
StringJoiner links = new StringJoiner(" ");
|
||||
for (TreePath path : paths) {
|
||||
ClientEntry cl = (ClientEntry) nodeOf(path).getUserObject();
|
||||
clients.add(cl);
|
||||
links.add(TsLink.clientBBCode(cl.id, cl.uniqueId, cl.nickname));
|
||||
}
|
||||
return new NodeTransferable(new DraggedClients(clients), links.toString());
|
||||
}
|
||||
if (obj instanceof ChannelNode) {
|
||||
ChannelNode ch = (ChannelNode) obj;
|
||||
@@ -177,8 +189,8 @@ final class ServerTreeDragAndDrop {
|
||||
Object dragged = draggedNode(support);
|
||||
Object resolved = resolve(support);
|
||||
tree.highlightChannel(null);
|
||||
if (dragged instanceof ClientEntry) {
|
||||
actions.moveClientToChannel((ClientEntry) dragged, (ChannelNode) resolved);
|
||||
if (dragged instanceof DraggedClients) {
|
||||
actions.moveClientsToChannel(((DraggedClients) dragged).clients(), (ChannelNode) resolved);
|
||||
} else if (dragged instanceof ChannelNode) {
|
||||
int[] place = (int[]) resolved;
|
||||
actions.moveChannel((ChannelNode) dragged, place[0], place[1]);
|
||||
@@ -191,7 +203,7 @@ final class ServerTreeDragAndDrop {
|
||||
Object dragged = draggedNode(support);
|
||||
if (!(support.getDropLocation() instanceof JTree.DropLocation)) return null;
|
||||
JTree.DropLocation loc = (JTree.DropLocation) support.getDropLocation();
|
||||
if (dragged instanceof ClientEntry) return resolveClientDrop(loc, (ClientEntry) dragged);
|
||||
if (dragged instanceof DraggedClients) return resolveClientDrop(loc, ((DraggedClients) dragged).clients());
|
||||
if (dragged instanceof ChannelNode) return resolveChannelDrop(loc, (ChannelNode) dragged);
|
||||
return null;
|
||||
}
|
||||
@@ -205,6 +217,10 @@ final class ServerTreeDragAndDrop {
|
||||
}
|
||||
}
|
||||
|
||||
/** The clients being dragged; the selection holds several clients or none. */
|
||||
private record DraggedClients(List<ClientEntry> clients) {
|
||||
}
|
||||
|
||||
/** Offers the dragged node locally and its TS3 link BBCode to other applications. */
|
||||
private static final class NodeTransferable implements Transferable {
|
||||
private final Object node;
|
||||
|
||||
@@ -29,6 +29,8 @@ import java.awt.Rectangle;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -49,9 +51,9 @@ public final class ServerTreePanel extends JPanel {
|
||||
|
||||
void complainAboutClient(ClientEntry client);
|
||||
|
||||
void kickClientFromChannel(ClientEntry client);
|
||||
void kickClientsFromChannel(List<ClientEntry> clients);
|
||||
|
||||
void kickClientFromServer(ClientEntry client);
|
||||
void kickClientsFromServer(List<ClientEntry> clients);
|
||||
|
||||
void banClient(ClientEntry client);
|
||||
|
||||
@@ -59,8 +61,8 @@ public final class ServerTreePanel extends JPanel {
|
||||
|
||||
void showConnectionInfo(ClientEntry client);
|
||||
|
||||
/** Moves a client into the channel we are currently in. */
|
||||
void moveClientToOwnChannel(ClientEntry client);
|
||||
/** Moves clients into the channel we are currently in. */
|
||||
void moveClientsToOwnChannel(List<ClientEntry> clients);
|
||||
|
||||
/** Opens the channel editor for a channel. */
|
||||
void editChannel(ChannelNode channel);
|
||||
@@ -102,8 +104,8 @@ public final class ServerTreePanel extends JPanel {
|
||||
/** A channel or client node was selected (or {@code null} when cleared). */
|
||||
void onSelectionChanged(Object userObject);
|
||||
|
||||
/** Drag-and-drop of a client onto a channel. */
|
||||
void moveClientToChannel(ClientEntry client, ChannelNode target);
|
||||
/** Drag-and-drop of clients (ourselves among them, possibly) onto a channel. */
|
||||
void moveClientsToChannel(List<ClientEntry> clients, ChannelNode target);
|
||||
|
||||
/**
|
||||
* Drag-and-drop of a channel to a new place in the tree.
|
||||
@@ -213,6 +215,7 @@ public final class ServerTreePanel extends JPanel {
|
||||
// Lays out only the rows on screen. The default cache measures every row as it is
|
||||
// expanded, which freezes the window for seconds on servers with hundreds of channels.
|
||||
tree.setLargeModel(true);
|
||||
tree.setSelectionModel(new ClientSelectionModel());
|
||||
tree.setBackground(Theme.treeBg());
|
||||
tree.setFont(Theme.uiFont());
|
||||
ServerTreeCellRenderer renderer = new ServerTreeCellRenderer(id -> id == selfClientId, contacts, settings);
|
||||
@@ -274,13 +277,7 @@ public final class ServerTreePanel extends JPanel {
|
||||
});
|
||||
|
||||
tree.addTreeSelectionListener(e -> {
|
||||
if (rebuilding) return;
|
||||
TreePath path = tree.getSelectionPath();
|
||||
Object obj = null;
|
||||
if (path != null) {
|
||||
obj = ((DefaultMutableTreeNode) path.getLastPathComponent()).getUserObject();
|
||||
}
|
||||
actions.onSelectionChanged(obj);
|
||||
if (!rebuilding) actions.onSelectionChanged(selectedUserObject());
|
||||
});
|
||||
|
||||
tree.addMouseListener(new MouseAdapter() {
|
||||
@@ -322,8 +319,10 @@ public final class ServerTreePanel extends JPanel {
|
||||
*/
|
||||
private void selectRowUnder(MouseEvent e) {
|
||||
if (!SwingUtilities.isLeftMouseButton(e) && !e.isPopupTrigger()) return;
|
||||
// Ctrl and Shift build a selection of several clients, which Swing does itself.
|
||||
if (e.isControlDown() || e.isShiftDown() || e.isMetaDown()) return;
|
||||
TreePath path = tree.pathAt(e.getY());
|
||||
if (path == null || path.equals(tree.getSelectionPath())) return;
|
||||
if (path == null || tree.isPathSelected(path)) return;
|
||||
Rectangle bounds = tree.getPathBounds(path);
|
||||
// Left of the label is the expand handle, which Swing works the row without selecting it.
|
||||
if (bounds != null && e.getX() < bounds.x) return;
|
||||
@@ -360,9 +359,12 @@ public final class ServerTreePanel extends JPanel {
|
||||
if (!e.isPopupTrigger()) return;
|
||||
TreePath path = tree.pathAt(e.getY());
|
||||
if (path == null) return;
|
||||
tree.setSelectionPath(path);
|
||||
if (!tree.isPathSelected(path)) tree.setSelectionPath(path);
|
||||
Object obj = ((DefaultMutableTreeNode) path.getLastPathComponent()).getUserObject();
|
||||
if (obj instanceof ClientEntry) {
|
||||
List<ClientEntry> selected = selectedClients();
|
||||
if (selected.size() > 1) {
|
||||
ClientMenu.buildForMany(selected, selfClientId, model, actions).show(tree, e.getX(), e.getY());
|
||||
} else if (obj instanceof ClientEntry) {
|
||||
showClientMenu((ClientEntry) obj, e);
|
||||
} else if (obj instanceof ChannelNode) {
|
||||
showChannelMenu((ChannelNode) obj, e);
|
||||
@@ -382,6 +384,15 @@ public final class ServerTreePanel extends JPanel {
|
||||
ChannelMenu.build(channel, actions).show(tree, e.getX(), e.getY());
|
||||
}
|
||||
|
||||
/** The selected clients, in tree order; empty when a channel or the server is selected. */
|
||||
private List<ClientEntry> selectedClients() {
|
||||
List<ClientEntry> clients = new ArrayList<>();
|
||||
for (Object obj : selectedUserObjects()) {
|
||||
if (obj instanceof ClientEntry) clients.add((ClientEntry) obj);
|
||||
}
|
||||
return clients;
|
||||
}
|
||||
|
||||
/** The path of the tree node showing {@code target}, or {@code null}. */
|
||||
private TreePath pathOf(Object target) {
|
||||
java.util.Enumeration<?> nodes = root.breadthFirstEnumeration();
|
||||
@@ -400,6 +411,7 @@ public final class ServerTreePanel extends JPanel {
|
||||
* nodes are in place, so a selection sticks until the user changes it.
|
||||
*/
|
||||
public void rebuild() {
|
||||
List<Object> selection = selectedUserObjects();
|
||||
Object selected = selectedUserObject();
|
||||
rebuilding = true;
|
||||
try {
|
||||
@@ -413,10 +425,18 @@ public final class ServerTreePanel extends JPanel {
|
||||
}
|
||||
treeModel.reload();
|
||||
expandOpenChannels(root, new TreePath(root));
|
||||
if (selected != null) {
|
||||
TreePath path = pathOf(selected);
|
||||
if (path != null) tree.setSelectionPath(path);
|
||||
List<TreePath> paths = new ArrayList<>(selection.size());
|
||||
for (Object obj : selection) {
|
||||
TreePath path = pathOf(obj);
|
||||
if (path != null) paths.add(path);
|
||||
}
|
||||
// The last path becomes the lead, the row the info panel shows.
|
||||
TreePath lead = selected == null ? null : pathOf(selected);
|
||||
if (lead != null) {
|
||||
paths.remove(lead);
|
||||
paths.add(lead);
|
||||
}
|
||||
if (!paths.isEmpty()) tree.setSelectionPaths(paths.toArray(new TreePath[0]));
|
||||
} finally {
|
||||
rebuilding = false;
|
||||
}
|
||||
@@ -442,8 +462,21 @@ public final class ServerTreePanel extends JPanel {
|
||||
}
|
||||
}
|
||||
|
||||
/** What the selected rows show, in tree order. */
|
||||
private List<Object> selectedUserObjects() {
|
||||
int[] rows = tree.getSelectionRows();
|
||||
if (rows == null) return List.of();
|
||||
Arrays.sort(rows);
|
||||
List<Object> objects = new ArrayList<>(rows.length);
|
||||
for (int row : rows) {
|
||||
objects.add(((DefaultMutableTreeNode) tree.getPathForRow(row).getLastPathComponent()).getUserObject());
|
||||
}
|
||||
return objects;
|
||||
}
|
||||
|
||||
/** The row last added to the selection, which the info panel shows. */
|
||||
private Object selectedUserObject() {
|
||||
TreePath path = tree.getSelectionPath();
|
||||
TreePath path = tree.getSelectionModel().getLeadSelectionPath();
|
||||
return path == null ? null : ((DefaultMutableTreeNode) path.getLastPathComponent()).getUserObject();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user