Skip to content

Instantly share code, notes, and snippets.

@irinaaZ
irinaaZ / CelsiusFahrenheitConverter.java
Created June 19, 2018 20:32
1. Write a temperature-conversion application that converts from Fahrenheit to Celsius. The Fahrenheit temperature should be entered from the keyboard (via a JTextField). A JLabel should be used to display the converted temperature.
package FahrenheitTask;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.DecimalFormat;
public class CelsiusFahrenheitConverter extends JFrame implements ActionListener {
private final JTextField jTextField;
package JUnittasks;
import javax.swing.*;
import java.awt.*;
public class Align extends JFrame {
private final JCheckBox snapToGrid, showGrid;
private final JLabel labelX, labelY;
private final JTextField fieldX, fieldY;
private final JButton ok, cancel, help;
package JUnittasks;
import javax.swing.*;
import java.awt.*;
public class Calculator extends JFrame {
private final JTextField jTextField;
private final JButton zero, one, two, three, four, five, six, seven, eight, nine;
private final JButton add, sub, mul, div, dot, equal;
private ButtonGroup buttonGroup;
package JUnittasks;
import javax.swing.*;
import java.awt.*;
public class ColorSelect extends JFrame {
private final JComboBox<String> colorBox;
private static final String[] colorNames =
{"RED", "BLUE", "YELLOW"};
private final JCheckBox background;