Access over 20 million homework & study documents

search

Ackermann GraphI need to print lines using m and n on ackermann f

Content type
User Generated
Rating
Showing Page:
1/11
Ackermann Graph:
I need to print lines using m and n on ackermann function.
When lines are being printed, it should make a shape like
a sawtooth.
Code:
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JApplet;
import javax.swing.JButton;
import javax.swing.JTextField;
public class AckermanGraph extends JApplet implements
ActionListener
{
public AckermanGraph() {
}
private static final long serialVersionUID = 1L;
private static int temp;
private static int count;
private static int countTotal = 0;
int forColor = 1;
boolean paint = false;
Font titleFont;
Font regularFont;
//*** two buttons are declared
JButton DrawLinesButton;
JButton clearLinesButton;
//*** two input values declared
JTextField inputLineNumber1;
JTextField inputLineNumber2;

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/11
Container contentPane;
public void paint (Graphics page)
{
if(!paint)
graphInitialize(page);
super.paint(page);
setBackground(Color.WHITE);
graph(page);
}
public void init()
{
System.out.println(\"init has been called\");
contentPane = getContentPane();
contentPane.setLayout(null);
//*** 32 and 18 are pixel size
titleFont = new Font(\"Arial\", Font.BOLD, 32);
regularFont = new Font(\"Arial\", Font.PLAIN, 18);
//*** memory is allocated for Button
DrawLinesButton = new JButton(\"Draw Graph\");
//*** this button is active and will be read
//*** by method actionPerformed(ActionEvent e)
DrawLinesButton.addActionListener(this);
//*** Location of button is created
DrawLinesButton.setBounds(350,550,150,40);
//*** memory is allocated for Button
clearLinesButton = new JButton(\"Clear Graph\");
//*** this button is active and will be read
//*** by method actionPerformed(ActionEvent e)
clearLinesButton.addActionListener(this);
//*** Location of button is created
clearLinesButton.setBounds(350,600,150,40);
//*** setBounds() creates the input box

Sign up to view the full document!

lock_open Sign Up
Showing Page:
3/11

Sign up to view the full document!

lock_open Sign Up
End of Preview - Want to read all 11 pages?
Access Now
Unformatted Attachment Preview
Ackermann Graph: I need to print lines using m and n on ackermann function. When lines are being printed, it should make a shape like a sawtooth. Code: import java.awt.Color; import java.awt.Container; import java.awt.Dimension; import java.awt.Font; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JApplet; import javax.swing.JButton; import javax.swing.JTextField; public class AckermanGraph extends JApplet implements ActionListener { public AckermanGraph() { } private static final long serialVersionUID = 1L; private static int temp; private static int count; private static int countTotal = 0; int forColor = 1; boolean paint = false; Font titleFont; Font regularFont; //*** two buttons are declared JButton DrawLinesButton; JButton clearLinesButton; //*** two input values declared JTextField inputLineNumber1; JTextField inputLineNumber2; Container contentPane; public void paint (Graphics page) { if(!paint) graphInitialize(page); super.paint(page); setBackground(Color.WHITE); graph(page); } public void init() { System.out.println(\"init has been called\"); contentPane = getContentPane(); contentPane.setLayout(null); //*** 32 and 18 are pixel size titleFont = new Font(\"Arial\", Font.BOLD, 32); regularFont = new Font(\"Arial\", Font.PLAIN, 18); //*** memory is allocated for Button DrawLinesButton = new JButton(\"Draw Graph\"); //*** this button is active and will be read //*** by method actionPerformed(ActionE ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Anonymous
Just the thing I needed, saved me a lot of time.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4