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.Color;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import java.awt.GraphicsDevice;
- import java.awt.GraphicsEnvironment;
- import javax.swing.JLabel;
- import javax.swing.JPanel;
- /**
- *
- * @author Pessoal
- */
- public class InterfaceClasse extends JPanel{
- private float temperatura, velocidade, tensao;
- JLabel j;
- public InterfaceClasse(){
- int width, height;
- j = new JLabel("Temperatura");
- this.setSize(1200, 800);
- }
- @Override
- public void paintComponent(Graphics g){
- super.paintComponent(g);
- Graphics2D g2d = (Graphics2D) g;
- g2d.setColor(new Color(43,132,156));
- g2d.setFont(new Font("Serif", Font.BOLD, 20));
- g2d.drawString("Velocidade: ", 30, 20);
- String vel = Float.toString(velocidade);
- g2d.drawString(vel, "Velocidade: ".length()*10 + 15, 20);
- g2d.drawString("Temperatura: ", 30, 60);
- String temp = Float.toString(temperatura);
- g2d.drawString(temp, "Temperatuda: ".length() *11+10, 60);
- g2d.drawString("Tensão de entrada: ", 30, 100);
- String tens = Float.toString(tensao);
- g2d.drawString(tens, "Tensao de entrada: ".length() *10+10, 100);
- }
- public float getTemperatura() {
- return temperatura;
- }
- public void setTemperatura(float temperatura) {
- this.temperatura = temperatura;
- }
- public float getVelocidade() {
- return velocidade;
- }
- public void setVelocidade(float velocidade) {
- this.velocidade = velocidade;
- }
- public float getTensao() {
- return tensao;
- }
- public void setTensao(float tensao) {
- this.tensao = tensao;
- }
- }
Add Comment
Please, Sign In to add comment