001    /*
002     * @(#)MohrTheory.java
003     */
004    
005    import java.awt.*;
006    import java.awt.event.*;
007    import javax.swing.*;
008    import javax.swing.event.*;
009    import javax.swing.border.*;
010    
011    /**
012     * MohrTheory.java - Dialogo de equações e convenção de sinais
013     * do programa de círculo de Mohr.
014     *
015     * <p>
016     * Descrição:
017     * <p>
018     * ===============================================================
019     * <p>
020     * Este arquivo contém funções que disparam um diálogo com os
021     * equações e convenção de sinais do programa de círculo de Mohr.
022     *
023     * <p>
024     * ===============================================================
025     *
026     * @version    1.0 04/09/2004
027     * @author     Luiz Fernando Martha
028     * @author     Alonso Juvinao Carbono
029     * @author     Anderson Resende Pereira
030     * @author     Fernando Busato Ramires
031     * @author     Paôla Reginal Dalcanal
032     * @author     Ricardo Rodrigues de Araujo  
033     *
034     */
035    class MohrTheory extends JDialog
036    {
037      private MohrControls controls;
038      private JTabbedPane tabbedpane;
039      private JLabel signconvpor;
040      private JLabel signconveng;
041      private JLabel circlepor;
042      private JLabel circleeng;
043      private JLabel polepor;
044      private JLabel poleeng;
045      private JLabel controlptspor;
046      private JLabel controlptseng;
047    
048      public MohrTheory( MohrControls controls )
049      {
050        this.controls = controls;
051        setTitle( "Resumo da teoria do círculo de Mohr" );
052    
053        tabbedpane = new JTabbedPane();
054        tabbedpane.setTabPlacement(JTabbedPane.TOP);
055        getContentPane().add(tabbedpane, BorderLayout.CENTER);
056    
057        signconvpor = new JLabel(new ImageIcon(getClass().getResource(
058                                                      "images/signconvpor.gif")));
059        signconveng = new JLabel(new ImageIcon(getClass().getResource(
060                                                      "images/signconveng.gif")));
061        circlepor = new JLabel(new ImageIcon(getClass().getResource(
062                                                      "images/circlepor.gif")));
063        circleeng = new JLabel(new ImageIcon(getClass().getResource(
064                                                      "images/circleeng.gif")));
065        polepor = new JLabel(new ImageIcon(getClass().getResource(
066                                                      "images/polepor.gif")));
067        poleeng = new JLabel(new ImageIcon(getClass().getResource(
068                                                      "images/poleeng.gif")));
069        controlptspor = new JLabel(new ImageIcon(getClass().getResource(
070                                                      "images/controlptspor.gif")));
071        controlptseng = new JLabel(new ImageIcon(getClass().getResource(
072                                                      "images/controlptseng.gif")));
073    
074        tabbedpane.add( "Convenção de Sinais", signconvpor );
075        tabbedpane.add( "Círculo de Mohr", circlepor );
076        tabbedpane.add( " Pólo ", polepor );
077        tabbedpane.add( "Pontos de Controle", controlptspor );
078    
079        tabbedpane.getModel().addChangeListener(
080         new ChangeListener() {
081          public void stateChanged(ChangeEvent e) {
082           SingleSelectionModel model = (SingleSelectionModel) e.getSource();
083          }
084         } );
085    
086        JButton btOK = new JButton("OK");
087        ActionListener lst = new ActionListener() { 
088          public void actionPerformed(ActionEvent e) {
089            exit_dlg();
090          }
091        };
092        btOK.addActionListener(lst);
093        JPanel p = new JPanel();
094        p.add(btOK);
095        getContentPane().add(p, BorderLayout.SOUTH);
096    
097        addWindowListener( new WindowAdapter() {
098         public void windowClosing( WindowEvent e ) {
099          exit_dlg();
100         }
101        } );
102    
103        pack();
104        setResizable(false);
105      }
106    
107      private void exit_dlg( )
108      {
109       setVisible(false);
110       controls.resetTheoryDlg();
111      }
112    
113      public void setPortuguese( )
114      {
115       setTitle( "Resumo da teoria do círculo de Mohr" );
116       tabbedpane.setTitleAt( 0, "Convenção de Sinais" );
117       tabbedpane.setComponentAt( 0, signconvpor );
118       tabbedpane.setTitleAt( 1, "Círculo de Mohr" );
119       tabbedpane.setComponentAt( 1, circlepor );
120       tabbedpane.setTitleAt( 2, " Pólo " );
121       tabbedpane.setComponentAt( 2, polepor );
122       tabbedpane.setTitleAt( 3, "Pontos de Controle" );
123       tabbedpane.setComponentAt( 3, controlptspor );
124      }
125    
126      public void setEnglish( )
127      {
128       setTitle( "Summary of Mohr's circle theory" );
129       tabbedpane.setTitleAt( 0, "Sign Convention" );
130       tabbedpane.setComponentAt( 0, signconveng );
131       tabbedpane.setTitleAt( 1, "Mohr's Circle" );
132       tabbedpane.setComponentAt( 1, circleeng );
133       tabbedpane.setTitleAt( 2, " Pole " );
134       tabbedpane.setComponentAt( 2, poleeng );
135       tabbedpane.setTitleAt( 3, "Control Points" );
136       tabbedpane.setComponentAt( 3, controlptseng );
137      }
138    }
139