Question: JAVA class + gui problem public class Problem_0028{ /** * Note: In this problem set level you will use inner classes by defining custom classes

JAVA class + gui problem

public class Problem_0028{ /** * Note: In this problem set level you will use inner classes by defining custom classes * inside the Problem_0028 class. This is only done so you can submit multiple * classes in a single java file on AutoLab. In most cases it is better practice to define * each class in a separate file instead of using inner classes. * */ /** * q1: Write a public class named GraduationListener that implements the ActionListener * interface. This class will have a public constructor that takes a JTextField and a JLabel * as parameters and stores these in instance variables. Override the actionPerformed method * to interpret the text on the JTextField as an x-value (as a double) and display the * corresponding y-value on the JLabel for the line with slope 4.35 and y-intercept 4.06. * * Note that creating classes that implement listener interfaces we can add the same * functionality to multiple components by creating multiple instances of this class. For * example, if we want 3 buttons that will compute y-values for this line with x-values from * different text fields we can instantiate this class 3 times and attach each instance to a * different button. */ /** * q2: Create a public class named "Cloud" with private instance variables "skilled" and * "straw" each of type int. You may add any other methods and variables you'd like to this * class. * * Outside of Cloud (in the Problem Set class) write a public static method named "sortCloud" * that takes an ArrayList of Clouds as a parameter and returns void. This method will sort * the input by the variable "straw" in decreasing order */ /** * q3: Write a public class named FinishMouseListener that implements the MouseListener * interface. This class will have a public constructor that takes a JTextArea and a JLabel * as parameters and stores these in instance variables. Override the mousePressed method to * display the text from the JTextArea on the JLabel in all upper case letters. Then, * override the mouseEntered method to display the text from the JTextArea on the JLabel in * all lower case letters. The other three methods from the MouseListener interface can be * left empty */ /** * q4: Write a public class named InteractionListener that implements the ActionListener * interface. This class will have a public constructor that takes a JTextField and a JLabel * as parameters and stores these in instance variables. Override the actionPerformed method * to interpret the text on the JTextField as an x-value (as a double) and display the * corresponding y-value on the JLabel for the line with slope -1.97 and y-intercept 1.04. * * Note that creating classes that implement listener interfaces we can add the same * functionality to multiple components by creating multiple instances of this class. For * example, if we want 3 buttons that will compute y-values for this line with x-values from * different text fields we can instantiate this class 3 times and attach each instance to a * different button. */ /** * q5: Write a public class named StudyMouseListener that implements the MouseListener * interface. This class will have a public constructor that takes a JTextField and a JLabel * as parameters and stores these in instance variables. Override the mouseReleased method to * display the text from the JTextField on the JLabel in all upper case letters. Then, * override the mouseEntered method to display the text from the JTextField on the JLabel in * all lower case letters. The other three methods from the MouseListener interface can be * left empty */ public static void main(String[] args){ /* Use the following syntax to instantiate your inner class for testing */ Problem_0028 outerInstance = new Problem_0028(); //InnerClassName innerInstance = outerInstance.new InnerClassName(); /* Test your code here to verify it is correct before submitting */ } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!