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
Which of the following is NOT correct concerning database design? Question 2 options: Identify all fields needed to produce the
PtichkaEL [24]

The option which is not correct concerning database design is identify all fields needed to produce the required information.

What is database design?

The database design is the arrangement of the data or the information, according to the model of database.

Let's check all the option one by one,

  • Identify all fields needed to produce the required information- This does not concern with the database design.
  • Group related fields into tables-A relation database design consist of one or more than one related table. These tables are used together when the information is required.
  • Determine each table's primary key- To determine the table's primary key, is the concern with the database design.
  • Organize each piece of data into its largest useful part-The database design is the organization of data in the model of database.

The option which is not correct concerning database design is identify all fields needed to produce the required information.

Learn more about the database design here;

brainly.com/question/25694408

8 0
3 years ago
Kevin has to decide on a financial service provider that will help him with his needs related to tax exemptions and payments. He
salantis [7]

Answer:

A. an individual, Mr. Rupert, who has a lot of experience in handling taxes, but is not affiliated to any big firm

Explanation:

Xenon does not have experience in tax-related queries. Hence, it's not a good choice. Radon also has only some experience in handling taxes, though it has discouraging references. Hence, he is also not a choice. Argon is from another state, though it has a good website. But the website cannot be an option, And hence, Mr. Rupert which has a lot of experience in handling taxes is the right option for you. However, Experience is more important than the firm.

6 0
4 years ago
Define a method named swapValues that takes an array of four integers as a parameter, swaps array elements at indices 0 and 1, a
Luba_88 [7]

The program is an illustration of arrays.

Arrays are used to hold multiple values.

The program in java, where comments are used to explain each line is as follows:

import java.util.*;

public class Main{

   //This defines the method

public static int[] swapValues(int[] arr) {

   //This swaps the first and second array elements

       int temp = arr[0];

       arr[0] = arr[1];   arr[1] = temp;

   //This swaps the third and fourth array elements

       temp = arr[2];

       arr[2] = arr[3];   arr[3] = temp;

   //This returns the swapped array to main

       return arr;

}

//The main method begins here

   public static void main(String[] args) {

       //This creates a Scanner object

       Scanner input = new Scanner(System.in);

 //This declares an array of 4 elements

 int[] intArray = new int[4];

 //This gets input for the array

 for(int i = 0; i<4;i++){

     intArray[i] = input.nextInt();

 }

 //This calls the swapValues method

 intArray=swapValues(intArray);

 //This prints the swapped array

 for (int i = 0; i < 4; i++){

 System.out.print( intArray[i]+ " ");     }

}  

}

At the end of the program, the elements are swapped and printed.

Read more about similar programs at:

brainly.com/question/14017034

6 0
3 years ago
Plz I’ll mark Brainliest
artcher [175]

Answer:

It's B cuz if somehow the power went off your work won't be saved. So it's best to save your work frequently.

6 0
3 years ago
Double click on a sheet tab to ______ the sheer
Anni [7]

its delete cuz i just tryed it now and i think im right if im wrong forgive me


8 0
3 years ago
Read 2 more answers
Other questions:
  • A network admin configures a static route on the edge router of a network to assign a gateway of last resort (the router that co
    9·1 answer
  • The stack ADT may be implemented with
    13·1 answer
  • Consumers’ ability to ""time shift"" programs using DVRs and Internet video and other situations that lack simultaneity is an ex
    6·1 answer
  • Answer the following
    11·1 answer
  • A bicycle sharing company is developing a multi-tier architecture to track the location of its bicycles during peak operating ho
    11·1 answer
  • Compose one paragraph (three to four sentences) explaining the difference between a courtesy copy and a blind courtesy copy (thi
    9·1 answer
  • What Fortnite skin is more og?
    5·2 answers
  • Who knows my cousin better?
    14·1 answer
  • So has anyone opened the link/file those people are giving out as answers? Like what are they, viruses, answers, nothing??? Some
    9·2 answers
  • This code is supposed to accept a word as input, and then print that word to the screen.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!