GUI desinger suspend with custom jpanel
Hello,
I have strange problem with gui designer. When im adding my custom JPanel, IDEA suspend work. There is no errors in terminal. Sometimes its posible to close designer.
public class FigurePanel extends JPanel {
private static final int rowsNumber = 30;
private static final Dimension size = new Dimension(10, 10);
protected static final Color selectionColor = new Color(0x000000);
private Color originalColor;
private JPanel grid;
private boolean[] gridArray;
public FigurePanel() {
setLayout(new GridLayout(rowsNumber, rowsNumber, 1, 1));
setBackground(new Color(0x000000));
gridArray = new boolean[rowsNumber * rowsNumber];
for (int i = 0; i < rowsNumber * rowsNumber; i++) {
grid = new JPanel();
grid.setBackground(new Color(0xFFFFFF));
String name = Integer.toString(i);
grid.setName(name);
if (i == 0) {
originalColor = grid.getBackground();
}
grid.setPreferredSize(size);
add(grid);
}
addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
JPanel panel = (JPanel) getComponentAt(e.getPoint());
if (panel == null || panel == FigurePanel.this) {
return;
}
if (gridArray[Integer.parseInt(panel.getName())]) {
panel.setBackground(originalColor);
panel.revalidate();
panel.repaint();
} else {
gridArray[Integer.parseInt(panel.getName())] = true;
panel.setBackground(selectionColor);
panel.revalidate();
panel.repaint();
}
}
});
}
public boolean[] getGridArray() {
return gridArray;
}
}
Sorry for my terrible english.
Please sign in to leave a comment.
Hello.
What is your IDEA build and JDK (see main menu / Help / About)?
Thanks,
Alexander.
Thanks for your willingness to help.
Hi.
I can't reproduce the bug (but tried with 32-bit CPU, I have no linux with 64-bit).
You can check the IDEA thread dump (see http://devnet.jetbrains.net/docs/DOC-192), create an issue in YouTrack (http://youtrack.jetbrains.net/issues/IDEA) and attach relevant information.
Thanks,
Alexander.
Hello,
Im create new issue, http://youtrack.jetbrains.com/issue/IDEA-84713
Now i have only problem with closing tab with form. I have the same situation on Window7 x64 adn Java 6 Update 31 x64
Thanks,
Janek