1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| package org.jdesktop.swingx;
import java.util.Arrays;
import java.util.Collections;
import javax.swing.JFrame;
import org.jdesktop.swingx.JXLoginPane.SaveMode;
/**
* Simple demo to show Login Pane..
*
* @author rah003
*/
@SuppressWarnings("unused")
public class JXLoginPaneDemo {
public static void main(String[] args) throws Exception {
try {
JXLoginPane panel = new JXLoginPane();
JFrame frame = JXLoginPane.showLoginFrame(panel);
panel.setSaveMode(SaveMode.BOTH);
frame.pack();
frame.setVisible(true);
// server combo
panel = new JXLoginPane();
panel.setServers(Arrays.asList(new String[] {"server1","server2"}));
frame = JXLoginPane.showLoginFrame(panel);
panel.setSaveMode(SaveMode.BOTH);
frame.pack();
frame.setVisible(true);
} catch (Exception e) {
System.err.println("exception when executing interactive tests:");
e.printStackTrace();
}
}
} |