List of usage examples for java.awt FontMetrics bytesWidth
@SuppressWarnings("deprecation") public int bytesWidth(byte[] data, int off, int len)
From source file:Main.java
public static void main(String args[]) { JFrame f = new JFrame("JColorChooser Sample"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setSize(300, 200);// w ww . j av a 2 s . c o m f.setVisible(true); FontMetrics metrics = f.getFontMetrics(f.getFont()); int widthX = metrics.bytesWidth(new byte[] { 66, 67, 68, 69 }, 1, 2); System.out.println(widthX); }