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
sertanlavr [38]
2 years ago
5

How would you write this using Java: Use a TextField's setText method to set value 0 or 1 as a string?

Computers and Technology
1 answer:
katrin [286]2 years ago
3 0

Answer:

Explanation:

The following Java code uses JavaFX to create a canvas in order to fit the 10x10 matrix and then automatically and randomly populates it with 0's and 1's using the setText method to set the values as a String

import javafx.application.Application;

import javafx.scene.Scene;

import javafx.scene.control.TextField;

import javafx.scene.layout.GridPane;

import javafx.stage.Stage;

public class Main extends Application {

   private static final int canvasHEIGHT = 300;

   private static final int canvasWIDTH = 300;

   public void start(Stage primaryStage) {

       GridPane pane = new GridPane();

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

           for (int j = 0; j < 10; j++) {

               TextField text = new TextField();

               text.setText(Integer.toString((int)(Math.random() * 2)));

               text.setMinWidth(canvasWIDTH / 10.0);

               text.setMaxWidth(canvasWIDTH / 10.0);

               text.setMinHeight(canvasHEIGHT / 10.0);

               text.setMaxHeight(canvasHEIGHT / 10.0);

               pane.add(text, j, i);

           }

       }

       Scene scene = new Scene(pane, canvasWIDTH, canvasHEIGHT);

       primaryStage.setScene(scene);

       primaryStage.setMinWidth(canvasWIDTH);

       primaryStage.setMinHeight(canvasHEIGHT);

       primaryStage.setTitle("10 by 10 matrix");

       primaryStage.show();

   }

   public static void main(String[] args) {

       Application.launch(args);

   }

}

You might be interested in
Each wireless network has its own name to identify it, known as service set identity. true false
Dominik [7]
True. The acronym for service set identity is SSID, which you've likely saw before. And like you say, it's simply the unique name given to a wireless network so that we are able to identify what network we are connecting to.
8 0
2 years ago
Convert to binary 140
Ber [7]

00110001 00110100 00110000

5 0
3 years ago
The four levels of FBLA membership
Nataly_w [17]

Answer:

Future Business Leaders of America (FBLA) for high school students; FBLA-Middle Level for junior high, middle, and intermediate school students; Phi Beta Lambda (PBL) for post secondary students; and Professional Division for those not enrolled in school or post secondary school

Explanation:

7 0
3 years ago
A technician has just installed a new SOHO router for several users to share an Internet connection. He received a call that, wh
Katena32 [7]

Answer:

The technician needs to adjust the quality of service tool.

Explanation:

Quality of Service (QoS) tool is a feature in  routers and switches which prioritizes traffic so that more important traffic can pass first which results in an improved performance for critical network traffic.

So whenever a complaint is made to the technician that a particular user is using much of the browsing speed which is slowing down the browsing speed of others,  The technician needs to adjust the Quality of Service tool of the router that allows the router to share the bandwith among users.

7 0
3 years ago
A constructor can be overloaded with more than one function which has the same name but with what two different things
andreyandreev [35.5K]
<h2>Answer:</h2>

i. Number of parameters

ii. Type of parameters

<h2>Explanation:</h2>

When there are two or more constructors, definitely with the same name, in a given class, then the constructors are said to be overloaded. An overloaded constructor appears declared many times in a class but each time with different number of parameters and/or type of parameters.

For example, given a class Test, the following combination of constructors can exist;

i. public Test(int x){

   

 }

ii. public Test(String m){

     

  }

iii. public Test(int a, String b){

 

}

<em>The following should be noted;</em>

In the case of combination (i) and (ii), the constructors have the same number of parameters but different type of parameter. In other words, they both have 1 parameter but while the first one has a parameter type of <em>int</em>, the second has a parameter type of <em>String</em>.

In the case of combination (ii) and (iii), the constructors have different number of parameters and of course different type of parameters. In other words, the second constructor has 1 parameter of type <em>String</em> while the third constructor has 2 parameters of types <em>int</em> and <em>String</em>.

5 0
3 years ago
Other questions:
  • Which amendment discussed in the unit do you think has the greatest effect on your life? Why?
    14·1 answer
  • Please help me please and thank you!
    14·1 answer
  • Multiple users report that the network printer, which is connected through the print server, is not printing. Which of the follo
    12·1 answer
  • The need to strike a<br>- among work, life, family, and other responsibilities is<br>universal.​
    15·1 answer
  • All of the following are helpful test taking strategies EXCEPT_______________.
    5·2 answers
  • An organization is developing an authentication service for use at the entry and exit ports of country borders. The service will
    10·1 answer
  • Impaired drivers are one of the many risks drivers face on the Highway Transportation System. List 3 signs that a driver could b
    10·2 answers
  • Why use LinkedIn automation for LinkedIn?
    10·1 answer
  • Create a vector of structures experiments that stores information on subjects used in an experiment. Each struct has four fields
    12·1 answer
  • Help brainleist giving exam
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!