java - How resize javax.swing.Icon -
i try resize iumanager icon. cant correct. code looks like:
// label errordetails = new javax.swing.jlabel(); // icon icon icon = uimanager.geticon("optionpane.informationicon"); bufferedimage bi = new bufferedimage( 205, 250, bufferedimage.scale_default); graphics2d g = bi.creategraphics(); g.scale(205,205); // paint new graphics icon.painticon(null,g,250,250); g.dispose(); // set resized uimanage icon errordetails.seticon(icon);
but icon have still same size
you attempting paint icon onto bufferedimage. therefore need create new icon using bufferedimage>
imageicon scaled = new imageicon(bi); errordetails.seticon(scaled);
also follow java naming conventions. variable names should not start upper case character. "errordetails" should "errordetails".
Comments
Post a Comment