My problem is here I am taking rgb values from jtextfield but because of text alignment in middle there is lot of white spaces in my rgba array in top and bottom .
can You please suggest how to get text exactly without getting white space top and bottom,
i need where i need to start in order to get correct text.
Insets in=new Insets(0,0,0,0);
Dimension bounds = jTextField1.getPreferredSize();
final BufferedImageimage = new BufferedImage(bounds.width, bounds.height,
Graphics2D g2d = image.createGraphics();
SwingUtilities.paintComponent(g2d, jTextField1, new Container(),
0, 0, bounds.width, bounds.height);
also i tried with this code
image.getRgb(0,40,bounds.width,bounds.height,null,bounds.width); it is giving me error