Saturday, 11 May 2013

Finallies :D

HELLO AGAIN!

I shouldn't get too excited since I haven't done a whole lot, but I redid the code and it went by really quickly. So here's the updated picture of what the board looks like. And in the for loop, I've added everything to the mouseListener so it doesn't have to be done manually! 



Thursday, 9 May 2013

And he does his thing again ;P

Ryk gave me another way to program the thing, so I'm going to change around my code again to accommodate that, cause it's a lot more efficient. 

Basically, what his way, to do it was: 

Use a class to extend all the JLabels. 

To print all the for loops to the screen, name all the properties in order and a counter at the same number. Therefore, you can use a loop to create the labels (in an array), and do it individually for north, east, south and west. 

He also said that it 'twas possible to do it for both east and west at the same time but I was too confuzzled..

Properties :)

So here is the official gameboard on paper and it makes it a lot easier to program :) 

Hurray! :D

So I've finally finished the game board set up. I'm going to have to program the layeredPane part, so that when the pawns move, the user can see their pawns. But for now, at least, it's amazing


Now, I'm going to have to add all these labels into the class declaration where when the user clicks the properties, a frame will show up with the more massive pictures. 

And I formatted it much better, so here is the official gameboard: 


Tuesday, 7 May 2013

Size...

Okay, this is getting so irritating. I've made my labels this size: 

And it's still not small enough for the whole board to come together. 

so the size STILL has to be decreased significantly to fit 10 down the side -_-

Monday, 6 May 2013


Okay...um..that is my game board so far. You can tell that the east and west are going to be pretty massive..O-o

Although when I started adding the west and east fields, they didn't fit even though I included a JScrollBar: 

So I dunno how to make it fit :( 

Okay..official pics. Not changing them anymore!

So here are the official pieces of the game! :D































Never Mind...

Oops..

I just dissected the entire reading of "How to use JLayered Panes"...


  1. Swing Container with 2 depths
  2. Adding components to LayeredPanes  - specify depth as an integer.
  3. Higher number is something that's closer to the top. 
  4. Component Overlap: Closer Components have a larger depth than Farther Components. 
  5. 2 Layered Panes
    1. JLayered Panes
    2. JDesktop Panes
  6. No Argument Constructor
  7. Adding Components and Setting the Depth 
    1. createColoredLabel
      1. Opaque 
      2. Background Colour
      3. Border
      4. Text
      5. Size
    2. add 
      1. component to add
      2. integer object - specifying depth
        1. actual values don't matter. they are all relative values to the depth. 
    3. depth
      1. components at higher depth are on top of the ones with a lower depth 
      2. setLayer method (component, new depth, position within depth) 
      3. setLayer method (component, new depth)
  8. Setting Component Position Within Depth 
    1. Use Integer
    2. setLayer - int
    3. add (component, Integer, position within depth) 
      1. Determine Componential Relationship
    4. Position between -1 and (n-1) means the number of components at that depth. 
      1. The smaller the position number, the higher the component
    5. Using -1 is the same as (n-1) and it means the bottommost position
    6. Using 0 means the topmost position within the depth
  9. Layout Components
    1. Default: No layout manager
    2. setBounds (size, position) 
    3. Possible to assign layouts (like borderLayout or gridLayout)
I think it makes much more sense. 

So perhaps in that case, I'll make the gamePieces a depth of 1; and the pawns a depth of 3. 

Layered Panes...

I was looking up JLayeredPanes on the JAVA API's and it says that it doesn't have it's own layout..but then it says that you can use a gridLayout so it all doesn't make any bloody sense!

ECK! -_-


And each of my components is 195, 295. 


The examples are as confusing as heck and they, don't make any sense! >_< 


And to make it worse than it is, the Java API says that the bottom most layer is referred to as the DEFAULT_LAYER; the second one the PALETTE_LAYER; the third one, the MODAL_LAYER; the fourth, the POPUP_LAYER, and the last, the DRAG_LAYER but the example on the Java Tutorials don't have any of those words! SO HOW ON EARTH DO YOU CREATE PANEL THAT GOES ON THE TOP? UGGH! 

Sunday, 5 May 2013

Error...

I've run into an error for the program in programming the game board. 

I have this part in my program: 


    private void game()
    { 
        if (tracing) System.out.println("Inside the game method. ");
        JFrame frame =  new JFrame("Monopoly");
        
            frame.addWindowListener
                        (new WindowAdapter()
                          {
                            public void windowClosing(WindowEvent e)
                            {
                              System.exit(0);
                            }
                          }
                        );        
        
        JPanel mainPanel = new JPanel(new BorderLayout());
        
        JPanel northPanel = new JPanel(new GridLayout(0, 10));
        
        
            //JLabel myImageLabel = new JLabel(new ImageIcon(“d.jpg”));
            
            if (tracing) System.out.println("Creating the JLabel");
            JLabel borginBurkes = new JLabel(new ImageIcon("Borgin and Burkes.png"));
            if (tracing) System.out.println("Created the JLabel");
            
            //JLabel pay = new JLabel(new ImageIcon("Camelot's Annual Tax.png"));
            
            //borginBurkes.setBounds(0, 0, 0, 0);
            //pay.setBounds(0, 0, 0, 0);
            
            if (tracing) System.out.println("Adding Borgin and Burkes to the northPanel currently.");
        
        northPanel.add(borginBurkes);
        //northPanel.add(pay);
        
        if (tracing) System.out.println("Adding the northPanel to the mainPanel. ");
        
        mainPanel.add(northPanel, BorderLayout.NORTH);
        
        frame.setContentPane(mainPanel);
        frame.setSize(800, 800); 
        //frame.setAlwaysOnTop(true);
        frame.setVisible(true);
    }//end of game method

But it's not working considering the that when I run the program, nothing displays on the screen. Oh. Now it's working. I couldn't put it in the folder "pics" in the program. I had to put them all in the main area. 

Although I have to make my screen wider...I mean look at this: 



Can't read anything from that! I think I'll make it 500 by 1500 or so. I hope there's enough room! :o 

Hmm, looks like there isn't. Well, this sort of sucks! I'm going to have to shorten all the names, it looks like: 

OOOKAY. I'll have to go back to all my properties and shorten the names. But it's not possible to shorten something like, I'M GOING ON AN ADVENTURE! ECK! :/ The maximum length for these is 145 or so. Okay..this is going to be hard -_- I have to decrease all the sizes to about 145*275 rather than 275*275. 

I found a size that's going to fit, but it's a bit challenging to make them all the same size. These are going to be the official sizes: 




  1. Borgin & Burkes might make a difference rather than Borgin and Burkes. i'll post the other ones later on... :/