All pastes #716584 Raw Edit

Miscellany

public java v1 · immutable
#716584 ·published 2007-09-26 23:24 UTC
rendered paste body
package hotel;//importsimport java.awt.Container;import java.awt.FlowLayout;import javax.swing.ImageIcon;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JMenu;import javax.swing.JMenuBar;import javax.swing.JMenuItem;import javax.swing.JPanel;import javax.swing.WindowConstants;import javax.swing.LookAndFeel;import com.lipstikLF.*;import javax.swing.UIManager;import javax.swing.UnsupportedLookAndFeelException;public class Balcao extends JFrame {	// declarações	private static final long serialVersionUID = -1732198678574457053L;	private JMenuBar Barra;	private JMenu Menu;	private JLabel Painel;	private ImageIcon Figura,Icone;	private FlowLayout layout;	private Container tela;	private JMenuItem Hospede,Sair;	/**	 * @param args	 * 	 * A classe Balcão é a principal, contem chamadas para todas as outras	 * classes.	 * 	 */	public Balcao() {		// Instaciação		Figura = new ImageIcon("lovehina3.JPG");		Icone = new ImageIcon("icone.GIF");		Painel = new JLabel(Figura,JLabel.CENTER);		setResizable(false);				Barra = new JMenuBar();		Menu = new JMenu();		new JMenuItem("Quarto");		Hospede = new JMenuItem("Hospede");		Sair = new JMenuItem("Sair");		tela = getContentPane();		layout = new FlowLayout();		// Configuração de cada atributo		tela.setLayout(layout);		setIconImage(Icone.getImage());		add(Painel);		Menu.setText("Menu");		Barra.add(Menu);		Menu.add(Hospede);		Menu.add(Sair);						Sair.addActionListener(new java.awt.event.ActionListener() {			public void actionPerformed(java.awt.event.ActionEvent evt) {				// Sai do programa //				System.exit(1); 				}		});		Hospede.addActionListener(new java.awt.event.ActionListener() {			public void actionPerformed(java.awt.event.ActionEvent evt) {				// Sai do program //				new Hospede().setVisible(true);								}		});								setJMenuBar(Barra);		setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);		setTitle(" Hotel - Menu Principal ");		pack();		setVisible(true);		final JPanel panel = new JPanel();		getContentPane().add(panel);					}	public static void main(String[] args) {		tema();		setDefaultLookAndFeelDecorated(true);		new Balcao();	}	private static void tema() {		// TODO Auto-generated method stub		LookAndFeel tema = new LipstikLookAndFeel();		try {			UIManager.setLookAndFeel(tema);		} catch (UnsupportedLookAndFeelException e) {			// TODO Auto-generated catch block			e.printStackTrace();		}			}}