Go Back   SitePoint Forums > Forum Index > Program Your Site > Java and JSP
Newsletter FAQ Members List Calendar Mark Forums Read

New to SitePoint Forums? Register here for free!

SitePoint Sponsor
 
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old Nov 11, 2008, 10:36   #1
RyanReese
CSS Consultant/Ninja-I'm fast
SitePoint Award Recipient
 
RyanReese's Avatar
 
Join Date: Oct 2008
Location: Whiteford, MD
Posts: 10,083
HTML in Java

java Code:
//Ryan Reese
//ACSLLAND / Candyland game
//Started November 11th, 2008
//Pretty sweet freaking program right here
 
import java.util.Random;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
 
public class ACSLLAND
{
    public static String player1="John";
    public static String player2="Bobby";
    public static String player3="Joseph";
   
    public static void main(String args[])
    {
        //Creates constructors so I can roll/call methods on board
        Random generator=new Random();
        ACSLLAND board=new ACSLLAND();
        JFrame frame1 = new JFrame();
       
        //Creates an array so that I don't have to declare 31 variables =]
        int[] cells= new int[29];
        //Oh yea, now it loops to fill up all the variables
        for (int i=0; i < 29; i++)
        {
            cells[i] = i+1;
        }
        //Gotta manually declare these variables because they need seperate names D;
        int START;
        int END;
        //Declare HTML String and rolling
        String htmlString="<html><head><style type=\"text/css\">.holder{color:#000;padding-top:24px;padding-left:16px;margin-right:3px;background:#FFF;height:60px;width:60px;float:left;}.second{color:#000;padding-top:24px;padding-left:16px;margin-right:3px;background:#FFF;height:60px;width:60px;float:right;}</style></head><body style=\"width:455px;background:#000;\"><div class=\"holder\">START</div><div class=\"second\">Space1</div></body></html";
        int roll=generator.nextInt(8)+1;
       
        frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JLabel frame2 = new JLabel(htmlString, JLabel.LEFT);
        frame1.getContentPane().add(frame2);
      frame1.setSize(600, 600);
        frame1.setTitle("ACSLLAND Game Board");
      frame1.setVisible(true);
       
        board.boardMovement(roll);
    }
    public int boardMovement(int roll)
    {
        return roll;
    }
}

I'm making a little game for AP Computer Science...not much to it so far because I'm trying to create the board using JLabel and HTML.

Basically, floats aren't working. Absolute positioning isn't working. Quite frankly I'm gonna be freaking pissed if Java doesn't support that crap because quite frankly I don't know another way that could possibly work if they aren't supported.

WHY ISN'T THE HTML WORKING!!!
RyanReese is offline   Reply With Quote
 

Bookmarks

« Previous Thread | Next Thread »

Thread Tools
Display Modes

 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Sponsored Links
 
Forum Jump


All times are GMT -7. The time now is 01:40.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright 1998-2009, SitePoint Pty Ltd. All Rights Reserved