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
musickatia [10]
3 years ago
14

Design a GUI program as follows: The program will open up a window that contains a read-only text box and 2 buttons. One button

should say "I feel lucky! :)" on it and the other button should say "I don't feel lucky :( ". (Because why not, I actually used the emojis, but you don't have to) When the user clicks the "I feel lucky" button, the background color should change from white to something else (you can choose, I chose magenta), and the text box should say "You're lucky!" When the user clicks the "I don't feel lucky" button, the background color should become white again (or it should stay white if it was already) and the text box should become blank.

Computers and Technology
1 answer:
Marizza181 [45]3 years ago
6 0

Answer:

Kindly note that, you're to replace "at" with shift 2 as the brainly text editor can't accept the symbol

Explanation:

A graphical user interface (GUI) allows a user to interact with a computer program using a pointing device that manipulates small pictures on a computer screen. The small pictures are called icons or widgets. Various types of pointing devices can be used, such as a mouse, a stylus pen, or a human finger on a touch screen

import java.awt.Color;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JPanel;

import javax.swing.JTextField;

public class LuckyButtons {

  static JFrame frame = new JFrame("Lucky Buttons");

  static JPanel panel = new JPanel();

  public static void main(String s[]) {

      panel.setLayout(null);

      final JTextField txt1 = new JTextField(10);

      txt1.setBounds(200, 50, 100, 30);

      // password field

      final JTextField txt2 = new JTextField(10);

      txt2.setBounds(320, 50, 100, 30);

      txt1.setEnabled(false);

      txt2.setEnabled(false);

      JButton btn1 = new JButton();

      btn1.setText("I feel lucky! :)");

      btn1.setBounds(200, 150, 130, 20);

      JButton btn2 = new JButton();

      btn2.setText("I don't feel lucky :(");

      btn2.setBounds(350, 150, 150, 20);

      btn1.addActionListener(new ActionListener() {

           "at"Override

          public void actionPerformed(ActionEvent aE) {

                  txt1.setText("I feel lucky! :)");

                  txt2.setText("I feel lucky! :)");

                  panel.setBackground(Color.red);

          }

      });

      btn2.addActionListener(new ActionListener() {

          "at"Override

          public void actionPerformed(ActionEvent aE) {

              txt1.setText("I don't feel lucky :(");

              txt2.setText("I don't feel lucky :(");

              panel.setBackground(Color.white);

          }

      });

      panel.add(txt1);

      panel.add(txt2);

      panel.add(btn1);

      panel.add(btn2);

     

      frame.add(panel);

      frame.setSize(600, 300);

      frame.setLocationRelativeTo(null);

      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

      frame.setVisible(true);

  }

}

Kindly check the attached image below for the code output.

You might be interested in
Match each term in the second column with its correct definition in the first column. Write the letter of the term on the blank
Thepotemich [5.8K]

Answer:

1. Pie chart.

2. Goal seek.

3. Relative reference cell.

4. Data marker.

5. Chart sheet.

6. What-If-Analysis.

7. Rate = \frac {Amount \; of \; increase}{Base}

8. Order of operations.

9. Formula AutoComplete.

10. Axis.

11. Category axis.

12. Value axis

13. Value \; after \; increase = Base * Percent \; for \; new \; value

Explanation:

Microsoft Excel is a software application or program designed and developed by Microsoft Inc., for analyzing and visualizing spreadsheet documents.

A spreadsheet can be defined as a file or document which comprises of cells in a tabulated format (rows and columns) typically used for formatting, arranging, analyzing, storing, calculating and sorting data on computer systems.

Some of the terminologies and features of the Microsoft Excel software includes the following;

1. Pie chart: a chart that shows the relationship of each part to a whole.

2. Goal seek: a what-if-analysis tool that finds the input needed in one cell to arrive at the desired result in another cell.

3. Relative reference cell: in a formula, the address of a cell based on the relative position of the cell that contains the formula and the cell referred to in the formula.

4. Data marker: a column, bar, area, dot, pie slice, or other symbol in a chart that represents a single data point.

5. Chart sheet: a workbook sheet that contains only a chart.

6. What-If-Analysis: the process of changing the values in cells to see how those changes affect the outcome of formulas in a worksheet.

7. Rate = \frac {Amount \; of \; increase}{Base}: The mathematical formula to calculate a rate of increase.

8. Order of operations: the mathematical rules for performing multiple calculations within a formula.

9. Formula AutoComplete: the excel feature which, after typing - and the first letter of a function, displays a list of function names.

10. Axis: a line that serves as a frame of reference for measurement and that borders the chart plot area.

11. Category axis: the area along the bottom of a chart the identifies the categories of data, also referred to as the x-axis.

12. Value axis: a numerical scale on the left side of a chart that shows the range of numbers for the data points, also referred to as the y-axis.

13. Value \; after \; increase = Base * Percent \; for \; new \; value: the formula for calculating the value after an increase by multiplying the original value the base by the percent for new value.

5 0
3 years ago
What variation pairs a new employee with an employee who has been with the company for 20 years?
Eva8 [605]

The variation pairs a new employee with an old employee usually focus on employee accomplishments, and criteria that employee meets or not.

<h3>What are the Appraisal Methods used to evaluate an employee's performance?</h3>

The behavioral method is known to be one of the ways to check an employee's actions within a given job.

Conclusively, There is also the use of Comparative methods that tends to compare one employee with different employees. The use of Results methods are the ones that looks into  employee accomplishments.

Learn more about variation pairs from

brainly.com/question/19262673

4 0
2 years ago
Read 2 more answers
Which of the following statements is true of a server? Question 18 options: A) It supports processing requests from remote compu
TiliK225 [7]

Answer:

Option (A) is the correct answer of this question.

Explanation:

The server supports the processing requests from the remote computers. A system is a device built to accommodate inquiries from many other external systems and customers to execute transactions. Employees are called private computer ,tablets, including phones which connect websites.

Network resources are handled through servers.The server is a software application or tool providing a service to some other software program and its customer, also identified as those of the user.

Other options are incorrect because they are not related to the given scenario.

5 0
3 years ago
The most popular input device of a computer is a(n) ____.
zaharov [31]
A keyboard and a mouse

7 0
3 years ago
Which of these is an example of gathering secondary data?
Soloha48 [4]

Answer:

searching for a chart

Explanation:

:)

7 0
3 years ago
Other questions:
  • When did the digital revolution begin
    10·1 answer
  • How could a system be designed to allow a choice of operating systems from which to boot? What would the bootstrap program need
    14·1 answer
  • Două numere a și b sunt numite generatoare ale unui număr natural n dacă a∙b+[a/b]=n, unde s-a notat cu [c] partea întreagă a nu
    7·1 answer
  • A disadvantage of a bus network is that _____. a. failure in one workstation necessarily affects other workstations on the netwo
    7·1 answer
  • The countryside presents
    11·1 answer
  • Which of the following is most likely to be a result of hacking? Group of answer choices slowing of network speed certain Web si
    13·1 answer
  • Why must you be careful when handling a hard drive?
    10·1 answer
  • If Anime Characters were real , Who Would Your Anime Wife Would Be (Tell Who And Why)
    10·1 answer
  • Write a java code to print Multiplication Table Till 20
    14·2 answers
  • Help help help help help help help help
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!