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.

4 comments
Comment actions Permalink

Hello.

What is your IDEA build and JDK (see main menu / Help / About)?

Thanks,
Alexander.

0
Comment actions Permalink

Build #I C-117.117
Build on March 30.2012

JDK: 1.7.0_03
VM: Java Hot Spot 64-Bit ServerVM
Vendor: Oracle


Linux  3.2.0-23-generic #36-Ubuntu x86_64 x86_64 x86_64 GNU/Linux

java version "1.7.0_03"
Java(TM) SE Runtime Environment (build 1.7.0_03-b04)
Java HotSpot(TM) 64-Bit Server VM (build 22.1-b02, mixed mode)


Thanks for your willingness to help.

0
Comment actions Permalink

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.

0
Comment actions Permalink

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

0

Please sign in to leave a comment.