Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (541)
Games in Android Showcase (133)
games submitted by our members
Games in WIP (603)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Newbie & Debugging Questions / JOptionPane writing to file? on: 2011-05-14 00:31:53
Seems like i've been getting stumped everywhere lately Sad and most things i can find throughout my book but some i cannot like so:

I'm trying to have a JOptionPane showinputdialogue show and when i enter a string like "hello" it'll write to hello.txt and  find a certain line and write to that line hello.txt and i can also type "awesome" and it'll write to that one on the same line that i had for hello.txt but no success so far. writing to files/strings are my biggest problem i can not overcome yet and they stump me everytime.

So in psuedocode i'm trying to make it do this:
1  
2  
3  
4  
5  
6  
If button clicked
open JOptionPane.showinputpane
type file name without extension
locate file with extension .txt
change "hi=1" in file to "hi=2"
close JOptionPane



If someone can kinda explain what to do or a link/tutorial/book something that'll solve me fear of strings and file/disk writing, it'd be greatly appreciated.
2  Game Development / Newbie & Debugging Questions / Re: How to make a button close a GUI? on: 2011-05-13 04:45:46
Wow, thank you very much.

Currently going to use cardLayout as it seems it'll be better to use then setVisible for what i'm planning on doing.
3  Game Development / Newbie & Debugging Questions / How to make a button close a GUI? on: 2011-05-13 04:19:43
Anyways i have yet to figure this out but i'm trying to make a GUI that'll allow login and such.

Anyways here is methods
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
private void initialize() {
      frame = new JFrame();
      container = frame.getContentPane();
      container.setLayout(new FlowLayout());
      idLabel = new JLabel("Id:");
      id = new JTextField("", 12);
      passwordLabel = new JLabel("Password:");
      password = new JPasswordField(8);
      password.setEchoChar('*');
      button2 = new JButton("Log in");
      container.add(idLabel);
      container.add(id);
      container.add(passwordLabel);
      container.add(password);
      container.add(button2);
      //container.add(legal, BorderLayout.CENTER);
      frame.setSize( 250,200 );
      frame.setVisible( true );
      frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
      button2.addActionListener(new java.awt.event.ActionListener() {
         public void actionPerformed(java.awt.event.ActionEvent ae) {
            if (ae.getSource() == button
                  && id.getText().equals("1")
                  && (new String(password.getPassword()))
                  .equals("2"))
            container.remove(idLabel);
            container.remove(id);
            container.remove(passwordLabel);
            container.remove(password);
            container.remove(button2);
            secondScreen();
            frame.setSize(300, 300);
         }
      });
   }

   
   public void secondScreen() {
      //frame = new JFrame();
      //container.add(text);
      //layout = new FlowLayout();
      container.remove(idLabel);
      container.remove(id);
      container.remove(passwordLabel);
      container.remove(password);
      container.remove(button2);
      frame.setSize(300, 300);
      frame.setTitle("second screen");
      container = frame.getContentPane();
      JContentPane = new JPanel();
      JContentPane.setLayout(new BorderLayout());
      frame.setResizable(false);
      frame.pack();
      area = new JTextArea();
      area.setEditable(false);
      text = new JTextField("testing");
      frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
      frame.setVisible(true);
      button = new JButton("testing");
      button4 = new JButton("testing");
      button3 = new JButton("testing");
      container.add(button, BorderLayout.SOUTH);
      container.add(button3, BorderLayout.EAST);  
      container.add(button4, BorderLayout.WEST);
      container.add(area, BorderLayout.SOUTH);
      button.addActionListener(new java.awt.event.ActionListener() {
         public void actionPerformed(java.awt.event.ActionEvent ae) {
            if ( ae.getSource( ) == button )
               sendMessage("Opening webpage.");
               openWebpage();                    
         }
      });
     
   }  


yes, it's really "nooby" as i'm still learning but what i want to do is once you hit the button "login" it'll close that JFrame and secondScreen(); will open a new one with a different layout, or can someone tell me how to make it switch from a FlowLayout to a BorderLayout without causing any nullpointerexceptions.

None of my books have anything related to my problem and i don't know what to do exactly. Help is VERY appreciated.
4  Game Development / Newbie & Debugging Questions / Re: Java based books. on: 2011-04-30 22:39:13
Anyways i took a look at both those book but it seems to me that they require a decent/minimal sized knowledge base on java already which is something i still lack and am willing to get better by the end of the summer (planning on studying most of this summer for java and C++) and am not looking to buy those books atm but i have bookmarked them for the time being, i am mostly looking for books that understand the API (i'll taken my time to look through the api and have remembered quite a few methods already but still looking to expand on that greatly) and will give me a way better understanding of programming in java.
5  Game Development / Newbie & Debugging Questions / Java based books. on: 2011-04-30 09:01:38
Recently have started on my journey of learning java, a bit of C++, and a few other basic languages in a 2 year period (during my time for the rest of my senior year and my junior college year/years) and decided that if i am going to apply to media arts schools it'd be best to have a pretty good amount of information already built up.

I recently got my first java related book, Java for dummies 2nd edition which is a few years outdated (still in the 1.5 SDK days) and have seen a quite of few others (i have 10 books bookmarked currently) and are looking to purchase quite a few of these books and start making a game during my junior college days (my school isn't an acredited school so i must attend junior college first before applying to a university) and have notice many of these books have supposedly some topics covered and other books don't have these topics but a different one which the last book didn't have.

My question is, what books should i be purchasing, In what order should i be starting to read them? Java for dummies 2nd edition, which i'll read 3 times before going on to the next book, has given me a very good insight of what things are and how they work and i would like to then go to the next step and so forth the one after that (i will read a book 3 times before i move onto the next one)
6  Game Development / Newbie & Debugging Questions / Re: New to the "java-gaming" scene and would look a few insights. on: 2011-04-24 13:25:12
Thanks for all the positive feedback and such Smiley

Anyways looking to purchase quite a few books while i attend class from 8:30 to 11:30 i'll be sure to be reading up on java Smiley
7  Game Development / Newbie & Debugging Questions / Re: New to the "java-gaming" scene and would look a few insights. on: 2011-04-22 05:53:12
Thanks for the posts guys, just purchased "java for dummies" hoping to get a way better understanding of it all. and MYSQL will most likely be used for the data saving and such.
8  Game Development / Game Play & Game Design / My game design- how about would i make a tile also an object? on: 2011-04-21 07:33:20
First off my game is going to be based for "female" type users as it was given to me by quite a few girls requesting such a game.

On facebook they have farmville. Not all girls like making a farm but instead gardens. I have never personally played farmville but i have tried "potfarm" which i believe to be somewhat similar. My game is most appealing to people who like gardens such as growing flowers (many many assortments) having a nice "backyard" as i'd like to call it and being able to move/create objects that are built in game for them to create such as a gaziboe so it'll make the users garden look nice and have it's own atmosphere compared to others.

I am looking to create a game with over 100 different types of plants you can grow (not vegetables and thing like farmville) ability to visit other "players/friends" gardens to compare and "hang out". In shorter terms potfarm meets farmville has a child and my game is born. It will not be based around marijuana nor growing crops of corn or whatever you do exactly.

Anyways here's sort of a "picture" of what i'm exactly looking to do



the white "squares" represent a tile that can be walked on currently where as the red "circle" is a tile being occupied by a flower/plant/object such as a gizoboe. i'm trying to make it where if you use a "seed" on designated tile you'll walk to the said tile perform an action/animation, plant seed causing sort of a bulg/sprout of a plant to appear and making it able to still be walked on while the plant is growing. What i'm trying to get at if you don't exactly understand is how would i go about making the tile act as an object and have the ability to plant an "item/seed" in that location.or create a "world map" and have each tile act as a coordinate starting at like (0,0) and (0,1) and such.
9  Game Development / Newbie & Debugging Questions / New to the "java-gaming" scene and would look a few insights. on: 2011-04-21 04:22:16
Anyways a few years ago when I was 14 I had dabbled a little bit into "java" programming mostly around the game based "runescape" and had found it quite interesting making things do what I wanted and being able to use my imagination to do things that appealed to me.

I haven't done it in a few years but have recently started watching,reading, and gathering information on certain points of java that stump me (and ALOT does) but I have been thinking about going to a media arts school/graphics and design and start learning the ways of technology.

Currently after just watching a 4 hour video I had downloaded for "Beginner" programmers I had learned quite alot and i'd still like to expand on that knowledge and be able to get a headstart to the game designing career as early as possible (I am currently 17)

I have tried/looked into using other "languages" of building a game off of such as python,c++,flashscript, and java of which was my favorite. C++ was a more "advance" coding/programming language which by the means required a group of developers to get a really great game going where as I noticed an independent person can base a very good game from java and make it a success and if they felt like it they can expand and work with other developers.

Anyways currently what i'm looking to do is to be able to create a "client" for web-based applications on sites such as facebook. A popular game such as "farmville" is what i'd like to create a reflection client (of which i believe it is) and have the game be played through an application that can be downloaded onto your desktop and ran for quicker access. An example of such thing is "swiftkit" which is a client/browser that had directed linked/went to runescape and there you can play their game which is a web-client. I know that this will require VB.net and java to do such a thing and i may be over my head but i'd like to learn and or be pointed in the right direction from the pros to where i should start, wether it be basic game programming for practice/knowledge/understanding of java moreor whatever you believe i should be starting. The client idea is a main goal of mine and i'd also like to be able to get to such a point to where i can have a spot for an application i built/programmer to be placed on popular sites.
Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Mr.CodeIt (24 views)
2014-12-23 03:34:11

rwatson462 (55 views)
2014-12-15 09:26:44

Mr.CodeIt (46 views)
2014-12-14 19:50:38

BurntPizza (91 views)
2014-12-09 22:41:13

BurntPizza (113 views)
2014-12-08 04:46:31

JscottyBieshaar (83 views)
2014-12-05 12:39:02

SHC (92 views)
2014-12-03 16:27:13

CopyableCougar4 (101 views)
2014-11-29 21:32:03

toopeicgaming1999 (160 views)
2014-11-26 15:22:04

toopeicgaming1999 (164 views)
2014-11-26 15:20:36
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!