框架中有两个单选按钮。当我点击" Manuel Server" (在右下角)我想放一个文本框而不是单选按钮。点击" MANUEL Server"我想再次放置单选按钮而不是textBox。现在我只能将文本框放在单选按钮附近。我不能代替他们(在他们身上)。该怎么设置呢?
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);
}
答案 0 :(得分:0)
应该很简单。你应该有一个应该是卡片布局的面板。
单击手动服务器,您可以切换卡片。
希望这会有所帮助。