Created
January 27, 2016 17:55
-
-
Save oscarryz/151d00638616e5ca69dc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.Box; | |
import javax.swing.BoxLayout; | |
import javax.swing.JButton; | |
import javax.swing.JFrame; | |
import javax.swing.JLabel; | |
import javax.swing.JPanel; | |
import javax.swing.JPasswordField; | |
import javax.swing.JTextField; | |
public class Mano { | |
private JPanel content; | |
private JTextField nombre; | |
private JPasswordField password; | |
private JButton iniciarButton; | |
private JButton detenerButton; | |
public void doLayout() { | |
content = new JPanel(){{ | |
add(new Box(BoxLayout.Y_AXIS){{ | |
add(new JPanel(){{ | |
add( new Box(BoxLayout.Y_AXIS){{ | |
add( new JLabel("Nombre de Red")); | |
add( new JLabel("Contraseña")); | |
}}); | |
add( new Box(BoxLayout.Y_AXIS){{ | |
add( (nombre=new JTextField(20) )); | |
add( (password=new JPasswordField(20) )); | |
}}); | |
}}); | |
add( new JPanel(){{ | |
add((iniciarButton=new JButton("Iniciar"))); | |
add((detenerButton=new JButton("Detener"))); | |
}}); | |
}}); | |
}}; | |
} | |
public static void main(String[] args) { | |
Mano app = new Mano(); | |
app.doLayout(); | |
app.iniciarButton.addActionListener(ae-> | |
System.out.println("app.password.getPassword() = " | |
+ new String(app.password.getPassword())) | |
); | |
JFrame frame = new JFrame("WIFI"); | |
frame.setContentPane(app.content); | |
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
frame.pack(); | |
frame.setVisible(true); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment