8.44 am Achievement
woke up at 7.30, the first two GUI Components i mastered:
The Button and The Label.
here's my first Button+Label xD
woke up at 7.30, the first two GUI Components i mastered:
The Button and The Label.
here's my first Button+Label xD
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Button extends JFrame
{ static private JButton button; static private JLabel label;
public Button()
{super("Buttoning");
Container c=getContentPane();
c.setLayout(new FlowLayout());
label=new JLabel("Will you marry me?");
c.add(label);
label=new JLabel("Will you marry me?");
c.add(label);
button=new JButton("Yes");
c.add(button);
ButtonHandler handler = new ButtonHandler();
button.addActionListener(handler);
setSize(275, 100);
show();
}
public static void main (String[] args)
{new Button().addWindowListener(
new WindowAdapter()
{public void WindowClosing(WindowEvent e)
{System.exit(0);}
}
);
}
private class ButtonHandler implements ActionListener
{public void actionPerformed(ActionEvent e)
{if(e.getActionCommand()=="Yes") System.out.println("JK LOL");}
}
}
on to JLists now.
*******
11.59am achievement
1 comment:
Java code amidst all of this emo pinkness is highly disconcerting
and you say its a hobby!!
Post a Comment