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
What does it mean when your check engine light is blinking?
qwelly [4]
It means that the check engine light is about to misfire.
4 0
4 years ago
What is the use of technology to enable people to learn anytime and anywhere​
tamaranim1 [39]

Answer:

Electronic Learning Model, refers to a type of learning that happens anytime, anywhere and with anyone.

Explanation:

With anytime and anywhere learning, education extends beyond the classroom and the traditional school day. Students are able to create, track and manage their own learnings. Instead of using printed workbooks that are quickly outdated, students can access current information.

4 0
3 years ago
Interior gateway protocols are used by routers in order to share information within a single
jenyasd209 [6]
Interior gateway protocols (IGP)are used by routers in order to share information within a single autonomous system. IGP<span> is used for exchanging routing information between gateways (commonly routers). </span><span>An autonomous system (AS) is a network or a collection of networks that are all managed and supervised by a single entity or organization.</span>
6 0
3 years ago
Write a java program to create and display unique three digit number using 1,2,3 and 4 also count how many three digit number ar
padilas [110]

Answer:

Answered below

Explanation:

Class Unique{

public static void main(String args[]){

int myArray[] = {1, 2, 3, 4};

int newArray[];

int i;. int j; int k;

for(i = 0; i < myArray.length; I++)

for(j = 0; j< myArray.length; j++)

for(k = 0; k< myArray.length; k++){

if(i != j && j!= k && i != k ){

newArray.add(myArray[i] + myArray[j] + myArray[k]);

}

}

int count = 0;

for(int m = 0; m < newArray.length; m++){

count++;

}

System.out.print(newArray, count)

}

}

5 0
3 years ago
Write a program that reads in non-negative integers and stores and displays distinct numbers (i.e., if a number appears multiple
slavikrds [6]

Answer:

See explaination

Explanation:

#include <iostream>

using namespace std;

#define MAX 1005

bool already_present(int data[MAX], int input, int size)

{

int i;

for(i=0;i<size;i++)

if(data[i] == input)

return true;

return false;

}

int read_stdin(int data[MAX])

{

int input;

int size=0;

while(true)

{

cout<<"Enter a non-negative integer (negative to quit): ";

cin>>input;

if(input<0)

break;

if(!already_present(data,input,size))

data[size++] = input;

}

return size;

}

void print_stdout(int data[MAX],int size)

{

int i;

cout<<"You entered\n";

for(i=0;i<size;i++)

cout<<data[i]<<" ";

cout<<endl;

}

int main()

{

int data[MAX],size;

size = read_stdin(data);

print_stdout(data,size);

return 1;

}

4 0
3 years ago
Other questions:
  • Each phase of the system development life cycle is accomplished as a discrete, separate step. (1 point) (Points : 1.5) True
    7·1 answer
  • In the 1960s, techniques were developed that allowed individuals to fool the phone system into providing free access to long dis
    14·1 answer
  • Which character goes at the end of a line of code that starts with if?
    8·1 answer
  • How does a author develop a character in a story?
    14·2 answers
  • A crane is attempting to lift a beam that exceeds its load rating. What type of accident is possible?
    9·1 answer
  • If there is only a stop sign posted at a railroad
    9·1 answer
  • How much data can a flash drive store?​
    13·2 answers
  • Josh is learning about hackers know for finding loopholes in systems, without notifying the company or organization beforehand.
    13·1 answer
  • What should you do if an online friend asked to meet you after school? <br>ᵖˡˢˢˢˢ...​
    13·2 answers
  • Void printInfo()
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!