Skip to main content

Posts

Showing posts with the label maze

Gui generator re-generate my maze if I change the current window dimensions(Java)

Given the following code : class Game() { private Shell shell; public Game(Display display,int level) { shell.addPaintListener(new ExmaplePaintListener()); shell.setText("Basic shapes"); shell.setSize(900,900); shell.setLocation(45, 45); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } } } The listener : private class ExmaplePaintListener implements PaintListener { public void paintControl(PaintEvent e) { drawMaze(e); placeTreasuresInMaze2(e); e.gc.dispose(); } } and the method that draw the maze private void drawMaze(PaintEvent e) { // this method creates a new maze and draw it using GUI Java } My problem is that after the window of the maze is created , if I use the mouse to change the dimensions of the window , then the method drawMaze creates a new m