Create a jframe that uses borderlayout

Assignment Help Basic Computer Science
Reference no: EM13306236

Create a JFrame that uses BorderLayout. Place a JButton in the center region. Each time the user clicks the JButton, change the background color in one of the other regions. Save the file as JColorFrame.java.

 

Okay, So I wrote the program in netbeans and I didn't get any errors during the build. But when I compile and run the program from the terminal nothing happens. Is there somethind I'm doing wrong?

 

/*import java.awt.*;

 

import java.awt.event.*;

 

 

public class JColorFrame extends Frame implements ActionListener

 

{

 

Button colorButton = new Button("Change");

 

Panel cp = new Panel();

 

Panel np = new Panel();

 

Panel sp = new Panel();

 

Panel ep = new Panel();

 

Panel wp = new Panel();

 

int count = 0;

 

public JColorFrame()

 

{

 

super("Colors");

 

setLayout(new BorderLayout());

 

cp.add(colorButton);

 

add(np, "North");

 

add(sp, "South");

 

add(ep, "East");

 

add(wp, "West");

 

add(cp, "Center");

 

colorButton.addActionListener(this);

 

}

 

public void actionPerformed(ActionEvent e)

 

{

 

if(count%5==0)

 

np.setBackground(Color.green);

 

else if(count%5==1)

 

ep.setBackground(Color.magenta);

 

else if(count%5==2)

 

wp.setBackground(Color.orange);

 

else if(count%5==3)

 

sp.setBackground(Color.red);

 

else

 

{

 

ep.setBackground(Color.white);

 

sp.setBackground(Color.white);

 

np.setBackground(Color.white);

 

wp.setBackground(Color.white);

 

}

 

 

++count;

 

}

 

}

* To change this template, choose Tools | Templates

* and open the template in the editor.

*/

 

/**

*

* @author SeriousOrangutan

*/

public class JColorFrame {

 

/**

* @param args the command line arguments

*/

public static void main(String[] args) {

// TODO code application logic here

}

}

 

Reference no: EM13306236

Questions Cloud

Write a program and create a flow chart : The game of Nim. This is a well-known game with a number of variants. We will consider the following variants, which has an interesting winning strategy. Two players alternately take marbles from a pile.
How are adc used in medical devices : How are ADC's used in medical devices? Please give examples
Create a list containing the union of the elements : Create a list containing the union of the elements of the two lists? Insert an element after the nth element of the list.?
Battleship redux : Game Battleship is back and better than ever. Instead of hacking everything together in C, you will instead leverage C++ and all of your newly gained object oriented programming knowledge to construct a much cleaner end product.
Create a jframe that uses borderlayout : Create a JFrame that uses BorderLayout. Place a JButton in the center region. Each time the user clicks the JButton, change the background color in one of the other regions. Save the file as JColorFrame.java.
Determine the length of the strings of this instrument : Your friend recently purchased a musical instrument that generates sound waves using several strings. Determine the length of the strings of this instrument
Determine aerodynamic drag on the full-scale prototyple car : The aerodynamic drag of a new sports car is to be predicted at a speed of 50mph at an air temperature of 25 degrees Celcius. Automotive engineers build a one-fifth scale model of the car to test in a wind tunnel.
Calculate the minimum required wall thickness t-min : A tubular aluminium bar (G=28GPa) of square cross section with outer dimensions 50mm x 50mm must resist a torque T=300Nm. Calculate the minimum required wall thickness t_min if allowbale shear stress is 20MPa
Discuss and share rich and diverse assortment of reference : Discuss and share the rich and diverse assortment of reference sources for the Bourne Again Shell (BASH).

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd