Window - Preferences - Java - Code Style - Code Templates
<em>/
import java.sql.</em>;
import <a href="http://javax.net">javax.net</a>.<em>;
import java.awt.</em>;
import java.awt.event.<em>;
import javax.swing.</em>;
public class Principal extends JApplet{
//*****<strong><strong><strong><strong>Definições das Variáveis</strong></strong></strong></strong>
Image logo1, logo2;
Panel Painel1,Painel2,Painel3,PPedido;
JButton BEntrar,BSair,BConecta,BMInicial,BMPedidos,BMRelatorios,BMSair;
JTextField TUsuario,TPNumero,TPCodigoCliente,TPCliente,TPTelefone;
JPasswordField TSenha;
JLabel Label1, Label2,Label3,PLabel1,PLabel2,PLabel3,PLabel4;
String Senha,Usuario;
//*******************************************************************************************
//<strong><strong><strong><strong>Manipulação dos Componentes</strong></strong></strong></strong>***
getContentPane().setLayout(null);
Painel1.setLayout(null); Painel2.setLayout(null);
Painel3.setLayout(null); PPedido.setLayout(null);
Painel1.setBackground(Color.WHITE); Painel2.setBackground(Color.WHITE);
Painel1.reshape(600,0,200,100); Painel2.reshape(5,100,200,100);
Painel3.reshape(225,100,500,280); PPedido.reshape(225,100,500,280);
TUsuario.reshape(70,5,90,20); TSenha.reshape(70,30,90,20);
TPNumero.reshape(100,5,90,20); TPCodigoCliente.reshape(100,25,90,20);
TPCliente.reshape(100,45,200,20); TPTelefone.reshape(100,65,90,20);
BEntrar.reshape(0,55,80,20); BSair.reshape(80,55,80,20); BConecta.reshape(0,75,80,20);
Label1.reshape(0,5,70,25); Label2.reshape(0,30,70,25); Label3.reshape(100,50,200,200);
PLabel1.reshape(0,5,90,20); PLabel2.reshape(0,25,90,20);
PLabel3.reshape(0,45,90,20); PLabel4.reshape(0,65,90,20);
BMInicial.reshape(0,0,200,25); BMPedidos.reshape(0,25,200,25);
BMRelatorios.reshape(0,50,200,25); BMSair.reshape(0,75,200,25);
BMInicial.setBackground(Color.ORANGE); BMPedidos.setBackground(Color.ORANGE);
BMRelatorios.setBackground(Color.ORANGE); BMSair.setBackground(Color.ORANGE);
int i=0;
(new Integer(i)).toString();
TPNumero.setText(""+i);
i++;
//**********************************************************************************************
//<em><strong><em><strong><strong><strong><strong><strong>Adicionando os Componentes</strong></strong></strong></strong></strong></em>
logo1 = getImage(getDocumentBase(), “logo.jpg”);
getContentPane().add(Painel1);
getContentPane().add(Painel2);
getContentPane().add(Painel3);
getContentPane().add(PPedido);
Painel3.setVisible(false);
PPedido.setVisible(false);
Painel1.add(BEntrar); Painel1.add(BSair); Painel1.add(BConecta);
Painel1.add(TUsuario); Painel1.add(TSenha);
Painel1.add(Label1); Painel1.add(Label2);
Painel2.add(BMInicial); Painel2.add(BMPedidos);
Painel2.add(BMRelatorios); Painel2.add(BMSair);
Painel3.add(Label3);
PPedido.add(TPNumero); PPedido.add(TPCodigoCliente);
PPedido.add(TPCliente); PPedido.add(TPTelefone);
PPedido.add(PLabel1); PPedido.add(PLabel2);
PPedido.add(PLabel3); PPedido.add(PLabel4);
//</strong></em>*************************************************
}
/<em>public void start(){
try
{
Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”);
}
catch(ClassNotFoundException Erro)
{
}
try
{
Connection Conexao = DriverManager.getConnection(“jdbc:odbc:Driver=” +
"{Microsoft Access Driver (</em>.mdb)};" +
“DBQ=C:\Projeto\Representantes\Representantes\bin\teste.mdb”,"","");
Statement FluxoSQL = Conexao.createStatement();
Statement InstrucaoSelectSQL = Conexao.createStatement();
ResultSet Resultados = InstrucaoSelectSQL.executeQuery(“SELECT Cliente FROM Tab_Cliente”);
Resultados.next();
String Cliente = Resultados.getString(1).trim();
System.out.println(“Cliente = " + Cliente);
TPCliente.setText(” " + Cliente);
InstrucaoSelectSQL.close();
Conexao.close();
}
catch(SQLException Erro)
{
}
}*/
public void paint(Graphics G){
int Altura; Font Fonte; FontMetrics MedidasFonte;
G.drawImage(logo1,0,1,this);