Home of the Ultimate Xbox 360 Modding Tool, Horizon. XboxMB.com is a community of Xbox 360 gamers and modders who share Tutorials, News, Reviews, and other resources. Xbox Message Boards is free to sign up and use, so what are you waiting for? Register Now!
java.util.Scanner scanner = new java.util.Scanner(System.in);
System.out.println("Enter some text.");
String userInput = scanner.next();
2.
This is just putting a button on the form, I'm not going to make a calculator, but from that you should be able to figure it out. Also you can play around with the size values.
Code:
import java.awt.event.*;
import javax.swing.*;
public class stuff extends JFrame
{
public static void main(String[] args)
{
GUI g = new GUI();
}
}
class GUI extends JFrame
{
private static final long serialVersionUID = 1L;
public GUI()
{
setTitle("Sick Calculator");
setSize(150, 150);
setLayout(null);
setResizable(false);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JButton button = new JButton("MY TEXT");
button.setLocation(20, 20);
button.setSize(100, 20);
ButtonClickHandler bch = new ButtonClickHandler();
button.addActionListener(bch);
this.add(button);
}
class ButtonClickHandler implements ActionListener
{
public void actionPerformed(ActionEvent arg0)
{
JOptionPane.showMessageDialog(null, "THIS IS A MESSAGE BOX");
}
}
}