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
It is not possible to use keywords to search for themes
ivolga24 [154]
Yes it is you just need to know what you are doing

6 0
3 years ago
Which is the correct expansion of the term Internet? 
kirill115 [55]

Answer:

international network

Explanation:

8 0
4 years ago
Read 2 more answers
The research conducted by Gretta's Garden suggests that besides being able to afford plants for their homes and gardens, the onl
lisov135 [29]

Answer:

Network TV.

Explanation:

Network TV is the best option in this scenario because it is more appealing as compared to other media and people have shown more interest in this media.

7 0
3 years ago
Como realizar un cuadro comprativo?​
Kruka [31]
How to make a comparison chart?
3 0
3 years ago
Create pseudocode to compute the volume of a sphere. Use the formula: V= (4/3)* π r3 where π is equal to 3.1416 approximately, w
MA_775_DIABLO [31]

Answer:

In geometry, the area enclosed by a circle of radius r is πr2. Here the Greek letter π represents a constant, approximately equal to 3.14159, which is equal to the ratio of the circumference of any circle to its diameter.

Explanation:

3 0
3 years ago
Read 2 more answers
Other questions:
  • Using tracking code, Google Analytics can report on data from which systems? A. E-commerce platforms.B. Mobile Applications.C. O
    11·1 answer
  • Assign a variable solveEquation with a function expression that has three parameters (x, y, and z) and returns the result of eva
    6·1 answer
  • What are the step by step instructions on how to rename a document(without opening it) that is filed in my computer/my documents
    9·1 answer
  • Which formula is a complex formula?<br> =D6/E10<br> =10-(A3-D13)<br> =C3+10+E3<br> =5+A1*B1
    12·2 answers
  • Study the sentence below
    13·2 answers
  • Software refers to the physical parts of a computer.<br> a. True<br> b. False
    11·2 answers
  • ¿Consideran que nuestra sociedad chilena (modelo económico, los medios de comunicación, educación, la publicidad) promueve la sa
    11·1 answer
  • Give five example of secondary storage device, stating their function and storage capacity​
    6·1 answer
  • HELPPP I cand find my sound card/driver on my computer, and I cant hear anything, I have tried to update the audio driver, but w
    7·1 answer
  • Technology?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!