The program must allow the user to create a login by using Dr.Java GUI. After he creates a log in it will ask the user would he like to by an Xbox360 game or a PC game. After the user clicks the box it opens a selection of 10 different games for each. The picture of the game will show up and and the price right beside it. Under it it will say BUY! If the user clicks BUY! it will say added to cart. After they finish selecting what they would like it will say check out at the bottom. Once clicked it will display the username, cost, and tax. After that it will log the user out.
I'm have an idea of how to do this but i do not know how to create the box's in java and how to upload the pictures. Can you please help. Any help with this program will be grateful or an example program thanks :)

Recommended Answers

All 9 Replies

What do you mean "create the box"? Do you mean a button that the user can click on, or do you mean the window in which your content (the pictures saying buy it) is displayed?

Look into how to create and use JFrames, JPanels, Layout Managers, JButtons, and JLabels. You can start here. Feel free to ask some questions after getting an overview. http://java.sun.com/docs/books/tutorial/uiswing/components/index.html

I checked out that link, but i tried running the codes in my java and kept giving me error. But yes, is it possible to make a box saying:
Enter your name:
Click Here to Continue

Then it opens a new box and it displays 20 different pictures with 20 different prices. And under each picture displays the price and a checkbox. Where if they check it the price gets added up together. And at the very bottom there is something saying CHECKOUT. If they click CHECKOUT they will be sent a Price what they bought and there name. Can you start me off in the track of the beginning where you enter a name and clcik the Continue button to open a new window with different selections. ??

For the first window where you click to continue, you can look into the JOptionPane class. It has a lot of different options for creating windows quickly and easily. Alternatively, you can create a custom window by using that tutorial I showed you. Look for the tutorial on using buttons , and look at the code examples they have of where they made windows with buttons on them.

But the easiest way to do it is with JOptionPane, see here: http://java.sun.com/docs/books/tutorial/uiswing/components/dialog.html
If you do a google search for JOptionPane and go to the Javadoc, you'll see all of the different ways you can create windows with it. One example is JOptionPane.showMessageDialog(null,"this is whats in the window");

can you give me the actual code for it, because i tried looking at the website that u linked but im kinda confused because it keeps saying cannot find package.

No, you're not going to find anyone here that will just "give you the code for it". It's all about showing some effort and asking specific questions if you're stuck.

Ok im starting to understand this but can you tell me how to do this. Instead of a like check circle box, how to you just allow the user to type something in? Or is that not possible. How do i eliminate the circle check box and just allow it for the user to type something in on the side. Like i have 4 tabs, and under the first one it says "Please enter first name:" And here is where i want the user to be able to type something in.

Add a JLabel to your JPanel, then add a JTextField next to it. The user can type in the JTextField. The resources I gave you were definitely sufficient to accomplish this so until you post some code, I can't help you anymore.

Ok here is something im wondering. I made it so that i allow the user to type in a text box, im wondering if its possible to insert pictures into a text box. Or do i have to remove the text box and then single input pictures along with a circle box beside each one?


JTextArea textArea = new JTextArea(
"Below is a list of what Xbox Games we have." +
" "
);
textArea.setFont(new Font("Serif", Font.BOLD, 16));
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
JScrollPane areaScrollPane = new JScrollPane(textArea);
areaScrollPane.setVerticalScrollBarPolicy(
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
areaScrollPane.setPreferredSize(new Dimension(250, 250));
areaScrollPane.setBorder(
BorderFactory.createCompoundBorder(
BorderFactory.createCompoundBorder(
BorderFactory.createTitledBorder("Xbox Games"),
BorderFactory.createEmptyBorder(5,5,5,5)),
areaScrollPane.getBorder()));

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.