jlabel center text

JLabel Border and Image Example

Swing Label can be set with borders and images which is not possible with AWT Label component. Alignment is also possible. Following code explains. import javax.swing.* ; import java.awt.*; import java.awt.event.*; public class JLabelDemo2 extends JFrame { public JLabelDemo2() { Container c = getContentPane(); c.setLayout(new GridLayout(3, 1, 0, 10)); // ordinary text like Label of …

JLabel Border and Image Example Read More »