Package Interface

Source Code of Interface.JanelaDaAplicacao

package Interface;

import Dados.Paciente;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Container;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.JPanel;

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/*
* JanelaDaAplicacao.java
*
* Created on 13/07/2011, 15:37:43
*/
/**
*
* @author Cecilia
*/
public class JanelaDaAplicacao extends javax.swing.JFrame {

    final static String MENUPRINCIPAL = "Card with main menu";
    final static String CADASTRO = "Card with cadastro";
    final static String ALTERACAO = "Card with alteracao";
    final static String HISTORICO = "Card with historico";
    final static String ACOMPANHAMENTO = "Card with acompanhamento";
    final static String SENSOR_NOME = "Card with sensor -> nome";
   
    final static int MENUPRINCIPAL_int = 1;
    final static int CADASTRO_int = 0;
    final static int ALTERACAO_int = 2;
    final static int HISTORICO_int = 3;
    final static int ACOMPANHAMENTO_int = 4;
    final static int SENSOR_NOME_int = 5;
   
    /** Creates new form JanelaDaAplicacao */
    public JanelaDaAplicacao() {
        initComponents();
        addComponentToPane();
    }

    private void addComponentToPane() {
        //Create the "cards".
        MenuPrincipal menu = new MenuPrincipal();
        Cadastro cadastro = new Cadastro();
        Alteracao alteracao = new Alteracao();
        DadosHistoricos historico = new DadosHistoricos();
        AcompanhamentoSessao acompanhamento = new AcompanhamentoSessao();
        SensorNome sensorNome = new SensorNome();
        //Create the panel that contains the "cards".
        Container cards = getContentPane();
        cards.setName("Cards");
        cards.add(cadastro, CADASTRO);
        cards.add(menu, MENUPRINCIPAL);
        cards.add(alteracao, ALTERACAO);
        cards.add(historico, HISTORICO);
        cards.add(acompanhamento, ACOMPANHAMENTO);
        cards.add(sensorNome, SENSOR_NOME);
        //((CardLayout)cards.getLayout()).show(cards,MENUPRINCIPAL);
        cards.addPropertyChangeListener("preferredSize", new PropertyChangeListener() {

            @Override
            public void propertyChange(PropertyChangeEvent evt) {
//                System.out.println( ((Component)evt.getSource()).getName());
                pack();
            }
        });
        CardLayout cardLayout = (CardLayout) getContentPane().getLayout();
        cardLayout.show(getContentPane(),MENUPRINCIPAL);
    }
   
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("FlexMeter");
        getContentPane().setLayout(new java.awt.CardLayout());

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new JanelaDaAplicacao().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables
}
TOP

Related Classes of Interface.JanelaDaAplicacao

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.