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

  What were the beliefs of moor and finnis

What were the beliefs of Moor and Finnis. How were they similar and how were they different. Explain if they would apply to users of cyberspace. If they do explain how, if they do not explain how and support your work.

  . what options does atrium have for acquiring a new system

Atrium Bio-Medical Supply is a medium sized regional supplier of medical and laboratory equipment.Since starting 12 years ago,Victoria Dawn has built Atrium into a competitive supply company across several metro areas,but her growth potential is l..

  Describe how the referential integrity restrict

Describe how the referential integrity restrict, cascade, and set-to-null delete rules operate in a relational database

  Regular expression and regular sets that is not solvable

Give an example of a problem about FSAs, Regular Expression and Regular Sets that is not solvable?

  How much would it have cost to have corrected fault

How much would it have cost to have corrected the fault during the specification phase? What should be the best answer to this question by a software engineering?

  Create a change - counting game

create a change - counting game that gets the user to enter the number of coins required to make exactly one dollar. the program should let the user enter the number of pennies,nickels,dimes, and quarters.

  Explain whetherucita should or should not be adopted

What are your arguments in support of these points? You really did not answer the question as these don't really explain whether you believe the UCITA should or should not be adopted.

  Create method takes two integers input parameters and cheks

Create a method that takes two integers input parameters and checks whether one number is divisible by the other

  Access and control of personal information

In debates regarding access and control of personal information, it is sometimes argued that an appropriate balance needs to be struck between individuals and organizations

  Business intelligence and data warehouses

Business Intelligence and Data Warehouses

  How to make components of system user-friendly

How do components of your computer system interact within system? What improvements or additions to your system do you think would benefit you or make system more user-friendly? Why?

  We enhance a machine making all floating-point instructions

Suppose we enhance a machine making all floating-point instructions run five times faster. If the execution time of some benchmark before the floating-point enhancement is 10 seconds, what will the speedup be if half of the 10 seconds is spent exe..

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