Results 1 to 7 of 7

Thread: Java Projects

  1. #1
    knightwriter is offline Member
    Join Date
    Nov 2011
    Posts
    49
    Rep Power
    0

    Default Java Projects

    I am working on a visual basic game where I have text and pictures with buttons to click on options. I decided to start doing this in Java as well, but ran into a problem of not being able to add images. I've spent almost twelve hours total trying to overcome this, with no avail. So I'm thinking that visual basic must be a lot easier to make games and visual oriented programs. So what is Java good at? I understand that Java does a lot under the hood with a lot of different machines.

    Since I am stuck with creating a text based rpg in Java, I was wondering about making some other program such as a business application. However I'm having trouble coming up with any ideas.

    Does anyone have a good idea for a Java project for beginners that would use Java as intended, instead of doing something such as programming a hangman game?

  2. #2
    maxx is offline Member
    Join Date
    Jan 2012
    Posts
    3
    Rep Power
    0

    Default Re: Java Projects

    try a catalog of products with prices , ofers and staff

  3. #3
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    6

    Default Re: Java Projects

    It really isn't hard to work with images in java. You can load images with ImageIO, you can display them with JFrames and Panels, and there is built in support for manipulation and multiple formats. You spent 12 hours trying to get an image to display on the screen?

    Java Code:
    import javax.imageio.ImageIO;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.image.BufferedImage;
    import java.io.File;
    import java.io.IOException;
    
    public class ImageShower{
        public static void main(String[] args){
            new ImageShower();
        }
    
        public BufferedImage img;
    
        public ImageShower(){
            try {
                img = ImageIO.read(new File("McChris.png"));
            } catch (IOException e) {
                e.printStackTrace();
            }
            JFrame window = new JFrame();
            window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            MyPanel myPanel = new MyPanel();
            myPanel.setPreferredSize(new Dimension(img.getWidth(), img.getHeight()));
            window.add(myPanel);
            window.pack();
            window.setVisible(true);
        }
    
        class MyPanel extends JPanel{
            public void paintComponent(Graphics g){
                super.paintComponent(g);
                g.drawImage(img, 0, 0, null);
            }
        }
    }

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Java Projects

    Quote Originally Posted by maxx View Post
    try a catalog of products with prices , ofers and staff
    Cute. You still have to do your own homework, cowboy.

  5. #5
    knightwriter is offline Member
    Join Date
    Nov 2011
    Posts
    49
    Rep Power
    0

    Default Re: Java Projects

    quad64bit...thanks for the help. I will try that code out tomorrow. Yes, I spent twelve hours over the course of two days trying to figure this out. I'm new to Java and all the tutorials and google searches really didn't help me out. I hope this does the trick.
    Thanks again!!!

  6. #6
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    6

    Default Re: Java Projects

    No problem, I can give you a lot more if you're more specific. You can do animations and all kinds of cool stuff!

  7. #7
    adjit is offline Senior Member
    Join Date
    Mar 2011
    Posts
    171
    Rep Power
    0

    Default Re: Java Projects

    also, try taking a look at the Head-First book series. quite helpful for new comers to Java

Similar Threads

  1. Java Projects
    By yiweiang in forum New To Java
    Replies: 2
    Last Post: 12-15-2011, 01:28 AM
  2. Projects in Java
    By Gousia in forum Threads and Synchronization
    Replies: 18
    Last Post: 04-21-2011, 11:58 AM
  3. Java projects
    By srishti in forum Java Software
    Replies: 4
    Last Post: 10-04-2009, 09:02 AM
  4. Replies: 2
    Last Post: 04-03-2009, 03:03 PM
  5. Java Projects
    By Zeke886 in forum New To Java
    Replies: 0
    Last Post: 11-14-2007, 08:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •