Eksami spikker
else x = (n+m)*bar1(n-1,m);
return x;}
static int bar2(int n, int m) {
int x=0;
if (n <= 0) x = m;
else for (int i = 0; i < n + m; i++) {
x = x + bar2(n-1,m);}
return x;}
______________________________________
public class Male { public static void main(String[] args) {
JFrame frame = new MaleFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(400, 400);frame.setVisible(true); } }
class MaleFrame extends JFrame {
MaleFrame frame; JPanel toppanel; JPanel buttonpanel;
DrawPanel drawpanel;int nupp = 0;
MaleFrame() {
toppanel = new Jpanel(); buttonpanel = new JPanel();
drawpanel = new DrawPanel(); JButton button = new JButton("Vajuta!");
buttonpanel.add(button); toppanel.setLayout(new BorderLayout());
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
nupp = 1; drawpanel.repaint(); } } );
toppanel.add(BorderLayout.SOUTH, buttonpanel);
toppanel.add(BorderLayout.CENTER, drawpanel);
this