java - Why I can't visual the String with Graphics drawString method -


it can see pdf.png in new picture, can't see string "hello" in new picture

public void generateimage() throws exception{         int width = 220;         int height = 50;         bufferedimage image = new bufferedimage(width,height,bufferedimage.type_int_rgb);         graphics g = image.getgraphics();         g.setcolor(new color(255,255,255));         g.fillrect(0, 0, width, height);         font font = new font("宋体",font.bold,10);         g.setfont(font);         bufferedimage image2 = imageio.read(new file("data/icon/pdf.png"));         g.drawimage(image2, 0, 0, 44, 42, null);         g.drawstring("hello", 50, 5);         g.dispose();         file f = new file("data/icon/"+filename+".png");         fileoutputstream fos = new fileoutputstream(f);         imageio.write(image,"png",fos);         fos.close(); } 

g.drawstring("hello", 50, 5); 

on line manipulate coordinate values, i.e. 50 , 5, , test whether text "hello" appears.


Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -