0% found this document useful (0 votes)
3 views

CodeOutput

The document is a Java program that creates a graphical user interface (GUI) using Swing to adjust volume settings for different environments (ECO, AUDITORIUM, NONE). It includes radio buttons for selection, sliders for volume adjustment, and labels for clarity, along with 'OK' and 'CANCEL' buttons for user actions. The GUI is set against a black background with various colors for components to enhance visibility.

Uploaded by

snehatumaskar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

CodeOutput

The document is a Java program that creates a graphical user interface (GUI) using Swing to adjust volume settings for different environments (ECO, AUDITORIUM, NONE). It includes radio buttons for selection, sliders for volume adjustment, and labels for clarity, along with 'OK' and 'CANCEL' buttons for user actions. The GUI is set against a black background with various colors for components to enhance visibility.

Uploaded by

snehatumaskar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Volume :-

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Exampledemo2 {


public static void main(String[] args) {
JFrame frame = new JFrame("Work");
frame.getContentPane().setBackground(Color.BLACK);
// Create a JLabel
JLabel label = new JLabel("VOLUME");
label.setForeground(Color.ORANGE);
label.setFont(new Font("Serif", Font.BOLD, 20));
label.setBounds(290, 50, 200, 30);
frame.add(label);
// Creating a radiobutton
CheckboxGroup CBG = new CheckboxGroup();
Checkbox cb1 = new Checkbox("ECO",true,CBG);
Checkbox cb2 = new Checkbox("AUDITORIUM",false,CBG);
Checkbox cb3 = new Checkbox("NONE",false,CBG);
cb1.setForeground(Color.WHITE);
cb2.setForeground(Color.WHITE);
cb3.setForeground(Color.WHITE);
cb1.setFont(new Font("Serif", Font.BOLD,19));
cb2.setFont(new Font("Serif", Font.BOLD,19));
cb3.setFont(new Font("Serif", Font.BOLD,19));
cb1.setBounds(90,100,80,50);
cb2.setBounds(250,100,190,50);
cb3.setBounds(490,100,190,50);
frame.add(cb1);
frame.add(cb2);
frame.add(cb3);
//Creating a Slider for eco
JSlider slider = new JSlider(JSlider.VERTICAL, 0, 20, 0);
slider.setMinorTickSpacing(2);
slider.setMajorTickSpacing(10);
slider.setPaintTicks(true);
slider.setPaintLabels(true);
slider.setForeground(Color.BLUE);
slider.setBounds(100, 170, 50, 150);
frame.add(slider);
//Creating a Slider for auditorium
JSlider slider1 = new JSlider(JSlider.VERTICAL, 0, 20, 0);
slider1.setMinorTickSpacing(2);
slider1.setMajorTickSpacing(10);
slider1.setPaintTicks(true);
slider1.setPaintLabels(true);
slider1.setForeground(Color.BLUE);
slider1.setBounds(300, 170, 50, 150);
frame.add(slider1);
//Creating a Slider for none
JSlider slider2 = new JSlider(JSlider.VERTICAL, 0, 20, 0);
slider2.setMinorTickSpacing(2);
slider2.setMajorTickSpacing(10);
slider2.setPaintTicks(true);
slider2.setPaintLabels(true);
slider2.setForeground(Color.BLUE);
slider2.setBounds(500, 170, 50, 150);
frame.add(slider2);
// creating label for eco/System
JLabel label1 = new JLabel("System");
label1.setForeground(Color.GREEN);
label1.setFont(new Font("Serif", Font.BOLD, 20));
label1.setBounds(100, 350, 120, 30);
frame.add(label1);
// creating label for auditorium/Device
JLabel label2 = new JLabel("Device");
label2.setForeground(Color.GREEN);
label2.setFont(new Font("Serif", Font.BOLD, 20));
label2.setBounds(300, 350, 120, 30);
frame.add(label2);
// creating label for eco/Notification
JLabel label3 = new JLabel("Notification");
label3.setForeground(Color.GREEN);
label3.setFont(new Font("Serif", Font.BOLD, 20));
label3.setBounds(500, 350, 120, 30);
frame.add(label3);
// creating label for Advance operation
JLabel label4 = new JLabel("Click To Apply The Changes");
label4.setForeground(Color.WHITE);
label4.setFont(new Font("Serif", Font.BOLD, 17));
label4.setBounds(120, 400, 250, 25);
frame.add(label4);
//creating the Button OK
JButton b = new JButton("OK");
b.setFont(new Font("Serif", Font.BOLD, 15));
b.setForeground(Color.BLACK);
b.setBounds(340,400,60,25);
frame.add(b);
//creating the Button Cancel
JButton b1 = new JButton("CANCEL");
b1.setFont(new Font("Serif", Font.BOLD, 15));
b1.setForeground(Color.BLACK);
b1.setBounds(420,400,120,25);
frame.add(b1);
frame.setLayout(null);
frame.setSize(1000, 600);
frame.setVisible(true);
}
}

You might also like