1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Black_prince [1.1K]
3 years ago
14

Write MVCTester.java. When the program starts, the initial screen displays a button labeled "add", a blank text area, and a text

field. A user places a line in the text field and clicks on the add button. Then, the text area displays the line. Each time the user enters a new line in a text field and clicks on the add button, the text area is updated displaying previously entered lines and the new line. The following picture shows the snapshot of the program output right after two lines are added. snapshot To get a credit, the following requirements have to be satisfied.1. The program follows the MVC model.
2. Listeners are implemented in an anonymous class.
3. Model is a separate class from the client (test) program.
4. Indication of which part of your program serves as model, controller or view.
Computers and Technology
2 answers:
Debora [2.8K]3 years ago
8 0

Answer:

Kindly note that, you're to replace "at" with shift 2 as the brainly text editor can't take the symbol

Explanation:

import java.awt.event.*;  

import java.awt.geom.Area;

import javax.swing.*;

class MVCTester implements ActionListener{

JButton b; //button

JTextField t1; //textfiled

JTextArea area; //text area

MVCTester(){

JFrame f=new JFrame("Button Example");

//button

b=new JButton("add");  

b.setBounds(0,0,125,27);  

f.add(b);  

b.addActionListener(this);  

//textfiled

t1=new JTextField();  

t1.setBounds(0,161,125,24);  

f.add(t1);

//textarea

area=new JTextArea();  

area.setBounds(0,28,123,130);  

f.add(area);

area.setColumns (17);

area.setLineWrap (true);

area.setWrapStyleWord (false);

f.setSize(125,225);

f.setLayout(null);  

f.setVisible(true);

}

"at"Override

public void actionPerformed(ActionEvent arg0) {

Control c=new Control(area,t1,b);

}  

}  

class Control {

Control(JTextArea area,JTextField t1,JButton b){

//simple logic getting text of text area adding text of textfiled and setting the text to text area

area.setText(area.getText()+t1.getText()+"\n");

t1.setText("");

}

}

public class Modal{

public static void main(String[] args) {  

MVCTester be=new MVCTester();

}

}

tester [92]3 years ago
8 0

Answer:

import java.awt.event.*;

import java.awt.geom.Area;

import javax.swing.*;

class MVCTester implements ActionListener{

JButton b; //button

JTextField t1; //textfiled

JTextArea area; //text area

MVCTester(){

JFrame f=new JFrame("Button Example");

//button

b=new JButton("add");

b.setBounds(0,0,125,27);

f.add(b);

b.addActionListener(this);

//textfiled

t1=new JTextField();

t1.setBounds(0,161,125,24);

f.add(t1);

//textarea

area=new JTextArea();

area.setBounds(0,28,123,130);

f.add(area);

area.setColumns (17);

area.setLineWrap (true);

area.setWrapStyleWord (false);

f.setSize(125,225);

f.setLayout(null);

f.setVisible(true);

}

atOverride (use the at symbol in your code)

public void actionPerformed(ActionEvent arg0) {

Control c=new Control(area,t1,b);

}

}

class Control {

Control(JTextArea area,JTextField t1,JButton b){

//simple logic getting text of text area adding text of textfiled and setting the text to text area

area.setText(area.getText()+t1.getText()+"\n");

t1.setText("");

}

}

public class Modal{

public static void main(String[] args) {

MVCTester be=new MVCTester();

}

}

Explanation:

This is a MVCTester.java. program. In this program, we started with the initial screen that displays a button labeled "add", a blank text area, and a text field. A user places a line in the text field and clicks on the add button. Then, the text area displays the line.

The program follows the MVC model. Also Listeners are implemented in an anonymous class. Its Model is a separate class from the client (test) program.

After implementing the function, the executed program performed optimally by producing the required output.

You might be interested in
1. Name the program in which you can draw and colour pictures.​
babymother [125]

Answer:

Photoshop- if this is for school I THINK, but I use Procreate for IOS

Explanation:

4 0
3 years ago
Combination of two or more networks
bezimeni [28]
The combination of two or more networks is internet work!!
Hope this helps
4 0
3 years ago
Create a class called Circle, which has (i) an attribute radius, (ii) a method that returns the current radius of a circle objec
nadya68 [22]

Answer:

Explanation:

The following class is written in Java. I created the entire Circle class with each of the methods and constructor as requested. I also created a tester class to create a circle object and call some of the methods. The output can be seen in the attached picture below for the tester class.

class Circle {

   double radius;

   public Circle(double radius) {

       this.radius = radius;

   }

   public double getRadius() {

       return radius;

   }

   public void resetRadius() {

       radius = 0;

   }

   public double calculateArea() {

       double square = Math.pow((Math.PI * radius), 2);

       return square;

   }

}

8 0
3 years ago
Where to buy a ps5<br> I really want one please help meh
lianna [129]

Answer:

You can buy one at gamestop, target, walmart, best buy and probably more stores

3 0
3 years ago
Read 2 more answers
To most efficiently distribute IP address pools in networks, system administrators typically set up services that automatically
zhuklara [117]

Answer:

Explanation:

Dynamic host configuration protocol DHCP help us to assign an IP automatically, with this method is not necessary to get more IP blocks because this method use lease time or rental IP, this means, if an IP is not being used, this is save for the next user, in this case, we're reciclyn the IP bloks, and this is the most efficient way to administrate our IP address.

8 0
3 years ago
Other questions:
  • Wich of these is an example of magnetic storage
    11·1 answer
  • Which step can most directly help your team follow up on decisions made during Web development meetings?This task contains the r
    6·1 answer
  • Technician A says that wheel speed sensors are a highly probable cause of illuminated EBC warning lamps. Technician B says that
    10·1 answer
  • Does anyone know this ? this website is scratch btw.
    10·1 answer
  • In mathematics, "quadrant I" of the cartesian plane is the part of the plane where x and y are both positive. Given a variable,
    11·1 answer
  • You start up your laptop while getting a coffee across the room. You hear the usual chimes and doinks as it starts up. When you
    14·2 answers
  • Statistics are often calculated with varying amounts of input data. Write a program that takes any number of non-negative intege
    10·1 answer
  • Copyright laws protect:This task contains the radio buttons and checkboxes for options. The shortcut keys to perform this task a
    6·1 answer
  • What is the role of computer in modern problem solving​
    13·1 answer
  • 30 POINTS PLS HELLLLPPP WILL GIVE BRAINLIEST What behavior do elements in a stack follow? first in, last out, or FILO behavior l
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!