/* * ExamePanel.java * * Created on 29 de Março de 2004, 11:57 */ package siprp.ficha; import java.awt.*; import javax.swing.*; import java.util.*; import com.evolute.utils.ui.*; import com.evolute.utils.ui.button.*; /** * * @author fpalma */ public class ExamePanel extends JPanel { private JCalendarPanel dataExamePanel; private BetterButtonGroup tipoGroup; private RadioButtonGroup ocasionalGroup; private JTextField especificarText; private RadioButtonGroup resultadoGroup; private JTextField outrasFuncoesTexts[]; /** Creates a new instance of ExamePanel */ public ExamePanel() { setupComponents(); } private void setupComponents() { setBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Exame M\u00e9dico" ) ); JPanel leftPanel = new JPanel(); JPanel rightPanel = new JPanel(); rightPanel.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Resultado" ) ); JPanel dataExameOuterPanel = new JPanel(); JLabel dataExameLabel = new JLabel( "Data do Exame" ); dataExamePanel = new JCalendarPanel( null ); JPanel tipoPanel = new JPanel(); tipoPanel.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Tipo" ) ); tipoGroup = new BetterButtonGroup( false ); JRadioButton admissaoRadio = new JRadioButton( "Admiss\u00e3o" ); tipoGroup.add( admissaoRadio ); JRadioButton periodicoRadio = new JRadioButton( "Peri\u00f3dico" ); tipoGroup.add( periodicoRadio ); JRadioButton ocasionalRadio = new JRadioButton( "Ocasional" ); tipoGroup.add( ocasionalRadio ); JRadioButton outroRadio = new JRadioButton( "Outro" ); tipoGroup.add( outroRadio ); JPanel ocasionalPanel = new JPanel(); ocasionalPanel.setBorder( BorderFactory.createEtchedBorder() ); ocasionalGroup = new RadioButtonGroup( ocasionalPanel, new Vector( Arrays.asList( new String[]{ "Ap\u00f3s doen\u00e7a", "Ap\u00f3s acidente", "A pedido do trabalhador", "A pedido do servi\u00e7o", "Por mudan\u00e7a de fun\u00e7\u00e3o", "Por altera\u00e7\u00e3o das condi\u00e7\u00f5es de trabalho" } ) ), false, true ); especificarText = new JTextField(); JPanel resultadoPanel = new JPanel(); resultadoGroup = new RadioButtonGroup( resultadoPanel, new Vector( Arrays.asList( new String[]{ "Apto", "Apto condicionalmente", "Inapto temporariamente", "Inapto definitivamente" } ) ), false, true ); JLabel outrasFuncoesLabel = new JLabel( "Outras fun\u00e7\u00f5es que pode desempenhar", JLabel.CENTER ); JPanel outrasFuncoesPanel = new JPanel(); JLabel outrasFuncoesLabels[] = new JLabel[ 4 ]; outrasFuncoesTexts = new JTextField[ 4 ]; for( int n = 0; n < 4; n++ ) { outrasFuncoesLabels[ n ] = new JLabel( "" + ( n + 1 ) ); outrasFuncoesTexts[ n ] = new JTextField(); } setLayout( new GridLayout( 1, 2 ) ); add( leftPanel ); add( rightPanel ); leftPanel.setLayout( new BorderLayout() ); dataExameOuterPanel.setLayout( new BorderLayout() ); dataExameOuterPanel.add( dataExameLabel, BorderLayout.WEST ); dataExameOuterPanel.add( dataExamePanel, BorderLayout.CENTER ); leftPanel.add( dataExameOuterPanel, BorderLayout.NORTH ); leftPanel.add( tipoPanel, BorderLayout.CENTER ); GridBagLayout gridbag = new GridBagLayout(); tipoPanel.setLayout( gridbag ); GridBagConstraints constraints = new GridBagConstraints(); constraints.insets = new Insets( 1, 1, 1, 1 ); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.weighty = 0; constraints.gridheight = 1; constraints.weightx = 1; constraints.gridwidth = GridBagConstraints.REMAINDER; gridbag.setConstraints( admissaoRadio, constraints ); tipoPanel.add( admissaoRadio ); gridbag.setConstraints( periodicoRadio, constraints ); tipoPanel.add( periodicoRadio ); gridbag.setConstraints( ocasionalRadio, constraints ); tipoPanel.add( ocasionalRadio ); constraints.weightx = 0.1; constraints.gridwidth = 1; JPanel pad = new JPanel(); gridbag.setConstraints( pad, constraints ); tipoPanel.add( pad ); constraints.weightx = 0.9; constraints.gridwidth = GridBagConstraints.REMAINDER; gridbag.setConstraints( ocasionalPanel, constraints ); tipoPanel.add( ocasionalPanel ); constraints.weightx = 0; constraints.gridwidth = 1; gridbag.setConstraints( outroRadio, constraints ); tipoPanel.add( outroRadio ); constraints.weightx = 1; constraints.gridwidth = GridBagConstraints.REMAINDER; gridbag.setConstraints( especificarText, constraints ); tipoPanel.add( especificarText ); gridbag = new GridBagLayout(); rightPanel.setLayout( gridbag ); constraints.weightx = 1; constraints.gridwidth = GridBagConstraints.REMAINDER; constraints.gridheight = 1; constraints.weighty = 0; gridbag.setConstraints( resultadoPanel, constraints ); rightPanel.add( resultadoPanel ); gridbag.setConstraints( outrasFuncoesLabel, constraints ); rightPanel.add( outrasFuncoesLabel ); gridbag.setConstraints( outrasFuncoesPanel, constraints ); rightPanel.add( outrasFuncoesPanel ); for( int n = 0; n < outrasFuncoesTexts.length; n++ ) { constraints.weightx = 0.1; constraints.gridwidth = 1; pad = new JPanel(); gridbag.setConstraints( pad, constraints ); rightPanel.add( pad ); constraints.weightx = 0; gridbag.setConstraints( outrasFuncoesLabels[ n ], constraints ); rightPanel.add( outrasFuncoesLabels[ n ] ); constraints.weightx = 1; constraints.gridwidth = GridBagConstraints.REMAINDER; gridbag.setConstraints( outrasFuncoesTexts[ n ], constraints ); rightPanel.add( outrasFuncoesTexts[ n ] ); } } }