我必須創建一個基本的Login Form
Swing
對JButton
ActionListner
。所以我寫了下面的代碼:無法在java中創建登錄表單Swing
private void Balance() throws IOException {
getContentPane().removeAll();
JPanel test = new JPanel();
JLabel singin = new JLabel();
javax.swing.ImageIcon icon = createImageIcon(
"https://dl.dropboxusercontent.com/u/20476478/Capture.PNG",
"a pretty but meaningless splat");
singin.setIcon(icon);
test.add(singin);
getContentPane().add(test);
repaint();
printAll(getGraphics());
}
它創建類似下面的UI:
But i am looking for this:
我嘗試了很多,但不能以適合的尺寸像上面那樣。我剛開始學習Swing
您可以使用'CardLayout'完成此任務。使用電子郵件地址/密碼和登錄按鈕登錄後,佈局中的第一張卡片將爲空白。 – 2013-04-22 12:29:06