Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package gui;
- import java.awt.Color;
- import java.awt.Container;
- import java.awt.FlowLayout;
- import java.awt.Font;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import javax.swing.ImageIcon;
- import javax.swing.JButton;
- import javax.swing.JFrame;
- import javax.swing.JLabel;
- public class GUI extends JFrame {
- private static final long serialVersionUID = -4673040337179571462L;
- JButton Sobre = new JButton("Sobre");
- private class ListenEvent implements ActionListener {
- @Override
- public void actionPerformed(ActionEvent arg0) {
- Sobre.setText("Teste");
- }
- }
- public GUI() {
- super("Layouts");
- Container panContainer = getContentPane();
- panContainer.setLayout(new FlowLayout());
- JLabel simples = new JLabel("Label1");
- simples.setToolTipText("Info");
- panContainer.add(simples);
- JLabel elab = new JLabel("Label2");
- Font fonte = new Font("serif", Font.BOLD, 20);
- elab.setFont(fonte);
- elab.setForeground(Color.RED);
- panContainer.add(elab);
- ImageIcon icon = new ImageIcon(getClass().getResource("images/lamp.gif"));
- JLabel imgLabel = new JLabel(icon);
- panContainer.add(imgLabel);
- setDefaultCloseOperation(EXIT_ON_CLOSE);
- setSize(300, 300);
- setVisible(true);
- }
- public static void main(String[] args) {
- new GUI();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement