Guest User

Untitled

a guest
Jun 30th, 2016
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.97 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package Interface;
  7.  
  8. import java.awt.Color;
  9. import java.awt.Font;
  10. import java.awt.Graphics;
  11. import java.awt.Graphics2D;
  12. import java.awt.GraphicsDevice;
  13. import java.awt.GraphicsEnvironment;
  14. import javax.swing.JLabel;
  15. import javax.swing.JPanel;
  16.  
  17. /**
  18.  *
  19.  * @author Pessoal
  20.  */
  21. public class InterfaceClasse extends JPanel{
  22.     private float temperatura, velocidade, tensao;
  23.     JLabel j;
  24.    
  25.     public InterfaceClasse(){
  26.         int width, height;
  27.         j = new JLabel("Temperatura");
  28.         this.setSize(1200, 800);
  29.     }
  30.     @Override
  31.     public void paintComponent(Graphics g){
  32.        
  33.         super.paintComponent(g);
  34.         Graphics2D g2d = (Graphics2D) g;
  35.         g2d.setColor(new Color(43,132,156));
  36.         g2d.setFont(new Font("Serif", Font.BOLD, 20));
  37.         g2d.drawString("Velocidade: ", 30, 20);
  38.         String vel = Float.toString(velocidade);
  39.         g2d.drawString(vel, "Velocidade: ".length()*10 + 15, 20);
  40.         g2d.drawString("Temperatura: ", 30, 60);
  41.         String temp = Float.toString(temperatura);
  42.         g2d.drawString(temp, "Temperatuda: ".length() *11+10, 60);
  43.         g2d.drawString("Tensão de entrada: ", 30, 100);
  44.         String tens = Float.toString(tensao);
  45.         g2d.drawString(tens, "Tensao de entrada: ".length() *10+10, 100);
  46.     }
  47.  
  48.     public float getTemperatura() {
  49.         return temperatura;
  50.     }
  51.  
  52.     public void setTemperatura(float temperatura) {
  53.         this.temperatura = temperatura;
  54.     }
  55.  
  56.     public float getVelocidade() {
  57.         return velocidade;
  58.     }
  59.  
  60.     public void setVelocidade(float velocidade) {
  61.         this.velocidade = velocidade;
  62.     }
  63.  
  64.     public float getTensao() {
  65.         return tensao;
  66.     }
  67.  
  68.     public void setTensao(float tensao) {
  69.         this.tensao = tensao;
  70.     }
  71.    
  72. }
Add Comment
Please, Sign In to add comment