Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package telas;
- import java.awt.EventQueue;
- import java.awt.event.MouseListener;
- import java.awt.image.BufferedImage;
- import javax.swing.JFrame;
- import javax.swing.JLabel;
- import br.com.conducto.awy.myClient;
- import javax.swing.ImageIcon;
- import javax.imageio.ImageIO;
- import javax.swing.JButton;
- import java.awt.event.MouseEvent;
- import java.io.File;
- //import java.awt.image.BufferedImage;
- //import java.io.File;
- import java.io.IOException;
- import javax.swing.UIManager;
- import javax.swing.UnsupportedLookAndFeelException;
- public class mainWindow extends JFrame {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- public myClient client = new myClient();
- public myClient getClient()
- {
- return client;
- }
- public void setClient(myClient cliente)
- {
- this.client = cliente;
- System.out.println(this.client.getCartaoNome());
- }
- Tela_Cadastro f;
- Tela_Consulta C;
- /**
- * Launch the application.
- */
- public static void main(String[] args) {
- EventQueue.invokeLater(new Runnable() {
- public void run() {
- try {
- UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
- mainWindow frame = new mainWindow();
- frame.setVisible(true);
- frame.setResizable(false);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- }
- /**
- * Create the frame.
- * @throws IOException
- */
- JButton btnStatement = new JButton("");
- JButton btnBlock= new JButton("");
- JButton btMap = new JButton("");
- JButton btHelp = new JButton("");
- ImageIcon iconeStatement = loadImage("image/iconeee.png");
- ImageIcon iconeStatement2 = loadImage("image/icone2.jpg");
- ImageIcon iconeBlock = loadImage("image/iconeee3.png");
- ImageIcon iconeBlock2 = loadImage("image/icone4.png");
- ImageIcon iconeMap = loadImage("image/iconMap.png");
- ImageIcon iconeMap2 = loadImage("image/icone6.png");
- ImageIcon iconeHelp = loadImage("image/iconSettings.png");
- ImageIcon iconeHelp2 = loadImage("image/icone6.png");
- public mainWindow() throws IOException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException {
- setTitle("VoicePi-Condunctor");
- //setExtendedState(JFrame.MAXIMIZED_BOTH);
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- setContentPane(new JLabel(new ImageIcon(ImageIO.read(new File("image/back.png")))));
- setBounds(0, 0, 1300, 2000);
- setLocationRelativeTo(null);
- setResizable(false);
- setVisible(true);
- setLayout(null);
- btnStatement .setBounds(100, 250, 400, 300);
- btnStatement .setIcon(iconeStatement);
- btnStatement .addMouseListener(new MouseListener() {
- public void mouseClicked(MouseEvent e) {
- f = new Tela_Cadastro(client);
- f.setVisible(true);
- f.setResizable(false);}
- public void mousePressed(MouseEvent e) {}
- public void mouseReleased(MouseEvent e) {}
- public void mouseEntered(MouseEvent e) {
- btnStatement .setIcon(iconeStatement2);
- }
- public void mouseExited(MouseEvent e) {
- btnStatement .setIcon(iconeStatement);
- }
- });
- getContentPane().add(btnStatement );
- /* btnBlock.setBounds(450, 250, 400, 300);
- btnBlock.setIcon(iconeBlock);
- btnBlock.addMouseListener(new MouseListener() {
- public void mouseClicked(MouseEvent e) {
- Tela_Consulta E = new Tela_Consulta(client);
- E.setVisible(true);
- E.setResizable(false);
- }
- public void mousePressed(MouseEvent e) {}
- public void mouseReleased(MouseEvent e) {}
- public void mouseEntered(MouseEvent e) {
- btnBlock.setIcon(iconeBlock2);
- }
- public void mouseExited(MouseEvent e) {
- btnBlock.setIcon(iconeBlock);
- }
- });
- getContentPane().add(btnBlock);
- btMap.setBounds(450, 250, 400, 300);
- btMap.setIcon(iconeMap);
- btMap.addMouseListener(new MouseListener() {
- public void mouseClicked(MouseEvent e) {
- Tela_Consulta E = new Tela_Consulta(client);
- E.setVisible(true);
- E.setResizable(false);
- }
- public void mousePressed(MouseEvent e) {}
- public void mouseReleased(MouseEvent e) {}
- public void mouseEntered(MouseEvent e) {
- btMap.setIcon(iconeMap2);
- }
- public void mouseExited(MouseEvent e) {
- btMap.setIcon(iconeMap);
- }
- });
- getContentPane().add(btMap);
- */
- btHelp.setBounds(750, 250, 400, 300);
- btHelp.setIcon(iconeHelp);
- btHelp.addMouseListener(new MouseListener() {
- public void mouseClicked(MouseEvent e) {
- Tela_Consulta E = new Tela_Consulta(client);
- E.setVisible(true);
- E.setResizable(false);
- }
- public void mousePressed(MouseEvent e) {}
- public void mouseReleased(MouseEvent e) {}
- public void mouseEntered(MouseEvent e) {
- btHelp.setIcon(iconeHelp2);
- }
- public void mouseExited(MouseEvent e) {
- btHelp.setIcon(iconeHelp);
- }
- });
- getContentPane().add(btMap);
- getContentPane().add(btHelp);
- /*
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- setBounds(100, 100, 564, 360);
- contentPane = new JPanel();
- contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
- setContentPane(contentPane);
- contentPane.setLayout(null);
- final JButton btnStatement = new JButton("New Card");
- final ImageIcon iconeNew = loadImage("image/icone.jpg");
- final ImageIcon iconeNew2 = loadImage("image/icone2.jpg");
- btnStatement .setIcon(iconeNew);
- btnStatement .addMouseListener(new MouseListener() {
- public void mouseClicked(MouseEvent e) {
- f = new Tela_Cadastro(client);
- f.setVisible(true);
- f.setResizable(false);}
- public void mousePressed(MouseEvent e) {}
- public void mouseReleased(MouseEvent e) {}
- public void mouseEntered(MouseEvent e) {
- btnStatement .setIcon(iconeNew2);
- }
- public void mouseExited(MouseEvent e) {
- btnStatement .setIcon(iconeNew);
- }
- });
- btnStatement .setBounds(23, 12, 174, 186);
- contentPane.add(btnStatement );
- btnStatement .setIcon(iconeNew);
- final ImageIcon iconeConsult = loadImage("image/icone3.png");
- final ImageIcon iconeConsult2 = loadImage("image/icone4.png");
- final JButton btnConsult = new JButton("Consult");
- btnConsult.setBackground(UIManager.getColor("windowBorder"));
- btnConsult.setBounds(193, 12, 174, 186);
- contentPane.add(btnConsult);
- btnConsult.setIcon(iconeConsult);
- btnConsult.addMouseListener(new MouseListener() {
- public void mouseClicked(MouseEvent e) {
- ///alClient.add(client);
- Tela_Consulta E = new Tela_Consulta(client);
- E.setVisible(true);
- E.setResizable(false);
- }
- public void mousePressed(MouseEvent e) {}
- public void mouseReleased(MouseEvent e) {}
- public void mouseEntered(MouseEvent e) {
- btnConsult.setIcon(iconeConsult2);
- }
- public void mouseExited(MouseEvent e) {
- btnConsult.setIcon(iconeConsult);
- }
- });
- //chama(client,btnConsult);
- final JButton btEdit = new JButton("Edit");
- btEdit.setBackground(UIManager.getColor("Button.background"));
- btEdit.setBounds(363, 12, 174, 186);
- contentPane.add(btEdit);
- final ImageIcon iconeEdit = loadImage("image/icone5.png");
- final ImageIcon iconeEdit2 = loadImage("image/icone6.png");
- btEdit.setIcon(iconeEdit);
- btEdit.addMouseListener(new MouseListener() {
- public void mouseClicked(MouseEvent e) {
- Tela_OP E = new Tela_OP(client);
- E.setVisible(true);
- E.setResizable(false);
- }
- public void mousePressed(MouseEvent e) {}
- public void mouseReleased(MouseEvent e) {}
- public void mouseEntered(MouseEvent e) {
- btEdit.setIcon(iconeEdit2);
- }
- public void mouseExited(MouseEvent e) {
- btEdit.setIcon(iconeEdit);
- }
- });
- JLabel lblNewLabel = new JLabel("");
- lblNewLabel.setIcon(new ImageIcon("image/teste.png"));
- lblNewLabel.setBounds(0, -32, 562, 376);
- contentPane.add(lblNewLabel);
- */
- }
- public ImageIcon loadImage(String urlImage) throws IOException
- {
- File mFileImage = new File(urlImage);
- BufferedImage imagem = ImageIO.read(mFileImage);
- ImageIcon image = new ImageIcon(imagem);
- return image;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement