java - Scaled image does not appear correctly until Frame is resized -


i trying scale image affinetransform. however, image not appear correctly when frame appears initially.

enter image description here

but after frame resized, image shows perfectly.

enter image description here

here code.

public class mainframe extends javax.swing.jframe {    line line;   bufferedimage bi;    public mainframe() {     initcomponents();      try {       bi = imageio.read(new file("map.png"));     } catch (exception ex) {       ex.printstacktrace();     }   }    public void paint(graphics g) {     graphics2d g2 = (graphics2d) g;     affinetransform old = g2.gettransform();     g2.scale(0.25, 0.25);     g2.drawimage(bi, 0, 0, null);     g2.settransform(old);   }    ... } 


Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -