Change language of menu

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aleplgr
    New Member
    • Aug 2007
    • 19

    Change language of menu

    Hi! I'm trying to let the end-user select the language of the menues I'm showing him.
    To do that I've got this Selector class that shows the end user a combo box, a label and a button. In the combo box the user selects the language (English,Spanis h,French,..) and when he clicks in the button shows the label in the language selected.
    This works fine but it's just one form, I need to change the language of all the menues in an application, so now I've got the Menus class which shows some items one of them is FILE, when you select FILE, then CONFIGURATION you are in the Selector class.
    Now I need to change the items in the menu class when you change the language in the Selector. Do I have to declare all the Menus items in the Selector class to do that?
    Any help will be appreciated


    Code:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.*;
    
    public class Selector extends javax.swing.JFrame
    {
    //private ResourceBundle resources;
    private javax.swing.JLabel jEtSaludo;
    private javax.swing.JButton jBtSaludo;
    private javax.swing.JComboBox langList;
    private javax.swing.JButton jbtAceptar;
    private javax.swing.JLabel jlbGradosC;
    public javax.swing.JMenu jmnuArchivo;  
    
      public Selector()      // constructor
      { //loadResources();
        setSize(300, 200);      // tamaño del formulario
        setTitle("Language Selector"); // título del formulario
        initComponents();       // iniciar controles o componentes
      }
       			
    	  
        private void initComponents()//GEN-BEGIN:initComponents
      {
      
       getContentPane().setLayout(null);
          addWindowListener(new java.awt.event.WindowAdapter()
            {
              public void windowClosing(java.awt.event.WindowEvent evt)
                {
              exitForm(evt);
                }
            });
    	 	 	 
    	
    	 jlbGradosC = new javax.swing.JLabel();
    	 jlbGradosC.setText("TestLabel");
    	 getContentPane().add(jlbGradosC);
    	 jlbGradosC.setBounds(12,28,116,16);
     	 
    	 String[] langStrings = { "Español", "French", "Dutch", "Catalan", "Ingles" };
    
       langList = new JComboBox(langStrings);
       langList.setSelectedIndex(4);
       getContentPane().add(langList);
    	langList.setBounds(42,90,204,30);
    	
    	jbtAceptar= new javax.swing.JButton();
    	jbtAceptar.setText("Aceptar");
    	getContentPane().add(jbtAceptar);
    	jbtAceptar.setBounds(195,20,85,26);
       jbtAceptar.addActionListener(new java.awt.event.ActionListener()
        {
          public void actionPerformed(java.awt.event.ActionEvent evt)
          {
            jbtAceptarActionPerformed(evt);
          }
        });
    					
      }//GEN-END:initComponents
       
    
    private void jbtAceptarActionPerformed(java.awt.event.ActionEvent evt)
     {
    
      Object nombre;
      nombre = langList.getSelectedItem();
     
            System.out.println("Language--> " + nombre);
            if(nombre.equals("Ingles")){
                Locale localizacion = Locale.US;  //en inglés
                ResourceBundle mensajes = ResourceBundle.getBundle("Datos",localizacion);      
                jlbGradosC.setText(mensajes.getString("Etiquetaprueba"));
    				
    			
    }
    
    else if(nombre.equals("Español")){
                Locale localizacion2;
               localizacion2 = new Locale("es", "ES");
                ResourceBundle mensajes = ResourceBundle.getBundle("Datos",localizacion2);      
               jlbGradosC.setText(mensajes.getString("Etiquetaprueba"));
    			  	
    				 
     }
    
    else if(nombre.equals("Catalan")){
                Locale localizacion3;
               localizacion3 = new Locale("ca", "ES");
                ResourceBundle mensajes = ResourceBundle.getBundle("Datos",localizacion3);      
               jlbGradosC.setText(mensajes.getString("Etiquetaprueba"));
    		
    			
    				 }
     
     
     
    }  
        
    
      /** Exit the Application */
      private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm
        System.exit (0);
      }//GEN-LAST:event_exitForm
    
    	
    	
    	
    		
      public static void main (String args[])
      {
        new Selector().setVisible(true);
      }
    	 	
    	
    }

    Code:
    import java.awt.event.*; 
    import java.util.ResourceBundle; 
    
    
    public class Menus extends javax.swing.JFrame 
    { 
    //ResourceBundle res = ResourceBundle.getBundle("Resources"); 
    
    
    public Menus() 
    { 
    setSize(500, 300); 
    //String title = res.getString("TITLE"); 
    this.setTitle("APPLICATION TITLE"); 
    initComponents(); 
    } 
    
    
    private void initComponents() 
    { 
    jmbarBarraDeMenus = new javax.swing.JMenuBar(); 
    
    jmnuArchivo = new javax.swing.JMenu(); 
    String fi = res.getString("FILE"); 
    jmnuArchivo.setText("FILE"); 
    //jmbarBarraDeMenus.add(jmnuArchivo); 
     
    
    jmnuHelp = new javax.swing.JMenu(); 
    //String hel = res.getString("HELP"); 
    jmnuHelp.setText("HELP"); 
    jmbarBarraDeMenus.add(jmnuHelp);
    
    jmnuLang = new javax.swing.JMenu(); 
    //String lang = res.getString("LANGUAGE"); 
    jmnuLang.setText("ABOUT"); 
    jmbarBarraDeMenus.add(jmnuLang);
    
     
    
    jmnuAbrir = new javax.swing.JMenuItem(); 
    //String op = res.getString("OPEN"); 
    jmnuAbrir.setText("OPEN"); 
    
    
    jmnuArchivo.add(jmnuAbrir); 
    
    
    jmnuConfigura = new javax.swing.JMenuItem(); 
    //String co = res.getString("CONFIGURATION"); 
    jmnuConfigura.setText("CONFIGURATION"); 
    jmnuArchivo.add(jmnuConfigura); 
    jmnuConfigura.addActionListener(new ActionListener() { 
    public void actionPerformed(ActionEvent e) { 
    jMenuConf_actionPerformed(e); 
    } 
    }); 
    
    
    
    getContentPane().setLayout(null); 
    addWindowListener(new java.awt.event.WindowAdapter() 
    { 
    public void windowClosing(java.awt.event.WindowEvent evt) 
    { 
    exitForm(evt); 
    } 
    }); 
    setJMenuBar(jmbarBarraDeMenus); 
    }//GEN-END:initComponents 
    
    /** Exit the Application */ 
    private void exitForm(java.awt.event.WindowEvent evt) { 
    System.exit (0); 
    } 
    
    
    void jMenuConf_actionPerformed(ActionEvent e) { 
    Selector dlg = new Selector(); 
    dlg.setVisible(true) ; 
    } 
    
    
    public static void main (String args[]) 
    { 
    new Menus().setVisible(true); 
    } 
    
    private javax.swing.JMenuBar jmbarBarraDeMenus; 
    public javax.swing.JMenu jmnuArchivo; 
    private javax.swing.JMenu jmnuHelp; 
    private javax.swing.JMenu jmnuLang;
    private javax.swing.JMenuItem jmnuAbrir; 
    private javax.swing.JMenuItem jmnuConfigura; 
    
    }
  • praveen2gupta
    New Member
    • May 2007
    • 200

    #2
    Hi
    A i got your point is that you wants the menu and menu bar should be displayed on the basis of language selected by the user.

    Since the text are fixed and we set them using a method ( jmnuLang.setTex t("ABOUT"); ). In the above case you should set the labels of the menu on the basis of selection of language you can try use if -else if statement or switch statement and then place the labels on the respective language.

    Comment

    • JosAH
      Recognized Expert MVP
      • Mar 2007
      • 11453

      #3
      Originally posted by praveen2gupta
      Hi
      A i got your point is that you wants the menu and menu bar should be displayed on the basis of language selected by the user.

      Since the text are fixed and we set them using a method ( jmnuLang.setTex t("ABOUT"); ). In the above case you should set the labels of the menu on the basis of selection of language you can try use if -else if statement or switch statement and then place the labels on the respective language.
      No, that's not the way to go: as soon as another language needs to be supported
      the if statements or switch statements in all the 'localizable' components need
      to be changed and augmented.

      Better turn those components to observers (or listeners) and as soon as a language
      changes the observers must be notified (the Localizer object should therefor be
      an observable).

      The observers pass the I18N key to the Localizer and receive their new localized
      text. A bit of bookkeeping takes care of the rest.

      kind regards,

      Jos

      Comment

      • aleplgr
        New Member
        • Aug 2007
        • 19

        #4
        Yes, now I have the listener which is the Selector class I post here.
        It works fine but there's a problem I can't solve:
        I have a Menus class which is only a menu with 3 items: File,Help and Descriptive. when you select the File item there is the Configuration item where there is a combo box to select the language, when you select a language and click the button it changes the language of the File,Help and Descriptive items, that works fine.
        But now in the Descriptive item there's the Test item where when you click it I'm trying to display another panel (the last one I post here) with 2 labels and a button that I need to also change when you select a language in the Configuration panel but it's not working, I think that the problem is at the end of class Menus, in this method the message "hello I'm hereeeeee" is printed butthe conv panel is never created

        Code:
        private void jMenuUniva_actionPerformed(ActionEvent e)
           {
        	   System.out.println("hello I'm hereeeeee");
             Conver conv = new Conver(this);
              res = ResourceBundle.getBundle("Resources");
              updateStrings();
        			
           }




        Code:
        import java.awt.event.*;
        import java.util.*;
        import javax.swing.*;
        
        public class Menus extends JFrame
        {
           public ResourceBundle res;
           private JMenuBar jmbarBarraDeMenus;
           private JMenu jmnuArchivo;
           private JMenu jmnuHelp;
        	private JMenu jmnuDescriptiva;//agregué
           private JMenuItem jmnuAbrir;
           private JMenuItem jmnuConfigura;
        	private JMenuItem jmnuUniva;//agregué
        
        		//private javax.swing.JLabel jlbGradosC;
        
           public Menus()
           {
              Locale.setDefault(new Locale("en")); //Inglés
              res = ResourceBundle.getBundle("Resources");
              setSize(500, 300);
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              initComponents();
              updateStrings();
              setVisible(true);
           }
        
           private void initComponents()
           {
              jmbarBarraDeMenus = new javax.swing.JMenuBar();
              jmnuArchivo = new javax.swing.JMenu();
        		jmnuDescriptiva = new javax.swing.JMenu();//agregué 
        
              jmbarBarraDeMenus.add(jmnuArchivo);
        		
              jmnuHelp = new javax.swing.JMenu();
              jmbarBarraDeMenus.add(jmnuHelp);
        		jmbarBarraDeMenus.add(jmnuDescriptiva);
        		
              jmnuAbrir = new javax.swing.JMenuItem();
              jmnuArchivo.add(jmnuAbrir);
              jmnuConfigura = new javax.swing.JMenuItem();
              jmnuArchivo.add(jmnuConfigura);
        		
        		jmnuUniva = new javax.swing.JMenuItem();//agregue	
              jmnuDescriptiva.add(jmnuUniva);//agregué
        
        		
        		// jlbGradosC = new javax.swing.JLabel();
        
        		
              jmnuConfigura.addActionListener(
                 new ActionListener()
                 {
                    public void actionPerformed(ActionEvent e)
                    {
                       jMenuConf_actionPerformed(e);
                    }
                 });
             jmnuUniva.addActionListener(
                 new ActionListener()
                 {
                    public void actionPerformed(ActionEvent e)
                    {
                       jMenuUniva_actionPerformed(e); //agregué
                    }
                 });
        			
        			
        			
        			
        			
        	   getContentPane().setLayout(null);
              setJMenuBar(jmbarBarraDeMenus);
           }
        	
        	
        	
        	
        
           private void updateStrings()
           {
              setTitle(res.getString("TITLE"));
              jmnuArchivo.setText(res.getString("FILE"));
              jmnuHelp.setText(res.getString("HELP"));
              jmnuAbrir.setText(res.getString("OPEN"));
              jmnuConfigura.setText(res.getString("CONFIGURATION"));
        		jmnuDescriptiva.setText(res.getString("DESCRIPTIVE"));
        		jmnuUniva.setText(res.getString("UNIVARIANTE"));      
           }
        
           private void jMenuConf_actionPerformed(ActionEvent e)
           {
              Selector dlg = new Selector(this);
              res = ResourceBundle.getBundle("Resources");
              updateStrings();
           }
        	
         private void jMenuUniva_actionPerformed(ActionEvent e)//Agregué esto
           {
        	   System.out.println("hello I'm hereeeeee");
             Conver conv = new Conver(this);
              res = ResourceBundle.getBundle("Resources");
              updateStrings();
        	
        		
           }
        	
        	
        
           public static void main(String args[])
           {
              new Menus();
           }
        }


        The Selector class

        public class Selector extends JDialog implements ActionListener
        {
        private final static String[] LANG_STRINGS = { "Spanish", "French", "Dutch", "Chinese", "English" };
        private final static String[] LOCALES = { "es", "fr", "nl", "cn", "en"};
        private static int lastIndex = 4;
        private JComboBox langList;
        private JButton OKButton;

        public Selector(JFrame owner)
        {
        super(owner, true);
        setSize(300, 200);
        setTitle("Langu age Selector");
        initComponents( );
        setVisible(true );
        }

        private void initComponents( )
        {
        getContentPane( ).setLayout(nul l);
        addWindowListen er(
        new java.awt.event. WindowAdapter()
        {
        public void windowClosing(W indowEvent evt)
        {
        dispose();
        }
        });
        langList = new JComboBox(LANG_ STRINGS);
        langList.setSel ectedIndex(last Index);
        langList.setBou nds(42, 50, 204, 30);
        getContentPane( ).add(langList) ;
        OKButton = new JButton("OK");
        OKButton.setBou nds(90, 110, 100, 30);
        OKButton.setAct ionCommand("sel eccionar");
        OKButton.addAct ionListener(thi s);
        getContentPane( ).add(OKButton) ;
        }

        public void actionPerformed (ActionEvent e)
        {
        if (e.getActionCom mand().equals(" seleccionar"))
        {
        lastIndex = langList.getSel ectedIndex();
        Locale.setDefau lt(new Locale(LOCALES[lastIndex]));
        dispose();
        }
        }

        public static void main(String args[])
        {
        new Selector(null);
        }
        }



        dfsg

        import java.awt.*;
        import java.awt.event. *;
        import javax.swing.*;
        import java.util.*;


        public class Conver extends JFrame
        {
        /**Crear un nuevo formulario Conver*/
        public Conver(JFrame owner)
        {
        setSize(500,200 );//tamaño del formulario
        setTitle("Conve rsion de temperaturas");//titulo del formulario
        initComponents( );//iniciar componenetes
        }

        /** El siguiente metodo es llamado por el constructorpara iniciar el formulario**/
        private void initComponents( )
        {
        //Crear los objetos
        jlbGradosC = new javax.swing.JLa bel();
        jtfGradosC = new javax.swing.JTe xtField();
        jlbGradosF = new javax.swing.JLa bel();
        jtfGradosF = new javax.swing.JTe xtField();
        jbtAceptar = new javax.swing.JBu tton();

        getContentPane( ).setLayout(nul l);
        addWindowListen er(new java.awt.event. WindowAdapter()
        {
        public void windowClosing(j ava.awt.event.W indowEvent evt)
        {
        exitForm(evt);
        }
        }
        );
        //Etiqueta "Grados centigrados"
        jlbGradosC.setT ext("Grados Centigrados");
        getContentPane( ).add(jlbGrados C);
        jlbGradosC.setB ounds(12,28,116 ,16);

        //Caja de texto para los grados centigrados
        jtfGradosC.setT ext("0.00");
        jtfGradosC.setH orizontalAlignm ent(javax.swing .SwingConstants .RIGHT);
        getContentPane( ).add(jtfGrados C);
        jtfGradosC.setB ounds(132,28,14 4,20);

        //Etiqueta "Grados Fahrenheit"
        jlbGradosF.setT ext("Grados fahrenheit");
        getContentPane( ).add(jlbGrados F);
        jlbGradosF.setB ounds(12,68,104 ,24);

        //Caja de texto para los grados fahreneit
        jtfGradosF.setT ext("32.00");
        jtfGradosF.setH orizontalAlignm ent(javax.swing .SwingConstants .RIGHT);
        getContentPane( ).add(jtfGrados F);
        jtfGradosF.setB ounds(132,72,14 4,20);

        //Boton Aceptar
        jbtAceptar.setT ext("Aceptar");
        jbtAceptar.setM nemonic('A');
        getRootPane().s etDefaultButton (jbtAceptar);
        getContentPane( ).add(jbtAcepta r);
        jbtAceptar.setB ounds(132,120,1 44,24);


        java.awt.event. KeyAdapter kl=
        new java.awt.event. KeyAdapter()
        {
        public void keyTyped(java.a wt.event.KeyEve nt evt)
        {
        // jtfGradosKeyTyp ed(evt);
        }
        };
        jtfGradosC.addK eyListener(kl);
        jtfGradosF.addK eyListener(kl);


        }


        /**Salir de la aplicacion*/
        private void exitForm(java.a wt.event.Window Event evt)
        {
        System.exit(0);
        }

        /**
        *parametro args: argumentos en linea de ordenes
        */
        public static void main(String args[])
        {
        try
        {
        //Aspecto de la interfaz grafica
        javax.swing.UIM anager.setLookA ndFeel(
        javax.swing.UIM anager.getSyste mLookAndFeelCla ssName());
        }
        catch (Exception e)
        {
        System.out.prin tln("No se pudo establecer el aspecto deseado: " + e);
        }
        new Conver(null).se tVisible(true);
        }


        private javax.swing.JLa bel jlbGradosC;
        private javax.swing.JTe xtField jtfGradosC;
        private javax.swing.JBu tton jbtAceptar;
        private javax.swing.JLa bel jlbGradosF;
        private javax.swing.JTe xtField jtfGradosF;
        }

        Comment

        • JosAH
          Recognized Expert MVP
          • Mar 2007
          • 11453

          #5
          The way you're trying to accomplish this is not the 'Swing way' of doing things.
          Swing uses 'bound properties', i.e. when such a property changes it notifies
          everything that is interested in the property value change.

          Central in you localization framework should be a 'Localizer' that can localize
          strings and add listeners to itself when a Locale changes (i.e. the language of
          the application is changed).

          Any component that is interested in a Locale change should register itself to
          that Localizer. The trouble with Swing components is that they don't exist during
          the lifetime of the application (think of buttons in a dialog or the dialog itself).

          Therefore, a simple solution would be a, say 'LocalizerDeleg ate' that registers
          itself at the Localizer and changes the text for a Swing component whenever a
          Locale changes. The Swing component refers to such a LocalizerDelega te.

          If the Localizer itself keeps those interested LocalizerDelega tes in a WeakHashMap,
          they will be automatically removed from that map whenever the Swing component
          becomes out of scope and is a (potential) prey for the Garbage Collector.

          A LocalizerHelper should know about *what* key to translate (or localize) for
          the component (or part thereof) it is the delegate for. Whenever the Locale
          changes, it is notified by the Localizer, the LocalizerDelega te consults the
          Localizer again and sets the text in the Swing component that had delegated
          that functionality.

          The easiest approach is to subclass all Swing components that implement the
          functionality outlined above. It seems like a lot of work (and it is) but it pays back
          big times (believe me, I did just that some time ago ;-)

          kind regards,

          Jos

          Comment

          • aleplgr
            New Member
            • Aug 2007
            • 19

            #6
            Thanks really for your time, but this looks too much for me, I'm absolutelly newbie.. is there please any example? the only one I could find is this one
            http://www.demo2s.com/Code/Java/Development-Class/BigDemoforI18N. htm
            and it uses the if else if approach...

            Comment

            • JosAH
              Recognized Expert MVP
              • Mar 2007
              • 11453

              #7
              Originally posted by aleplgr
              Thanks really for your time, but this looks too much for me, I'm absolutelly newbie.. is there please any example? the only one I could find is this one
              http://www.demo2s.com/Code/Java/Development-Class/BigDemoforI18N. htm
              and it uses the if else if approach...
              I'm sorry for saying so but that example sucks big times. That way is not the
              way to go for I18N and L10N. Especially not if you want to change the Locale
              (language) while the application is running. Don't use it. To do it properly takes
              a lot more work and I don't even know if the way I did it is the 'best' way to do it.

              Maybe I should write a little article series about it; I don't know yet, but most
              certainly your question cannot be answered in a single reply; sorry 'bout that.

              kind regards,

              Jos

              Comment

              • r035198x
                MVP
                • Sep 2006
                • 13225

                #8
                Originally posted by aleplgr
                Thanks really for your time, but this looks too much for me, I'm absolutelly newbie.. is there please any example? the only one I could find is this one
                http://www.demo2s.com/Code/Java/Development-Class/BigDemoforI18N. htm
                and it uses the if else if approach...
                I don't think choosing an inferior alternative approach is the way to go here. If you're a "newbie" (I like to call it leaners because everyone is a learner) then doing this as Jos suggested will make you a learn a lot which I think is the whole point anyway.

                Comment

                • aleplgr
                  New Member
                  • Aug 2007
                  • 19

                  #9
                  I found a solution (I know it sucks! and it's 100000 miles away from JosAH's ) It consists of declaring the ResourceBundle variable also in the Conver panel (this is just an example panel to see how to change its labels) and in the init components method call the getBundle and the getSring in the setText of each label and button.
                  I think that this is working... could I try this one while find something better?




                  Code:
                  import java.util.*;
                  
                  
                  public class Conver extends  JFrame
                  {
                  /**Crear un nuevo formulario Conver*/
                  private  ResourceBundle res;
                   public Conver(JFrame owner)
                   { 
                   //super(owner, true);
                    setSize(500,200);//tamaño del formulario
                    setTitle("Conversion de temperaturas");//titulo del formulario
                    initComponents();//iniciar componenetes
                     setVisible(true);
                   }
                  
                  /** El siguiente metodo es llamado por el constructorpara iniciar el formulario**/
                   private void initComponents()
                   {
                    //Crear los objetos
                    jlbGradosC = new javax.swing.JLabel();
                    jtfGradosC = new javax.swing.JTextField();
                    jlbGradosF = new javax.swing.JLabel();
                    jtfGradosF = new javax.swing.JTextField();
                    jbtAceptar = new javax.swing.JButton();
                    res = ResourceBundle.getBundle("Resources");
                    getContentPane().setLayout(null);
                    addWindowListener(new java.awt.event.WindowAdapter()
                     {
                  	public void windowClosing(java.awt.event.WindowEvent evt)
                  	{
                  	 //exitForm(evt);
                  	  dispose();
                     }
                    }
                    );
                    //Etiqueta "Grados centigrados"
                    jlbGradosC.setText(res.getString("GradosCentigrados"));
                    getContentPane().add(jlbGradosC);
                    jlbGradosC.setBounds(12,28,116,16);
                    
                    //Caja de texto para los grados centigrados
                    jtfGradosC.setText("0.00");
                    jtfGradosC.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
                    getContentPane().add(jtfGradosC);
                    jtfGradosC.setBounds(132,28,144,20);
                    
                    //Etiqueta "Grados Fahrenheit"
                    jlbGradosF.setText("Grados fahrenheit");
                    getContentPane().add(jlbGradosF);
                    jlbGradosF.setBounds(12,68,104,24);
                    
                     //Caja de texto para los grados fahreneit
                    jtfGradosF.setText("32.00");
                    jtfGradosF.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
                    getContentPane().add(jtfGradosF);
                    jtfGradosF.setBounds(132,72,144,20);
                  
                     //Boton Aceptar
                    jbtAceptar.setText("Aceptar");
                    jbtAceptar.setMnemonic('A');
                    getRootPane().setDefaultButton(jbtAceptar);
                    getContentPane().add(jbtAceptar);
                    jbtAceptar.setBounds(132,120,144,24);
                    
                    
                   java.awt.event.KeyAdapter kl=
                   new java.awt.event.KeyAdapter()
                   {
                   public void keyTyped(java.awt.event.KeyEvent evt)
                   {
                   // jtfGradosKeyTyped(evt);
                    }
                    };
                    //jtfGradosC.addKeyListener(kl);
                    //jtfGradosF.addKeyListener(kl); 
                    
                    
                   }
                   
                   
                   /**Salir de la aplicacion*/
                   private void exitForm(java.awt.event.WindowEvent evt)
                   {
                     System.exit(0);
                   }
                   
                   /**
                   *parametro args: argumentos en linea de ordenes
                   */
                   public static void main(String args[])
                   {
                     try
                  	 {
                  	  //Aspecto de la interfaz grafica
                  	  javax.swing.UIManager.setLookAndFeel(
                  	   javax.swing.UIManager.getSystemLookAndFeelClassName());
                  	}
                  	catch (Exception e)
                  	{
                  	 System.out.println("No se pudo establecer el aspecto deseado: " + e);
                  	 }
                  	 new Conver(null).setVisible(true);
                  	}
                  	
                  	
                  	private javax.swing.JLabel jlbGradosC;
                  	private javax.swing.JTextField jtfGradosC;
                  	private javax.swing.JButton jbtAceptar;
                  	private javax.swing.JLabel jlbGradosF;
                  	private javax.swing.JTextField jtfGradosF;
                  	}

                  Comment

                  • JosAH
                    Recognized Expert MVP
                    • Mar 2007
                    • 11453

                    #10
                    Originally posted by aleplgr
                    II think that this is working... could I try this one while find something better?
                    Sure, why not? If it works; nobody is going to forbid you to use your current solution ;-)

                    kind regards,

                    Jos

                    Comment

                    Working...