Advertisement
gdog2u

Untitled

Sep 3rd, 2013
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.90 KB | None | 0 0
  1. import java.awt.*;
  2. import java.awt.event.*;
  3.  
  4. import javax.swing.*;
  5.  
  6.  
  7. public class ab extends JFrame implements ActionListener {
  8.    
  9.     JLabel yEqu = new JLabel("Y= ");
  10.     JTextField equation = new JTextField(20);
  11.     JButton graphB =new JButton("Graph");
  12.  
  13.     public static void main(String[] args0){
  14.         ab grapher = new ab();
  15.     }
  16.     public ab(){
  17.         this.setLocationRelativeTo(null);
  18.         this.setVisible(true);
  19.         this.setTitle("Grapher");
  20.         this.setSize(800,700);
  21.         this.setDefaultCloseOperation(EXIT_ON_CLOSE);
  22.         this.setLayout(new FlowLayout());
  23.         this.add(yEqu);
  24.         this.add(equation);
  25.         this.add(graphB);
  26.             graphB.addActionListener(this);
  27.     }
  28.        
  29.     public ab(Graphics g){
  30.         super.paintComponents(g);
  31.         Graphics2D g2 = (Graphics2D)g;
  32.         g2.fillRect(100,200,300,100);
  33.        
  34.     }
  35.  
  36.     public void actionPerformed(ActionEvent e) {
  37.         if(e.getSource() == this.graphB){
  38.             equation.setText("yay");
  39.            
  40.         }
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement