how & where do i start?
There are many ways to do this. On possibility is shown below in pseudocode.
should i use packages?
Yes, you will need to import a few.
AWt? or SWING?
Swing is easier and more fun. The tutorial examples use Swing.
Application? or Applet???
Your choice. Applications are easy enough to start with. Some prefer applets.
how do i draw from input by clicking on buttons?
Say, for an application, you could put something like this together to get started.
public class MyClassName extends JPanel {
JTextField textField;
String text = "";
protected void paintComponent(Graphics g) {
super.paintComponent(g);
float x = whereever
float y = you prefer
g.drawString(text, x, y);
}
private JPanel getNorth() {
textField = new JTextField(numCols);
// add this to a panel and
return panel
}
private JPanel getButtonPanel() {
JButton button = new JButton("your_string");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
text = textField.getText();
repaint();
}
});
// add the button to a JPanel and
return panel;
}
public static void main(String[] args) {
MyClassName app = new MyTestApp();
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.add(app.getNorth(), BorderLayout.NORTH);
f.add(test); // default center section
f.add(test.getButtonPanel(), "South");
f.setSize(...
f.setLocation(...
f.setVisible(true);
}
}