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]
3 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]3 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
What is the total utilization of a circuit-switched network, accommodating five users with equal bandwidth share, and the follow
VMariaS [17]

Answer: 49.0%

Explanation:

Given the total number of users = 5

Let the total bandwidth be 100 units

Each user share = 100/5 units = 20 units each

• 2 users are using 63% of their shared bandwidth:

This means 63% of 20 units = 0.63 *2*20 = 25.2

• 2 users are using 58% of their shared bandwidth:

This means 58% of 20 units = 0.58* 2* 20 = 23.2

• 1 user uses 3% of their bandwidth share:

This means 3% of 20 units = 0.03* 1* 20 = 0.6

Therefore, total amount of used bandwidth becomes = 25.2 + 23.2 + 0.6

Total bandwidth under usage = 25.2 + 23.2 + 0.6 = 49

Utilization becomes = (bandwidth under usage/ maximum bandwidth)*100

(49/100)*100 = 49%

I hope this helps, cheers.

4 0
3 years ago
An exact-match query is:
Greeley [361]

Answer:

C. Where a record is returned if its unique identifier matches the search value

Explanation:

Exact match is a Google keyword match type that allows you show your adverts when searcher type the exact word or phrase you are bidding on. An exact match query will always return records that matches what is being searched on.

5 0
3 years ago
An international package shipping company like FedEx needs to be able to track the location of every package at every stage in t
Luba_88 [7]

Answer:

<em>The specific type of software useful in this situation would be a ship manager software. </em>

Explanation:

<em>It is a stand alone, user installable, windows-based software package designed to allow the quickly ship, track, and report the daily activities.</em>

<em>In addition to managing shipment information, the software keeps the details of the operation, so that the user can easily retrieve necessary information about his shipments.</em>

8 0
3 years ago
Read 2 more answers
A computer with 5 stage pipeline like the one descrive in class delas with conditional branches by stalling for the next three c
trasher [3.6K]

Answer:

It hurts 80%

Explanation:

7 0
3 years ago
Explain briefly what would happen if marketing research is not conducted before a product is developed and produced for sale.
andreyandreev [35.5K]

Neglecting to do market research can result in indecision and inaction, fear of risk or the truth, and/or too many options, which can lead to paralysis. ... When launching a new product, effective market research will help you narrow down your true market potential and your most likely customers.

6 0
3 years ago
Other questions:
  • Copyrighted software that is distributed at no cost for a trial period is called?
    12·1 answer
  • 11. In Microsoft Word, when you highlight existing text you want to replace, you're in
    8·1 answer
  • you'll be organizing the various databases in your organization, and have recommended hiring a/an?A. internet specialist B. comp
    6·2 answers
  • Why is proper planning important?
    10·1 answer
  • Holly has at most $828 to spend for moving from her old apartment. The moving company charges $80 per hour plus at rate of $300.
    9·1 answer
  • What types of storage can be used to access your data on another computer
    5·1 answer
  • .WAP to enter monthly sale of Salesman and give him commission i.E. If the monthly sale is more than 500000 then commision will
    6·1 answer
  • 4.1 code practice python
    13·1 answer
  • Which of the following numbers is of type
    6·1 answer
  • What are 15 importance of information processing cycle?
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!