Compiles just fine and runs. Shortened it down to just the one button. I'd like to know 2 things. Am I on the right track so far. And how do I start drawing? I am stumped as where to go from here. I haven't been one to be able to learn off the, what ever you call those books or wiki links that tell you what every option does (really early in the morning and my brain may give out on me
) I have always been a learn by example person. So I have been spending a lot of time on YouTube looking at tutorials but I can't figure out where to go from here.
I am trying to convert my Web Applet into a runnable application. Starting from scratch no reused code from my web applet.
import java.awt.event.*;
import javax.swing.*;
import java.awt.*;
public class SprCre3XP
{
public static void CreateGUI()
{
//Create JFrame
JFrame frame = new JFrame("Sprite Creator 3");
frame.setSize(800, 508);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Create Menu Bar
JMenuBar menubar = new JMenuBar();
//Add Menu Bar to Frame
frame.setJMenuBar(menubar);
//Create Menu
JMenu file = new JMenu("File");
JMenu help = new JMenu("Help");
//Add Menus to Menu Bar
menubar.add(file);
menubar.add(help);
//Create Menu Items with ActionListener()
JMenuItem saveimg = new JMenuItem("Save");
saveimg.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
}
});
file.add(saveimg);
JMenuItem exit = new JMenuItem("Exit");
exit.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
System.exit(0);
}
});
JMenuItem about = new JMenuItem("About");
about.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
}
});
//Add Menu items to Menu
file.add(exit);
help.add(about);
//Create a JLabel??
//Create JPanel and color it white
JPanel panel = new JPanel();
panel.setBackground(Color.white);
//I like placing items where I want thank you layout not needed. Waste of programming too.
panel.setLayout(null);
JLabel label = new JLabel(); //Not sure what JLabel does here
panel.add(label); //But lets add it anyways lol
//Lets add buttons each with their own ActionListener
JButton MaleB = new JButton("Male");
MaleB.setBounds(10, 125, 90, 20);
MaleB.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
//System.out.print("Pressed");//works
}
});
panel.add(MaleB);
//add the JPanel panel to the JFrame frame and setVisible
frame.getContentPane().add(panel);
//frame.pack(); //Why you make window so small? guessing that is what pack is?
frame.setVisible(true);
}
public static void main (String[] args)
{
//Creates the GUI Obviously
CreateGUI();
}
//Where to go from here?
}






