U
Ulf Meinhardt
The task seems to be simple: I have an applet with a text label on the top and a button
on the bottom. When I click now on the button this button should disappear and two
buttons should be displayed at exact the place of the previous single button.
The dimensions of the first single button should be the same of the sum of the two following buttons
(equal height but sum of width).
Now when I click on one of the new buttons the game goes the other way: The two buttons
should disappear and the single button should be displayed again and so far.
How can I implement such a 1<->2 button in-place-switch?
A more grahical view:
(L=Label,SSSSSS=Single Button,
1=Left of the two buttons, 2=Rgight of the two buttons)
LLLLLLLLLLLL
LLLLLLLLLLLL
SSSSSSSSSSSS
SSSSSSSSSSSS
<- Click ->
LLLLLLLLLLLL
LLLLLLLLLLLL
111111222222
111111222222
import java.awt.*;
import java.applet.Applet;
public class myButtons extends Applet {
Label lab;
Button button1, button2, button3;
public void init() {
lab = new Label("Text")
button1 = new Button("Ok");
button2 = new Button("left");
button3 = new Button("right");
add(lab);
add(button1);
//add(button2);
//add(button3);
}
}
Ulf
on the bottom. When I click now on the button this button should disappear and two
buttons should be displayed at exact the place of the previous single button.
The dimensions of the first single button should be the same of the sum of the two following buttons
(equal height but sum of width).
Now when I click on one of the new buttons the game goes the other way: The two buttons
should disappear and the single button should be displayed again and so far.
How can I implement such a 1<->2 button in-place-switch?
A more grahical view:
(L=Label,SSSSSS=Single Button,
1=Left of the two buttons, 2=Rgight of the two buttons)
LLLLLLLLLLLL
LLLLLLLLLLLL
SSSSSSSSSSSS
SSSSSSSSSSSS
<- Click ->
LLLLLLLLLLLL
LLLLLLLLLLLL
111111222222
111111222222
import java.awt.*;
import java.applet.Applet;
public class myButtons extends Applet {
Label lab;
Button button1, button2, button3;
public void init() {
lab = new Label("Text")
button1 = new Button("Ok");
button2 = new Button("left");
button3 = new Button("right");
add(lab);
add(button1);
//add(button2);
//add(button3);
}
}
Ulf