提交 b44a1e3a 编写于 作者: S Skylot

gui: fix tab selection

上级 b18dabee
......@@ -203,7 +203,7 @@ public class MainWindow extends JFrame {
int id = tabbedPane.getTabCount() - 1;
openTabs.put(cls, id);
tabbedPane.setSelectedIndex(id);
tabbedPane.setTabComponentAt(id, makeTabComponent(cls, panel));
tabbedPane.setTabComponentAt(id, makeTabComponent(cls, panel, id));
}
if (panel != null) {
JTextArea textArea = getTextArea(panel);
......@@ -212,7 +212,7 @@ public class MainWindow extends JFrame {
}
}
private Component makeTabComponent(final JClass cls, final Component comp) {
private Component makeTabComponent(final JClass cls, final Component comp, final int id) {
String name = cls.getCls().getFullName();
JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 3, 0));
panel.setOpaque(false);
......@@ -243,6 +243,8 @@ public class MainWindow extends JFrame {
public void mouseClicked(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON2) {
closeCodeTab(cls, comp);
} else {
tabbedPane.setSelectedIndex(id);
}
}
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册