You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.6 KiB

/*
* TecnicosPanel.java
*
* Created on 12 de Fevereiro de 2006, 17:48
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package siprp.higiene.mapa;
import java.awt.*;
import javax.swing.*;
import siprp.higiene.*;
/**
*
* @author Frederico
*/
public class TecnicosPanel extends JPanel
{
protected HigieneDataProvider provider;
/** Creates a new instance of TecnicosPanel */
public TecnicosPanel()
throws Exception
{
provider = ( HigieneDataProvider ) HigieneDataProvider.getProvider();
setupComponents();
}
private void setupComponents()
throws Exception
{
Object tecnicos[][] = provider.getAllTecnicosHST();
GridBagLayout gridbag = new GridBagLayout();
setLayout( gridbag );
GridBagConstraints constraints = new GridBagConstraints();
constraints.insets = new Insets( 1, 1, 1, 1 );
constraints.fill = GridBagConstraints.HORIZONTAL;
constraints.gridheight = 1;
constraints.weighty = 0;
for( int n = 0; n < tecnicos.length; n++ )
{
constraints.weightx = 0;
constraints.gridwidth = 1;
JLabel corLabel = new JLabel( " " );
corLabel.setBackground( HigieneDataProvider.CORES_TECNICOS[ ( ( Integer ) tecnicos[ n ][ 3 ] ).intValue() ] );
corLabel.setOpaque( true );
gridbag.setConstraints( corLabel, constraints );
add( corLabel );
constraints.weightx = 1;
constraints.gridwidth = GridBagConstraints.REMAINDER;
JLabel nomeLabel = new JLabel( (String)tecnicos[ n ][ 1 ] );
gridbag.setConstraints( nomeLabel, constraints );
add( nomeLabel );
}
}
}