Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * File: practice.java
- * Name:
- * Section Leader:
- * --------------------
- * This file is the starter file for the Hailstone problem.
- */
- import acm.graphics.GCanvas;
- import acm.graphics.GLabel;
- import acm.graphics.GLine;
- import acm.program.*;
- import java.util.*;
- import java.awt.event.*;
- import javax.swing.*;
- public class Practice extends GraphicsProgram implements ComponentListener {
- public void init() {
- addComponentListener(this);
- draw((double) getWidth()/8,(double) getHeight()/8);
- }
- private void draw (double w,double h) {
- for (int i=0;i<7;i++) {
- GLine a = new GLine(w*(i+1),0,w*(i+1),getHeight());
- add(a);
- }
- for (int i=0;i<7;i++) {
- GLine b = new GLine(0,h*(i+1),getWidth(),h*(i+1));
- add(b);
- }
- }
- public void componentHidden(ComponentEvent e) {}
- public void componentResized(ComponentEvent e) {
- removeAll();
- draw((double) getWidth()/8,(double) getHeight()/8);
- }
- public void componentShown(ComponentEvent e) {}
- public void componentMoved(ComponentEvent e) {}
- private JTextField text;
- private int cursorX = 10;
- private int cursorY = 10;
- private int firstIndex=0;
- ArrayList <String> list = new ArrayList <String>();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement