Page 1 of 2 12 LastLast
Results 1 to 20 of 30
  1. #1
    EBBOOO is offline Member
    Join Date
    Jun 2010
    Posts
    42
    Rep Power
    0

    Default need an advise please

    hi all

    my teacher asked me to write a program about any thing,, and i have no idea what to write about, so if you through some ideas to me, i'll be grateful :)

    by the way, i'm a beginner
    and the deadline is Wednesday, so i want to do a small one.

  2. #2
    berkeleybross's Avatar
    berkeleybross is offline Senior Member
    Join Date
    Feb 2010
    Location
    England
    Posts
    187
    Rep Power
    5

    Default

    How about tic-tac-toe?

    Its the first program I wrote in java.

  3. #3
    EBBOOO is offline Member
    Join Date
    Jun 2010
    Posts
    42
    Rep Power
    0

    Default

    i was looking about it but i found some complex code :(
    do you have a simple one???

  4. #4
    Zack's Avatar
    Zack is offline Senior Member
    Join Date
    Jun 2010
    Location
    Destiny Islands
    Posts
    692
    Rep Power
    5

    Default

    It's hard to say without knowing exactly what the content of your course is, and how complex the teacher expects it to be. If you want to go simple but a little challenging, you could try making a text-based tic-tac-toe game. If you need something even simpler, maybe a simple calculator. If you want something more complex, you could try making a simple calendar (appointment scheduler of some kind), or even go into GUIs (maybe UI-based tic-tac-toe).

    PS: berkeleybross beat me to the tic-tac-toe idea. :(

  5. #5
    EBBOOO is offline Member
    Join Date
    Jun 2010
    Posts
    42
    Rep Power
    0

    Default

    you are right zack i should explain more
    ok, we did the simple calculator in class so i can't do that, and one of the students did a scientific one, so i can't do that either. i think my teacher like any thing with graphics, and i'm pretty sure he wants me to use swing much.

  6. #6
    Zack's Avatar
    Zack is offline Senior Member
    Join Date
    Jun 2010
    Location
    Destiny Islands
    Posts
    692
    Rep Power
    5

    Default

    A simple GUI program that also uses file in/out is a basic Notepad. If you wanted to get fancy, you could allow the user to change the font face/size of the window (just like in Windows Notepad).

  7. #7
    berkeleybross's Avatar
    berkeleybross is offline Senior Member
    Join Date
    Feb 2010
    Location
    England
    Posts
    187
    Rep Power
    5

    Default

    Sorry, I'm not handing over any source code if thats what your asking.
    I will, however, help you correct any source code you write or point you in the write direction.

    Doing a swing tic-tac-toe would be fairly easy.
    Simply make a JPanel for each square and use GridBagConstraints to position them in a frame.

    Each panel should have a JLabel in it which will contain the players piece.

    You can then add a mouse listener to each JPanel and change the value of its JLabel.

    From there, its mostly the logic behind the game, checking for winning moves etc.

    @zack: hehe You got ninja'd ;P

    Berkeleybross

  8. #8
    EBBOOO is offline Member
    Join Date
    Jun 2010
    Posts
    42
    Rep Power
    0

    Default

    thank you guys for your help, i prefer the basic notepad but it looks difficult to me.
    i have some questions, what should i use to get the inputs from the user?? text area??? or is there any thing else??

  9. #9
    Zack's Avatar
    Zack is offline Senior Member
    Join Date
    Jun 2010
    Location
    Destiny Islands
    Posts
    692
    Rep Power
    5

    Default

    Frankly any project with a GUI does get a little challenging; but if you always do easy stuff you will never progress in the language.

    Honestly, you could go with the tic-tac-toe pretty easily as berkeley told you exactly how to do it (except the game logic itself; but we can help you there as well).

    As for the notepad, I don't do a lot of Swing myself (I do mostly Applets), but you're probably best off with TextField: How to Use Text Fields (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Swing Components)
    Of course, as is standard, anyone feel free to correct me here. ;)

  10. #10
    j2me64's Avatar
    j2me64 is offline Senior Member
    Join Date
    Sep 2009
    Location
    Zurich, Switzerland
    Posts
    962
    Rep Power
    5

    Default

    look here, these lessons are for total beginners and during the lessons you will implement a library where you can store books and persons, who has borrow the book.

  11. #11
    EBBOOO is offline Member
    Join Date
    Jun 2010
    Posts
    42
    Rep Power
    0

    Default

    thanks j2, i already did this ;)

  12. #12
    berkeleybross's Avatar
    berkeleybross is offline Senior Member
    Join Date
    Feb 2010
    Location
    England
    Posts
    187
    Rep Power
    5

    Default

    My way sounds more difficult but i believe it will actually be easier.

    If you use a JTextArea you'll run into a whole load of difficulties - documents, parsing etc
    Using a JTextField will be easier than a JTextArea but will be just as difficult as my way. And I think it wont look as good... :P

    Up to you, Ill try and help either way.
    Although I would go with JLabels inside JPanels.
    You can then make different coloured backgrounds for your squares :)

    berkeleybross

  13. #13
    EBBOOO is offline Member
    Join Date
    Jun 2010
    Posts
    42
    Rep Power
    0

    Default

    i think JTextField is only to get single line???

  14. #14
    berkeleybross's Avatar
    berkeleybross is offline Senior Member
    Join Date
    Feb 2010
    Location
    England
    Posts
    187
    Rep Power
    5

    Default

    Yup, but you could have a 3*3 grid of them, one for each square.

    berkeleybross

  15. #15
    EBBOOO is offline Member
    Join Date
    Jun 2010
    Posts
    42
    Rep Power
    0

    Default

    sorry, could you please explain this a little bit more??

    EBBOOO

  16. #16
    berkeleybross's Avatar
    berkeleybross is offline Senior Member
    Join Date
    Feb 2010
    Location
    England
    Posts
    187
    Rep Power
    5

    Default

    Well, you could make nine JTextFields, and arrange them in a grid
    Java Code:
    - - -
    - - -
    - - -
    Each TextField will only take one character, '-', 'X' or 'O'.
    The user will have to select a TextField and then type in there character. However, you will have to parse the input to make sure it is only one character long, and that it is the users character.

    Alternatively, you could have exactly the same layout, except using JLabels.
    When a user clicks on a square, then the label will automatically change to their character.

    Not sure if i can make it clearer than that :S

    Or did i miss the point of your question?

    Berkeleybross

  17. #17
    EBBOOO is offline Member
    Join Date
    Jun 2010
    Posts
    42
    Rep Power
    0

    Default

    actually i was talking about the notpad

  18. #18
    EBBOOO is offline Member
    Join Date
    Jun 2010
    Posts
    42
    Rep Power
    0

    Default

    i found something call JTextPane,, is that what i need?

  19. #19
    berkeleybross's Avatar
    berkeleybross is offline Senior Member
    Join Date
    Feb 2010
    Location
    England
    Posts
    187
    Rep Power
    5

    Default

    You could use that but id stick with JTextArea.
    It only allows one font, but its much easier to use.

    You'll also want a JMenuBar with JMenuItems.

  20. #20
    EBBOOO is offline Member
    Join Date
    Jun 2010
    Posts
    42
    Rep Power
    0

    Default

    what if i want to choose the font what should i use???
    sorry too many questions :S

Page 1 of 2 12 LastLast

Similar Threads

  1. Need advise for choosing book
    By Teodor__b in forum New To Java
    Replies: 2
    Last Post: 02-19-2010, 01:13 PM
  2. Some advise please!!!
    By PVL268 in forum New To Java
    Replies: 2
    Last Post: 04-17-2009, 09:36 AM
  3. need advise...
    By chkm8 in forum AWT / Swing
    Replies: 4
    Last Post: 02-10-2009, 05:57 AM
  4. advise on designing an ejb application
    By bobD in forum New To Java
    Replies: 0
    Last Post: 09-03-2008, 09:04 AM
  5. give me a advise
    By sireesha in forum New To Java
    Replies: 3
    Last Post: 12-11-2007, 01:38 AM

Posting Permissions

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