Calling string from another file
<p>So i got these strings i my main file named "Login" as is the class</p>

<pre><code>public JPasswordField passfield;
public JTextField userfield;
public JTextField hostfield;
public String host;
public String user;
public String pwd;

JButton buttoncon = new JButton("Connect");
    //buttoncon.addActionListener(buttonconClick());

    buttoncon.addActionListener(new ActionListener() { 
          @Override
        public void actionPerformed(ActionEvent e) {
            // TODO Auto-generated method stub
            buttonconClick();
        } 
        } );


public void buttonconClick() {  
    if(hostfield.getText().length()==0)
        JOptionPane.showMessageDialog(null, "Tomt ip felt");
    else if(userfield.getText().length()==0)
           JOptionPane.showMessageDialog(null, "Tomt brukernavn felt");
    else if(passfield.getPassword().length==0)
           JOptionPane.showMessageDialog(null, "Tomt passord felt");
    else{
          host = hostfield.getText();
          host = "jdbc:mysql://" + host;
          user = userfield.getText();
          char[] pass = passfield.getPassword();
          pwd = String.copyValueOf(pass); 
        }
</code></pre>

<p>then the connection to DB</p>

<p>i need to call these strings in my second file i also have the file importet </p>

<pre><code>import test.Login;

JButton Worldselect = new JButton("World");
    Worldselect.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            try {
                Login mysqlcon = new Login();
                String hostcon = mysqlcon.host;
                hostcon = "jdbc:mysql://" + hostcon;
                String usercon = mysqlcon.user;
                String pwdcon = mysqlcon.pwd;

Connection conn = DriverManager.getConnection(hostcon,usercon,pwdcon);
</code></pre>

<p>But when i do it like that they retun emty, why is that?</p>