0

I have this little code:

import javax.swing.*;

public class Formulario extends JFrame{

    private JLabel label1;
    private JLabel label2;

    public Formulario(){
        setLayout(null);
        label1 = new JLabel("Interfaz gráfica.");
        label1.setBounds(10,20,300,30);
        add(label1);
        label2 = new JLabel("Versión 1.0");
        label2.setBounds(10,100,100,30);
        add(label2);
    }

    public static void main (String args []){

        Formulario formulario1 = new Formulario();
        formulario1.setBounds(0,0,300,200);
        formulario1.setResizable(false);
        formulario1.setVisible(true);
        formulario1.setLocationRelativeTo(null);
    }
}

But the output is: "Interfaz gr??fica." and not "Interfaz gráfica." So, how I do to change my java file to UTF-8 encode? Thanks

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
NuzzeSicK
  • 627
  • 1
  • 6
  • 18
  • Are you using an IDE or a text editor, and which one are you using? – sorifiend Oct 01 '18 at 03:32
  • Yes, I'm actually using Eclipse – NuzzeSicK Oct 01 '18 at 03:33
  • Use the link above, it shows you how to change the encoding on eclipse. – sorifiend Oct 01 '18 at 03:35
  • Always search Stack Overflow thoroughly before posting. – Basil Bourque Oct 01 '18 at 03:43
  • Java GUIs have to work on different OS', screen size, screen resolution etc. using different PLAFs in different locales. As such, they are not conducive to pixel perfect layout. Instead use layout managers, or [combinations of them](http://stackoverflow.com/a/5630271/418556) along with layout padding and borders for [white space](http://stackoverflow.com/a/17874718/418556). – Andrew Thompson Oct 01 '18 at 04:37

0 Answers0