Advertisement
rdsedmundo

GUI.java

Jan 31st, 2014
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.35 KB | None | 0 0
  1. package gui;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Container;
  5. import java.awt.FlowLayout;
  6. import java.awt.Font;
  7. import java.awt.event.ActionEvent;
  8. import java.awt.event.ActionListener;
  9.  
  10. import javax.swing.ImageIcon;
  11. import javax.swing.JButton;
  12. import javax.swing.JFrame;
  13. import javax.swing.JLabel;
  14.  
  15. public class GUI extends JFrame {
  16.  
  17.     private static final long serialVersionUID = -4673040337179571462L;
  18.  
  19.     JButton Sobre = new JButton("Sobre");
  20.    
  21.     private class ListenEvent implements ActionListener {
  22.  
  23.         @Override
  24.         public void actionPerformed(ActionEvent arg0) {
  25.  
  26.             Sobre.setText("Teste");
  27.         }
  28.  
  29.     }
  30.  
  31.     public GUI() {
  32.         super("Layouts");
  33.  
  34.         Container panContainer = getContentPane();
  35.  
  36.         panContainer.setLayout(new FlowLayout());
  37.  
  38.         JLabel simples = new JLabel("Label1");
  39.         simples.setToolTipText("Info");
  40.        
  41.         panContainer.add(simples);
  42.        
  43.         JLabel elab = new JLabel("Label2");
  44.        
  45.         Font fonte = new Font("serif", Font.BOLD, 20);
  46.         elab.setFont(fonte);
  47.         elab.setForeground(Color.RED);
  48.        
  49.         panContainer.add(elab);
  50.        
  51.         ImageIcon icon = new ImageIcon(getClass().getResource("images/lamp.gif"));
  52.         JLabel imgLabel = new JLabel(icon);
  53.        
  54.         panContainer.add(imgLabel);
  55.  
  56.         setDefaultCloseOperation(EXIT_ON_CLOSE);
  57.         setSize(300, 300);
  58.         setVisible(true);
  59.     }
  60.  
  61.     public static void main(String[] args) {
  62.         new GUI();
  63.     }
  64.  
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement