Java tutorial
//package com.java2s; /* * Copyright (c) 2011 - 2012. Elega9t Ltd. All rights reserved. * ELEGA9T PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.Copyright (c) 2011 - 2012. Elega9t Ltd. All rights reserved. */ import java.awt.*; import java.awt.font.TextAttribute; import java.util.HashMap; import java.util.Map; public class Main { public static Font subscriptFont(Font baseFont) { Map<TextAttribute, Object> attributes = new HashMap<TextAttribute, Object>(baseFont.getAttributes()); attributes.put(TextAttribute.SUPERSCRIPT, TextAttribute.SUPERSCRIPT_SUB); return baseFont.deriveFont(attributes); } }