When playing with the Java and Swing font class, I set the font size to a negative value.
I found that this causes the text to be turned upside down. Is this a bug or a function? Can anyone explain why this is happening?
Try:
import java.awt.Font; import java.awt.Graphics; import javax.swing.JFrame; import javax.swing.JPanel; public class UpsideDown extends JFrame{ public UpsideDown(){ setSize(500,500); setContentPane(new Panel()); setVisible(true); } public class Panel extends JPanel{ public void paintComponent(Graphics g){ Font f = new Font("Sans-Serif", Font.PLAIN, -50); g.setFont(f); g.drawString("Upside Down", 400, 100); } } public static void main(String args[]){ new UpsideDown(); } }

source share