0
我在框架中有兩個單選按鈕。當我點擊「Manuel Server」(右下角)時,我想放置一個文本框而不是單選按鈕。當再次點擊「MANUEL服務器」時,我想再次使用單選按鈕而不是textBox。現在我只能將文本框放在單選按鈕附近。我不能把他們(他們),而不是他們。應該如何設置?如何使用miglayout在框架中排列組件? (java)(swing項目)
jconnectManuelServer = new JLabel("<html><u>" + ELanguage.getString("Manuel_Server") + "</u></html>");
jconnectManuelServer.setVisible(true);
jconnectManuelServer.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (!loginClicked) {
jconnectAutomatic = new JLabel("MANUEL_Server");
jconnectAutomatic = new JLabel("<html><u>" + ELanguage.getString("MANUEL_Server") + "</u></html>");
jconnectManuelServer.setVisible(false);
jserverOptLive.setPreferredSize(new Dimension(1, 1));
jserverOptDemo.setContentAreaFilled(true);
jserverOptDemo.setVisible(false);
jserverOptLive.setVisible(false);
jconnectAutomaticText.setVisible(true);
panel.remove(jconnectManuelServer);
panel.add(jconnectAutomatic, "width 3:150:140,wrap");
jconnectAutomatic.setVisible(true);
jconnectAutomatic.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
jconnectAutomatic.setVisible(false);
panel.remove(jconnectAutomatic);
panel.add(jconnectManuelServer);
jconnectManuelServer.setVisible(true);
jconnectAutomaticText.setVisible(false);
jserverOptDemo.setVisible(true);
jserverOptLive.setVisible(true);
}
});
}
}
});
private void loadComponent() {
// add components to panel here
panel.add(new JLabel(ELanguage.getString("(LANG)org.esse.trader.loginframe.login")),
"newline 50,gap 150");
if (userList == null || userList.length < 2) {
panel.add(jlogin, /*LANG_IGNORE*/ "width 1:150:150,wrap");
} else {
panel.add(juserCombo, /*LANG_IGNORE*/ "width 1:150:150,wrap");
}
panel.add(new JLabel(ELanguage.getString("(LANG)org.esse.trader.loginframe.password")), "gap 150");
panel.add(jpass, /*LANG_IGNORE*/ "width 1:150:150,wrap");
panel.add(new JLabel(ELanguage.getString("(LANG)org.esse.trader.loginframe.server")), "gap 150");
//panel.add(server, /*LANG_IGNORE*/ "width 1:150:150,wrap");
panel.add(jserverOptLive, /*LANG_IGNORE*/ "width 1:60:60, split 2");
panel.add(jserverOptDemo, /*LANG_IGNORE*/ "width 1:60:60,split 3");
panel.add(jconnectAutomaticText, "width 1:100:200, wrap");
jconnectAutomaticText.setVisible(false);
// panel.add(new JLabel(ELanguage.getString("(LANG)org.esse.trader.loginframe.port")), "gap 150");
// panel.add(jport, /*LANG_IGNORE*/ "width 1:100:80,split 3");
panel.add(new JLabel(ELanguage.getString("(LANG)org.esse.trader.loginframe.ssl")), "gap 150");
panel.add(juseSsl, "wrap");
if (TClientExe.setupType != 1) {
panel.add(new JLabel(ELanguage.getString("(LANG)org.esse.trader.loginframe.language")), "gap 150");
panel.add(jlanguage, "width 1:80:150,wrap");
}
panel.add(new JLabel(ELanguage.getString("(LANG)org.esse.trader.loginframe.save")), "gap 150");
panel.add(jsaveCredentials, "width 1:30:25, split 2");
panel.add(jdeleteSavedUser, "wrap");
panel.add(jloginButton, "gap 150");
panel.add(jcancelButton, /*LANG_IGNORE*/ "wrap");
panel.add(TClientExe.getProgressBar(), /*LANG_IGNORE*/ "w 100:100,span,growx,wrap,gap 150");
if (TClientExe.setupType != 1) {
panel.add(jcreateNewDemoAccount);
panel.add(emptyLabel);
panel.add(jconnectManuelServer);
}
setResizable(false);
}