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
DiKsa [7]
3 years ago
6

Using javaFX components

Computers and Technology
1 answer:
AysviL [449]3 years ago
3 0

Answer:

package colorchanger;

import javafx.application.Application;

import javafx.geometry.Insets;

import javafx.scene.Scene;

import javafx.scene.control.RadioButton;

import javafx.scene.control.ToggleGroup;

import javafx.scene.layout.HBox;

import javafx.stage.Stage;

public class ColorChanger extends Application {

   @Override

   public void start(Stage primaryStage) {

       //Create the two radio buttons

       RadioButton radio1 = new RadioButton("White");

       RadioButton radio2 = new RadioButton("Red");

       //Create a toggle group for the buttons

       ToggleGroup tg = new ToggleGroup();

       //Add the two buttons to the toggle group

       radio1.setToggleGroup(tg);

       radio2.setToggleGroup(tg);

       //Create an HBox to hold the two radio buttons

       HBox hb = new HBox();

       hb.getChildren().addAll(radio1, radio2);

       hb.setPadding(new Insets(10));

       hb.setSpacing(10);

       hb.setPrefSize(30, 15);

       //Set action for the two buttons

       //When the radio1 button is clicked, the background color of the horizontal box (HBox) changes to white

       radio1.setOnAction(e -> {

           hb.setStyle("-fx-background-color:white");

       });

       //When the radio2 button is clicked, the background color of the horizontal box (HBox) changes to red

       radio2.setOnAction(e -> {

           hb.setStyle("-fx-background-color:red");

       });

       //Create a scene to hold the HBox

       Scene scene = new Scene(hb, 300, 250);

       //Create a primary stage to act as window

       primaryStage.setTitle("Color Changer");

       primaryStage.setScene(scene);

       primaryStage.show();

   }

   /**

    * @param args the command line arguments

    */

   public static void main(String[] args) {

       launch(args);

   }

}

Explanation:

Go through the comments in the code for explanation.

The source code file has also been attached to this response.

Hope this helps!

Download java
You might be interested in
Ep-34 where should you aim a fire extinguisher's stream when extinguishing a fire?
patriot [66]
When extinguishing a fire, the extinguisher's stream should be aimed at the base of the flame using a sweeping motion. This will allow one to kill the fire from the source. This will quickly put out the fire faster applying the extinguisher from the upside.
8 0
4 years ago
Intellectual property rights protect people’s and organization’s ideas and other intellectual assets. However, in certain cases,
Katarina [22]

Answer:

negative effect

Explanation:

its right on edg

8 0
3 years ago
How do i use marketing in my everyday life
Alexxandr [17]
1. Subscribe to more emails
2. Look at billboards
3. Stop muting those pesky commercials
4. Listen to music
5. Step away from your work
8 0
3 years ago
From the perspective of the prosecution, the safest legal means of obtaining incriminating documents from a suspect is by: a. Su
never [62]

Answer:

a. Subpoena duces tectum

Explanation:

<u>Options C </u>(an informant steal the documents)<u> and D</u> (discrete copy of the documents) <u>would be considered illegal and/or inadmissible in most places</u>, so you should avoid these.

Options A (subpoena) and B (search warrant) are usually issued by a judge after considerations, so they are both legal ways to obtain something.

In a subpoena duces tecum, the court orders an individual (or a moral person) to produce (usually very specific) documents to court or face penalty.

<u>A search warrant is executed by law enforcement officials who are seeking information to help in their investigation</u>, usually not highly specific (not 'search for a copy of the April 10 minutes of the meeting.').

3 0
4 years ago
100 POINTS + BRAINLYEST TO FIRST PERSON THAT IS CORRECT!!! Tomika wants to create a cell style for her workbook and share it wit
andrew11 [14]

Answer:

Go to the Home tab on the ribbon and the group Styles.

Left Click Cell Styles, then click New Cell Style and create the style.

To share it with other workbooks, use the Merge Styles function in the same group.

Explanation:

This info was for excel.

Please mark brainliest!

6 0
3 years ago
Read 2 more answers
Other questions:
  • python Write a class named Taxicab that has three **private** data members: one that holds the current x-coordinate, one that ho
    10·1 answer
  • Devices used for viewing images from one computer to another over the internet
    6·1 answer
  • What is the only language a microprocessor can process directly but most programmers almost never write programs in this code?
    5·1 answer
  • In statistics, what is the mode of a data set?
    6·2 answers
  • What portable computing devices, designed for user convenience, have a sensor called an accelerometer that senses vibrations and
    10·1 answer
  • Which of the following is the most common tool that Windows administrators use on the domain controller?
    9·1 answer
  • Linda is training to become a certified network design expert and consultant. While researching about the process of cellular ra
    12·1 answer
  • Write MVCTester.java. When the program starts, the initial screen displays a button labeled "add", a blank text area, and a text
    14·2 answers
  • List any two characteristics of ASCC.​
    5·2 answers
  • Ummm, I hate to interrupt your day, but does anyone know where Mitch72 is????? Because he hasn't talked in a week, and he hasn't
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!