Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Phone;
- import java.awt.BorderLayout;
- import java.awt.Color;
- import java.awt.FlowLayout;
- import java.awt.Font;
- import java.awt.event.ActionEvent;
- import java.io.IOException;
- import javax.swing.AbstractAction;
- import javax.swing.BorderFactory;
- import javax.swing.JButton;
- import javax.swing.JFrame;
- import javax.swing.JOptionPane;
- import javax.swing.JPanel;
- import java.awt.Component;
- public class Tester extends JFrame {
- public Tester()
- {
- setTitle("main");
- setSize(800,800);
- MyAction myAct = new MyAction("Print a new Customer");
- JButton btn1 = new JButton(myAct);
- btn1.setFont(new Font("Arial",Font.BOLD,40));
- JButton btn2 = new JButton(myAct);
- JButton btn3 = new JButton(myAct);
- setLayout(new BorderLayout());
- add(btn1, BorderLayout.CENTER);
- add(btn2, BorderLayout.EAST);
- add(btn3, BorderLayout.WEST);
- }
- public static void main(String[] args) {
- new Tester().setVisible(true);
- }
- public class MyAction extends AbstractAction {
- public MyAction(String str){
- super(str);
- }
- public void actionPerformed(ActionEvent arg0){
- JOptionPane.SELECTION_VALUES_PROPERTY.valueOf(NAME);
- try{
- Phone p = new Phone ("d:\\cust.txt","0508848987", "jackov jojo", (int) Math.ceil(Math.random() * 1000));
- }catch (StackOverflowError | IOException e) {
- e.initCause(null);
- }
- }
- }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement