45,45d44 < implements DrawingView, 46,46c45,45 < DNDInterface, java.awt.dnd.Autoscroll { --- > implements DrawingView, DNDInterface, java.awt.dnd.Autoscroll { 81a81,86 > /* > * ricardo_padilha: this was removed because it interferes with proper > * handling of sizes in Swing. For example, it prevents JScrollPane to receive > * events about the changes of preferred and minimum sizes. > */ > //private Dimension fViewSize; 82,82d80 < private Dimension fViewSize; 146a151,153 > // ricardo_padilha: changed from setSize(int, int) because it is not > // JScrollPane-friendly. > setPreferredSize(new Dimension(width, height)); 147,148d150 < fViewSize = new Dimension(width,height); < setSize(width, height); 279a285,288 > FigureEnumeration fe, > int dx, > int dy, > boolean bCheck) { 279,279c284,284 < public FigureEnumeration insertFigures(FigureEnumeration fe, int dx, int dy, boolean bCheck) { --- > public FigureEnumeration insertFigures( 291,291d299 < } 292,292c300,300 < else if (figure != null) { --- > } else if (figure != null) { 305a314,314 > && figureExists(ef, drawing().figures()) 305,305c313,313 < if (figureExists(sf, drawing().figures()) && --- > if (figureExists(sf, drawing().figures()) 306,306d313 < figureExists(ef, drawing().figures()) && 307,307c315,315 < (!bCheck || cf.canConnect(sf, ef))) { --- > && (!bCheck || cf.canConnect(sf, ef))) { 352,352c360,360 < if (cf.startFigure().includes(inFigure) || --- > if (cf.startFigure().includes(inFigure) || cf.endFigure().includes(inFigure)) { 353,353d360 < cf.endFigure().includes(inFigure)) { 363,376d369 < * Gets the minimum dimension of the drawing. < */ < public Dimension getMinimumSize() { < return fViewSize; < } < < /** < * Gets the preferred dimension of the drawing.. < */ < public Dimension getPreferredSize() { < return getMinimumSize(); < } < < /** 410a404,405 > > // why do this? why not just take the vector fSelection? 411,411c406,406 < FigureEnumeration figures = drawing().figures(); --- > /*FigureEnumeration figures = drawing().figures(); 417a413,415 > }*/ > > result.addAll(fSelection); 418,418c849,849 < } --- > } 484,484d480 < } 485,485c481,481 < else { --- > } else { 649,649d644 < } 650,650c645,645 < else { --- > } else { 820a816,816 > // could use lazy initialization instead 820,820c815,815 < fSelection = CollectionsFactory.current().createList(); // could use lazy initialization instead --- > fSelection = CollectionsFactory.current().createList(); 828a825,825 > Dimension v = getPreferredSize(); 830,830c827,827 < if (fViewSize.height < d.height || fViewSize.width < d.width) { --- > if (v.height < d.height || v.width < d.width) { 831,831c828,828 < fViewSize.height = d.height + SCROLL_OFFSET; --- > v.height = d.height + SCROLL_OFFSET; 832a830,830 > setPreferredSize(v); 832,832c829,829 < fViewSize.width = d.width + SCROLL_OFFSET; --- > v.width = d.width + SCROLL_OFFSET; 833,833d829 < setSize(fViewSize); 841a840,842 > // ricardo_padilha: this test had to be introduced because a drawing view > // can be assigned a null drawing (see setDrawing() ). > if (drawing() != null) { 842,842c843,843 < FigureEnumeration fe = drawing().figures(); --- > FigureEnumeration fe = drawing().figures(); 863a865,866 > public void keyTyped(KeyEvent e) { > } 864,864d864 < public void keyTyped(KeyEvent e) {} 865,865c867,867 < public void keyReleased(KeyEvent e) {} --- > public void keyReleased(KeyEvent e) { 865a868,868 > } 887,887d889 < 922,922c924,924 < JOptionPane.showMessageDialog(this, --- > JOptionPane.showMessageDialog( 922a925,925 > this, 923a927,927 > "Error", 924,924c928,928 < "Error", JOptionPane.ERROR_MESSAGE); --- > JOptionPane.ERROR_MESSAGE); 940,940d943 < } 941,941c944,944 < catch (Throwable t) { --- > } catch (Throwable t) { 955,955d957 < } 956,956c958,958 < catch (Throwable t) { --- > } catch (Throwable t) { 972,972d973 < } 973,973c974,974 < catch (Throwable t) { --- > } catch (Throwable t) { 985,985d985 < } 986,986c986,986 < catch (Throwable t) { --- > } catch (Throwable t) { 1010a1011,1014 > } else if ( > (code == KeyEvent.VK_DOWN) > || (code == KeyEvent.VK_UP) > || (code == KeyEvent.VK_RIGHT) 1011,1012d1010 < } < else if ((code == KeyEvent.VK_DOWN) || (code == KeyEvent.VK_UP) 1013,1013c1015,1015 < || (code == KeyEvent.VK_RIGHT) || (code == KeyEvent.VK_LEFT)) { --- > || (code == KeyEvent.VK_LEFT)) { 1015,1015d1016 < } 1016,1016c1017,1017 < else { --- > } else {