Raised This Month: $ Target: $400
 0% 

Java basic programming help please... :D


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lanvo
Member
Join Date: Jul 2005
Old 08-23-2005 , 18:20   Java basic programming help please... :D
Reply With Quote #1

Okay, so here is my code:

Code:
public class Hello
{
	public static void main(String[] args)
	{
		System.out.println("Hello");
	}
}

I want to add a blue background to it... like when i have compile this code, all it does is say Hello with a boring Dos black background so now i want to change it to blue... what is the code to make the background in Dos blue?

- thx
__________________
check out my own custom map that i made surf_in-house for CS 1.6
lanvo is offline
knekter
Senior Member
Join Date: Mar 2004
Location: PA
Old 08-23-2005 , 19:31  
Reply With Quote #2

well you need to use an Applet/JApplet:

Code:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class Hello extends JApplet
{
  public void init()
  {
    Container c = getContentPane();
    c.setBackground(Color.blue);
    repaint();
  }

  public void paint(Graphics g)
  {
    super.paint(g);
    g.setColor(Color.white);
    g.drawString("Hello World!", 50, 50);
  }
}
Now you just need to make an html file to run it when its compiled:
Code:
<html>
<body>
<applet code="myprogramname.class" height=100 width=100></applet>
</body>
</html>
__________________
More updates for Matrix Mod!
knekter is offline
Send a message via AIM to knekter Send a message via MSN to knekter
lanvo
Member
Join Date: Jul 2005
Old 08-23-2005 , 19:41  
Reply With Quote #3

oh thx bro!

anyways, is there a way to make it run in msdos with a blue background? if not, can C++ do it in Dos?
__________________
check out my own custom map that i made surf_in-house for CS 1.6
lanvo is offline
Reply



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

Forum Jump


All times are GMT -4. The time now is 01:38.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode