24 |
|
|
25 |
import java.awt.BorderLayout; |
import java.awt.BorderLayout; |
26 |
import java.awt.Component; |
import java.awt.Component; |
27 |
|
import java.awt.Rectangle; |
28 |
|
|
29 |
import java.awt.event.KeyEvent; |
import java.awt.event.KeyEvent; |
30 |
import java.awt.event.MouseAdapter; |
import java.awt.event.MouseAdapter; |
67 |
public class ChannelsPane extends JSChannelsPane implements ListSelectionListener { |
public class ChannelsPane extends JSChannelsPane implements ListSelectionListener { |
68 |
private final ComponentList chnList = new ComponentList(); |
private final ComponentList chnList = new ComponentList(); |
69 |
private final DefaultComponentListModel listModel = new DefaultComponentListModel(); |
private final DefaultComponentListModel listModel = new DefaultComponentListModel(); |
70 |
|
|
71 |
|
private final JScrollPane scrollPane; |
72 |
|
|
73 |
/** |
/** |
74 |
* Creates a new instance of <code>ChannelsPane</code> with |
* Creates a new instance of <code>ChannelsPane</code> with |
89 |
chnList.addMouseListener(new ContextMenu()); |
chnList.addMouseListener(new ContextMenu()); |
90 |
//chnList.setDragEnabled(true); |
//chnList.setDragEnabled(true); |
91 |
|
|
92 |
JScrollPane sp = new JScrollPane(chnList); |
scrollPane = new JScrollPane(chnList); |
93 |
sp.setBorder(BorderFactory.createEmptyBorder()); |
scrollPane.setBorder(BorderFactory.createEmptyBorder()); |
94 |
add(sp); |
add(scrollPane); |
95 |
|
|
96 |
setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); |
setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); |
97 |
|
|
107 |
listModel.add(channel); |
listModel.add(channel); |
108 |
if(channel.getChannelInfo().getEngine() == null) channel.expandChannel(); |
if(channel.getChannelInfo().getEngine() == null) channel.expandChannel(); |
109 |
chnList.setSelectedComponent(channel, true); |
chnList.setSelectedComponent(channel, true); |
110 |
|
scrollToBottom(); |
111 |
} |
} |
112 |
|
|
113 |
/** |
/** |
353 |
chnList.ensureIndexIsVisible(listModel.getSize() - 1); |
chnList.ensureIndexIsVisible(listModel.getSize() - 1); |
354 |
} |
} |
355 |
|
|
356 |
|
private void |
357 |
|
scrollToBottom() { |
358 |
|
int h = scrollPane.getViewport().getView().getHeight(); |
359 |
|
scrollPane.getViewport().scrollRectToVisible(new Rectangle(0, h - 2, 1, 1)); |
360 |
|
} |
361 |
|
|
362 |
class ContextMenu extends MouseAdapter { |
class ContextMenu extends MouseAdapter { |
363 |
private final JPopupMenu cmenu = new JPopupMenu(); |
private final JPopupMenu cmenu = new JPopupMenu(); |
364 |
private final JMenu submenu = new JMenu(i18n.getMenuLabel("channels.MoveToTab")); |
private final JMenu submenu = new JMenu(i18n.getMenuLabel("channels.MoveToTab")); |