Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package Interface;
- import java.awt.Point;
- import java.awt.event.MouseEvent;
- import java.awt.event.MouseListener;
- import javax.swing.JFrame;
- /**
- *
- * @author Pessoal
- */
- public class Interface extends JFrame implements MouseListener{
- static Point p = new Point();
- public static void main(String[] args) {
- JFrame j = new JFrame("Interface");
- InterfaceClasse ic = new InterfaceClasse();
- j.add(ic);
- j.setSize(1300, 768);
- j.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- j.setVisible(true);
- j.setResizable(false);
- ic.setTemperatura(30.0f);
- ic.setTensao(24.0f);
- ic.setVelocidade(10.0f);
- }
- @Override
- public void mouseClicked(MouseEvent e) {
- InterfaceClasse ic = new InterfaceClasse();
- p=getMousePosition();
- if(p.x>=50 && p.x <=350 && p.y>=284 && p.y<=484){
- ic.setTensao(20.0f);
- ic.setTemperatura(25.5f);
- ic.setVelocidade(3.5f);
- System.out.println("Deu certo");
- }
- if(p.x>=950 && p.x <=1250 && p.y>=284 && p.y<=484){
- ic.setTensao(27.0f);
- ic.setTemperatura(33.5f);
- ic.setVelocidade(14.0f);
- System.out.println("Deu certo");
- }
- if(p.x>=500 && p.x <=800 && p.y>=50 && p.y<=250){
- ic.setTensao(24.0f);
- ic.setTemperatura(35.5f);
- ic.setVelocidade(10.0f);
- System.out.println("Deu certo");
- }
- if(p.x>=500 && p.x <=800 && p.y>=518 && p.y<=718){
- ic.setTensao(17.0f);
- ic.setTemperatura(17.3f);
- ic.setVelocidade(2.0f);
- System.out.println("Deu certo");
- }
- }
- @Override
- public void mousePressed(MouseEvent e) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
- @Override
- public void mouseReleased(MouseEvent e) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
- @Override
- public void mouseEntered(MouseEvent e) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
- @Override
- public void mouseExited(MouseEvent e) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement