package doW;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class JNotePad {
JButton clickMe;
JButton nothingToDo;
JPanel jpanel01;
private void show() {
jpanel01=new JPanel();
jpanel01.setBackground(Color.GRAY);
jpanel01.setLayout(new BoxLayout(jpanel01,BoxLayout.Y_AXIS));
clickMe=new JButton("點我呀~ 笨蛋");
clickMe.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
whatUserDo();
}
});
clickMe.setFont(new Font("serif",Font.BOLD,20));
nothingToDo=new JButton("noting to do");
jpanel01.add(clickMe);
jpanel01.add(nothingToDo);
JFrame jf=new JFrame("note pad title");
jf.setVisible(true);
jf.setSize(400, 300);
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jf.getContentPane().add(BorderLayout.EAST,jpanel01);
}
private void whatUserDo() {
clickMe.setText("user click me!");
}
public static void main(String[] args) {
new JNotePad().show();
}
}
2013年2月22日 星期五
About Swing Note
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言