Skip to content

Instantly share code, notes, and snippets.

@uncoded-ro
Created January 9, 2020 11:22
Show Gist options
  • Save uncoded-ro/18fc784da4ec058e7b337723774e469e to your computer and use it in GitHub Desktop.
Save uncoded-ro/18fc784da4ec058e7b337723774e469e to your computer and use it in GitHub Desktop.
package ro.virtualcampus.gui;
import java.awt.*;
import javax.swing.*;
public class LabelApp {
public static void main(String args[]) {
JFrame container = new JFrame("Label");
JPanel panou = new JPanel();
panou.setLayout(new BorderLayout());
JLabel eticheta1 = new JLabel("Eticheta 1", JLabel.RIGHT);
eticheta1.setFont(new Font("Arial", Font.ITALIC, 14));
JLabel eticheta2 = new JLabel("Eticheta 2", JLabel.LEFT);
eticheta2.setForeground(Color.RED);
JLabel eticheta3 = new JLabel("Eticheta 3", JLabel.CENTER);
JLabel eticheta4 = new JLabel("Eticheta 4", JLabel.CENTER);
JLabel eticheta5 = new JLabel("Eticheta 5", JLabel.CENTER);
panou.add(eticheta1, BorderLayout.NORTH);
panou.add(eticheta2, BorderLayout.SOUTH);
panou.add(eticheta3, BorderLayout.EAST);
panou.add(eticheta4, BorderLayout.WEST);
panou.add(eticheta5, BorderLayout.CENTER);
container.add(panou);
container.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
container.pack();
container.setVisible(true);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment