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
A Chain of dry-cleaning outlets wants to improve its operations by using data from devices at individual locations to make real-
Svetllana [295]

The technology would the business combination with its current cloud operations to make this possible are ERP and loT.

<h3>What is the ERP?</h3>

Enterprise resource planning (ERP) refers to a shape of a software program application that companies use to manipulate each day industrial organization sports activities in conjunction with accounting, procurement, task management, chance manage and compliance, and supply chain operations.

  1. Given the organization has a cloud setup, we need a company solution (ERP system) which needs to be to be had to all stores and loT to build up facts from devices and deliver it over to the ERP system.
  2. This will help to connect records at some crucial databases in cloud from all the stores.
  3. There need to be record protection features as well to maintain the records intact, all profits features need to be incorporated and tested.

Read more about the ERP :

brainly.com/question/14635097

#SPJ1

7 0
2 years ago
Force field meaning in science fiction
expeople1 [14]
In science fiction, a force field is a defensive barrier made up of energy. They are used to protect, people, an area, animals, etc from an attack or a destructive impact.
5 0
3 years ago
Assume the system with 256B memory and 64B cache and the block size of 16 bytes. I.e., there are 4 blocks in the cache.
Arada [10]

Answer:

a. 100%

b. 50%

c. 66.6%

Explanation:

a.

The memory references D6, 58, D8, 9A, DE and 5C all results in misses and the miss ratio is 100 (that is , 6 misses/ 6 references*100 = 100%)

b.

If fully associative cache is used, there will be a 3 cache misses with miss ratio of (3/6*100) = 50%.

c.

With a 2-way set-associative cache, 4 memory reference misses will occur, with a miss ratio of (4/6*100)= 66.6% misses.

6 0
3 years ago
How many bits do you need to count up to 30 help please
Soloha48 [4]

Answer:

5

Explanation:

2⁵ = 32, so that fits.

In general, to calculate the number of bits without guessing, you can take the 2 log of the number and then round up:

\log_2 30 \approx 4.9

rounded up gives 5.

3 0
3 years ago
A database, a database management system, and the application programs that use the data, make up a database environment.
BlackZzzverrR [31]

Answer:

A) The statement is true

8 0
3 years ago
Other questions:
  • Recall that book ciphers do not necessarily require a full book to decode, but instead any written text, such as the Declaration
    6·1 answer
  • Dominick has been hired to design a network for Pirate Press. In a paragraph of no less than 125 words, discuss what he needs to
    12·2 answers
  • Which computing component is similar to the human brain
    6·2 answers
  • The word computer consists of 64 bits, which is equivalent to _____ bytes.
    5·1 answer
  • Data cannot be sorted of filtered accurately if there are ________.
    10·2 answers
  • Can you clone apps form your PC and to other PC?<br>Yes or No
    13·2 answers
  • Television, radio, newspapers, magazines, the Internet, and other forms of communication are collectively referred to as thea. W
    15·1 answer
  • Complete the below method, isPalindrome(), that takes in a String and returns a boolean. The boolean should be true if the Strin
    7·1 answer
  • Which of the following is NOT part of the URL for an Internet web site?
    13·1 answer
  • An app ________ is a website that provides access to specific mobile apps that can be downloaded either for a nominal fee or fre
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!