sclass ShadowJLabel extends BetterLabel { int tracking; *() {} *(S text, int tracking) { super(text); this.tracking = tracking; } private int left_x, left_y, right_x, right_y; private Color left_color, right_color; public void setLeftShadow(int x, int y, Color color) { left_x = x; left_y = y; left_color = color; } public void setRightShadow(int x, int y, Color color) { right_x = x; right_y = y; right_color = color; } public Dimension getPreferredSize() { FontMetrics fm = this.getFontMetrics(getFont()); int w = totalWidth(); int h = fm.getHeight(); h += left_y + right_y; return new Dimension(w,h); } int totalWidth() { String text = getText(); FontMetrics fm = this.getFontMetrics(getFont()); int w = fm.stringWidth(text); w += (text.length()-1)*tracking; w += left_x + right_x; ret w; } public void paintComponent(Graphics g) { ((Graphics2D)g).setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); char[] chars = getText().toCharArray(); FontMetrics fm = this.getFontMetrics(getFont()); int ha = getHorizontalAlignment(); int va = getVerticalAlignment(); int h = fm.getAscent(); if (va == SwingConstants.CENTER) h += (getHeight()-fm.getHeight())/2; int x = ha == SwingConstants.CENTER ? (getWidth()-totalWidth())/2 : 0; for(int i=0; i