when click on button every time the count is increament by
1,
initally count is 0,
for button click 1:
count =1;
count is not even then set background as GREEN and label text as
GO
for button click 2:
count =2;
count is even then set background as RED and label text as
STOP
.
.
.
for button click 9:
count =9;
count is not even then set background as RED and label text as
STOP
for button click 10:
count =10;
count is even then set background as GREEN and label text as
GO
for button click 11:
count =11;
count is not even then set background as RED and label text as
STOP
AND Button is disabled
label text as ARRIVED
set background as GREY
The program below is a GUI hander for a program with the following components. private int...
Modify Java Code below: - Remove Button Try the Number -Instead of Try the Number button just hit enter on keyboard to try number -Remove Button Quit import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Random; // Main Class public class GuessGame extends JFrame { // Declare class variables private static final long serialVersionUID = 1L; public static Object prompt1; private JTextField userInput; private JLabel comment = new JLabel(" "); private JLabel comment2 = new JLabel(" "); private int...
Add a timer to the lightbulb ON/OFF program such that the bulb stays on for 10 seconds after the ON button is pushed and then goes off. Put a new label on the lightbulb panel that counts the number of seconds the bulb is on and displays the number of seconds as it counts up from 0 to 10. THIS IS A JAVA PROGRAM. The image above is what it should look like. // Demonstrates mnemonics and tool tips. //********************************************************************...
please help me debug this Create a GUI for an application that lets the user calculate the hypotenuse of a right triangle. Use the Pythagorean Theorem to calculate the length of the third side. The Pythagorean Theorem states that the square of the hypotenuse of a right-triangle is equal to the sum of the squares of the opposite sides: alidate the user input so that the user must enter a double value for side A and B of the triangle....
Using the template below create a GUI with a push button event. Use a JTextArea to display which button was selected. /******************* Name: Date: Notes: *******************/ import javax.swing.*; import java.awt.*; import java.awt.event.*; class Actions extends JFrame implements ActionListener { Create the components (textarea and buttons) public Actions() { create the window (include a close operation) create the container (include FlowLayout) add the event listeners (button.addActionListener) add the components } public...
Can you help me to link two frames in Java Swing and then if you click "Proceed button" it will link to the Second Frame...Thank you :) First frame code: //First import javax.swing.*; import java.awt.event.*; import java.io.*; public class Sample extends JFrame implements ActionListener { JMenuBar mb; JMenu file; JMenuItem open; JTextArea ta; JButton proceed= new JButton("Proceed"); Sample() { open = new JMenuItem("Open File"); open.addActionListener(this); file = new JMenu("File"); file.add(open); mb = new JMenuBar(); mb.setBounds(0, 0, 400, 20); mb.add(file); ta...
Simple java GUI language translator. English to Spanish, French, or German import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class translatorApp extends JFrame implements ActionListener { public static final int width = 500; public static final int height = 300; public static final int no_of_lines = 10; public static final int chars_per_line = 20; private JTextArea lan1; private JTextArea lan2; public static void main(String[] args){ translatorApp gui = new translatorApp();...
in java. public class X extends JFrame JLabel AL; JTextField ATF; JButton AB; ABButtonHandler aBButtonHandler; private class ABButtonHandler implements ActionListener public void actionPerformed (ActionEvent e) t public X) < setTitle("X Window") setSize (300,50); setDefaultClose0peration (EXIT_ON_CLOSE) Container XwindowPane = XWindowPane.setLayout( AL = ATF = AB XWindowPane.add (AL); XWindowPane.add (ATF); XWindowPane.add (AB); aBButtonHand ler setVisible(true) J; Complete the above code to create the window shown below X Window AB When the button AB is clicked the text field will end up with...
import java.awt.*; import javax.swing.*; import java.awt.event.*; import javax.swing.BorderFactory; import javax.swing.border.Border; public class Q1 extends JFrame { public static void createAndShowGUI() { JFrame frame = new JFrame("Q1"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Font courierFont = new Font("Courier", Font.BOLD, 40); Font arialFont = new Font("Arial", Font.BOLD, 40); Font sansFont = new Font("Sans-serif", Font.BOLD, 20); JLabel label = new JLabel("Enter a word"); label.setFont(sansFont); Font font1 = new Font("Sans-serif", Font.BOLD, 40); ...
Swing File Adder: Build a GUI that contains an input file, text box and Infile button. It also must contain and output file, text box and Outfile button. Must also have a process button must read the infile and write to the outfile if not already written that is already selected and clear button. It must pull up a JFile chooser that allows us to brows to the file and places the full path name same with the output file. Program...
22. Fill in the codes that creates a Java GUI application that contains a label and a button. The label reads "Click the button to change the background color." When the button is clicked, the background is changed to a red color. The program produces the following output. Point 7 22.1 package javaapplication 179; import javax.swing": import java.ant": import java.awt.exst. public class ColorChange extends JFrame / not allowed to change JLabel label - new JLabel("Click the button to change the...