Fixed ClassCastException for Client windows

This commit is contained in:
magenoxx 2012-06-30 09:10:36 +04:00
parent d055c5e804
commit 375cc311b9

View file

@ -415,19 +415,21 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
MagePaneMenuItem menuItem; MagePaneMenuItem menuItem;
for (int i = 0; i < windows.length; i++) { for (int i = 0; i < windows.length; i++) {
MagePane window = (MagePane) windows[i]; if (windows[i] instanceof MagePane) {
if (window.isVisible()) { MagePane window = (MagePane) windows[i];
menuItem = new MagePaneMenuItem(window); if (window.isVisible()) {
menuItem.setState(i == 0); menuItem = new MagePaneMenuItem(window);
menuItem.addActionListener(new ActionListener() { menuItem.setState(i == 0);
@Override menuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) { @Override
MagePane frame = ((MagePaneMenuItem) ae.getSource()).getFrame(); public void actionPerformed(ActionEvent ae) {
setActive(frame); MagePane frame = ((MagePaneMenuItem) ae.getSource()).getFrame();
} setActive(frame);
}); }
menuItem.setIcon(window.getFrameIcon()); });
menu.add(menuItem); menuItem.setIcon(window.getFrameIcon());
menu.add(menuItem);
}
} }
} }