[ create a new paste ] login | about

Link: http://codepad.org/GuGNKjS3    [ raw code | fork ]

C, pasted on Oct 19:
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;



public class temperature extends JPanel {
	
	public static void main(String[] args) {
		

			int StartProduct = 0;
			int EndProduct = 0;
			
			JLabel QueryInput = new JLabel("Select a measurement to convert from, and enter the temperature.");
			JLabel Output = new JLabel("Which measurement do you want to convert to?");
			
			JRadioButton Fahrenheit = new JRadioButton("Fahrenheit");
			JRadioButton Celsius = new JRadioButton("Celsius");
			JRadioButton Kelvin = new JRadioButton("Kelvin");
			
			JRadioButton Fahrenheit2 = new JRadioButton("Fahrenheit");
			JRadioButton Celsius2 = new JRadioButton("Celsius");
			JRadioButton Kelvin2 = new JRadioButton("Kelvin");
			
			JTextField Input = new JTextField(15);
			String InputText = Input.getText();
			
			InputText.addActionListener(this);
			
			int a = Integer.parseInt(InputText);
			
			JLabel Converted = new JLabel("The converted temperature is: " + a);
		
			JPanel BasePanel = new JPanel(new GridLayout(6,0));
			JPanel ConvertFrom = new JPanel(new GridLayout(0,3));
			JPanel InputBox = new JPanel();
			JPanel ConvertTo = new JPanel(new GridLayout(0,3));
			JPanel Result = new JPanel();
			JPanel Label1 = new JPanel();
			JPanel Label2 = new JPanel();
			
			Label1.add(QueryInput);
			Label2.add(Output);
			ConvertFrom.add(Fahrenheit);
			ConvertFrom.add(Celsius);
			ConvertFrom.add(Kelvin);
			ConvertTo.add(Fahrenheit2);
			ConvertTo.add(Celsius2);
			ConvertTo.add(Kelvin2);
			InputBox.add(Input);
			Result.add(Converted);

			BasePanel.add(Label1);
			BasePanel.add(ConvertFrom);
			BasePanel.add(InputBox);
			BasePanel.add(Output);
			BasePanel.add(ConvertTo);
			BasePanel.add(Result);

			JFrame frame = new JFrame("Temperature Conversion"); 
			frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
			frame.setVisible(true);  
			frame.add(BasePanel);
			frame.setSize (400, 210);
			
	}

}


Create a new paste based on this one


Comments: