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
Netflix suggestions ?
hjlf

Answer:Lost in space

Explanation:It is a great space movie do not watch if your scared

3 0
3 years ago
Read 2 more answers
Which option will enable Mina to apply several formats to the spreadsheet cells at the same time?
madam [21]
Applying a cell style will enable Mina to apply several formats to the spreadsheet cells at the same time.  <span>To apply several formats in one step, and to make sure that cells have consistent formatting, you can use a cell style. A cell style is a defined set of formatting characteristics, such as fonts and font sizes, number formats, cell borders, and cell shading. </span>
4 0
3 years ago
Point giveaway and brainliest
melamori03 [73]

Thank you, pal!

You are invited to my clubhouse!

5 0
3 years ago
Read 2 more answers
An early attempt to force users to use less predictable passwords involved computer-supplied passwords. The passwords were eight
Sedaia [141]

Answer:

Recently, with the new and advanced hacking algorithms and affordable high-performance computers available to adversaries, the 36 character computer suggested passwords can easily be insecure.

Explanation:

The 8 length passwords generated pseudo-randomly by computers are not secure as there are new algorithms like the brute force algorithm that can dynamically obtain the passwords by looping through the password length and comparing all 36 characters to get the right one.

And also, the use of high-performance computers makes these algorithms effective

7 0
3 years ago
Place the optical discs in the increasing order of storage capacity.<br><br> UDO<br> CD<br> DVD
romanna [79]
<h2>Hello!</h2>

The answer is:

  1. CD
  2. DVD
  3. UDO
<h2>Why?</h2>

Optical disks are circular disks used as storage for binary data usually made of polycarbonate. The data is stored in the disc using a laser machine and accessed using a laser diode illuminating the data path in an optical disc drive.

CD: Compact Discs are the most basic optical disk used today, with only a capacity that goes from 0.7 GB (700 MB) to 0.84 GB (840 MB).

DVD: Digital Versatile Discs increase the storage up to 6 times compared with a CD, the capacity of DVDs optical disks goes from 4.7 GB (4700 MB) to about 17 GB(17000 MB).

UDO: Ultra Density Optical have high capacity storage that goes from 30 GB (30000 MB) to about 60 GB (6000 MB).

Have a nice day!

4 0
3 years ago
Other questions:
  • Sean is white hat hacker, who is demonstrating a network level session hijack attacks and as part of it, he has injected malicio
    6·1 answer
  • Please answer this correctly the underline drop down menu in the font group contains options to underline
    13·1 answer
  • Where are the instructions stored that the computer needs when it is switched on?
    7·1 answer
  • A common technique for masking contents of messages or other information traffic so that opponents can not extract the informati
    14·1 answer
  • How to do this PLEASE HELP 80 points!
    15·1 answer
  • Device driver:<br> System software or application software
    11·2 answers
  • Is it possible for a PowerPoint user to add notes to slides and see the added comments
    10·1 answer
  • Select the correct answer.
    15·1 answer
  • Which of the following sentences use personification 
    9·1 answer
  • What makes you normally visit the site-graphics, layout, or content? Why?​
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!