Solved

Import Java.awt.*; Import Javax.swing.*;

Question 48

Essay

import java.awt.*;
import javax.swing.*;
import java.awt.Color;
public class JFrameWithColor extends JFrame
{
    private final int SIZE = 180;
    private Container con = getContentPane();
    private JButton button =
      new JButton("Press Me");
   public JFrameWithColor()
   {
      super("Frame");
      setSize(SIZE, SIZE);
      con.setLayout(new FlowLayout());
      con.add(button);
      -----Code here-----
      -----Code here-----
      -----Code here-----
   }
   public static void main(String[] args)
   {
       JFrameWithColor frame =
         new JFrameWithColor();
       frame.setVisible(true);
   }
} In the first indicated line, write the statement to set the background color of the JFrame 's content pane to gray. Using the remaining two indicated lines, write the statements to set the JButton foreground color to white and the background color to blue.

Correct Answer:

verifed

Verified

con.setBackground(Color.YELLOW...

View Answer

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents