Bueno mi problema esque luego de introducir texto en un JTextField
simplemente no me quiere hacer un System.out.println
me dice que la variable no es accesible y no lo entiendo porque estube leyendo las guias y estaba bien
por favor leanlo ^^
Código:
package jfrmae;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
public class Main {
public static void main(String[] args) {
JFrame.setDefaultLookAndFeelDecorated(true);
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setTitle("eA Remote Server Control");
frame.setLayout(new GridLayout(4, 10));
frame.add(new JLabel("Host:"));
frame.add(new JTextField());
frame.add(new JLabel("User:"));
frame.add(new JTextField());
frame.add(new JLabel("Pass:"));
// frame.add(new JPasswordField());
JPasswordField pass = new JPasswordField();
pass.setHorizontalAlignment(JPasswordField.CENTER);
frame.add(pass);
JButton next = new JButton("Next");
frame.add(next);
next.setHorizontalAlignment(next.CENTER);
next.setVerticalAlignment(next.CENTER);
next.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.out.println("pass");
}
}
);
int frameWidth = 300;
int frameHeight = 150;
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
frame.setBounds((int) screenSize.getWidth() - frameWidth, 0, frameWidth, frameHeight);
frame.setVisible(true);
}
}
Muchas gracias !