Jump to content

Sniffy

Members
  • Posts

    403
  • Joined

  • Last visited

Posts posted by Sniffy

  1. Hey everyone, it is just me stopping in again to say "hi". I kind of forgot about this forum when I started getting into Java and object oriented programming in general. I am on my way to success in programming, messing with OpenGL bindings like Xith3D and JMonkey. I came across C# being able to make web applications with ASP.NET in a book that I was reading. If I look into it more, this forum just may be of some use to me once again.

  2. Also, here is another one of my past creations:aApplet.java

    import javax.swing.*;import java.awt.*;public class aApplet extends JApplet{	Container con = getContentPane();	String speech = "	Duis nec lectus. Etiam aliquet, nulla non elementum";	String speech2 = "aliquam,libero urna rhoncus eros, vel luctus";	String speech3 = "tellus urna at mauris. Sed tincidunt consequat";	String speech4 = "erat. Nulla facilisi. Cras varius. Suspendisse";	String speech5 = "posuere turpis ac sem. Phasellus vulputate";	String speech6 = "commodo lacus.\n Sed auctor. Aliquam venenatis";	String speech7 = "tellus eget dolor. Sed risus.";	public void start(){		repaint();	}    public void paint(Graphics gr){    	gr.drawRoundRect(9, 9, 301, 151, 20, 20);    	gr.setColor(Color.CYAN);    	gr.fillRoundRect(10, 10, 300, 150, 20, 20);    	gr.setColor(Color.BLACK);    	gr.drawString(speech, 20, 25);    	gr.drawString(speech2, 20, 40);    	gr.drawString(speech3, 20, 55);    	gr.drawString(speech4, 20, 70);    	gr.drawString(speech5, 20, 85);    	gr.drawString(speech6, 20, 100);    	gr.drawString(speech7, 20, 115);    	gr.fillRect(40, 140, 200, 10);    	}}

  3. Check out my latest creation.... do you like it?Instructions:Install SDK: http://java.sun.comCreate new file: ExampleJFrame.javaInsert Code:

    import javax.swing.*;import java.awt.*;import java.awt.event.*;public class ExampleJFrame{    public static void main(String[] args)    {    	JButton press = new JButton("Show");    	JButton press2 = new JButton("Hide");    	JButton press3 = new JButton("Clear");      	final JFrame frame = new JFrame("Example");                JFrame frame2 = new JFrame("Menu");      	frame.setSize(200, 200);      	frame.setResizable(false);      	frame.getContentPane().setLayout(new FlowLayout());      	frame.show();      	      	frame2.setLocation(200, 0);      	frame2.setResizable(false);      	frame2.addWindowListener(new WindowAdapter(){      		public void windowClosing(WindowEvent e)      		{      			System.exit(0);      		}      		});      	frame2.setSize(200, 200);      	frame2.getContentPane().setLayout(new FlowLayout());      	frame2.getContentPane().add(press);      	frame2.getContentPane().add(press2);      	frame2.getContentPane().add(press3);      	frame2.show();      	press.addActionListener(new ActionListener()      	{      		public void actionPerformed(ActionEvent e)      		{    				frame.setVisible(true);    		}      	});      	press2.addActionListener(new ActionListener()      	{      		public void actionPerformed(ActionEvent e)      		{    				frame.setVisible(false);    				frame.getContentPane().add(new JLabel("" + frame.getLocation()));    		}      	});      	press3.addActionListener(new ActionListener()      	{      		public void actionPerformed(ActionEvent e)      		{      			frame.setVisible(false);    			frame.getContentPane().removeAll();    			frame.setVisible(true);    		}      	});    }    }

    Command Prompt: OpenType commands:javac ExampleJFrame.javajava ExampleJFrame.javaWhat do you think?What it does:Use the "Menu" frame to either "Show", "Hide", or "Clear" the JFrame "frame2" of content. Content is added each time "frame2" is shown. It displays its current location (x,y) on the screen with the java.awt.Point class.somethings wrong with my PC so i can't supply a preview at the moment

  4. Yes, that's what i'm aiming for, a chat program when I complete basic and intermediate courses.StringBuffer[] msg = new StringBuffer[30]; for(int x = 0; x < msg.length; x++) msg[x] = new StringBuffer("");

  5. Hello, I've been working on an applet that is supposed to be a "Catch the Clown" style game. When the user clicks on the button, a new random location is set and the score is incremented. Anyways, I can't get the setLocation() method to work for my JButton, any help?It might have something to do with the FlowLayout object because FlowLayout sorts Components in rows, but I don't know what other alternatives I can use. I just need to get to know JComponents and JApplets (methods) more so help would be appreciated.

    /** * @(#)appletGame.java * * * @author  * @version 1.00 2007/3/3 */import java.awt.*;import java.awt.event.*;import javax.swing.*;public class appletGame extends JApplet implements ActionListener {	Container con = getContentPane();	JButton press = new JButton("Press");	int score = 0;	JLabel dispScore = new JLabel("Score:" + score);		public void init()	{		con.add(dispScore);		con.add(press);		press.setLocation(10, 10);		press.setLocation(100, 100);		press.addActionListener(this);		con.setLayout(new FlowLayout());	}	public void actionPerformed(ActionEvent e)	{		int locationX = (int) Math.round(Math.random()*300);		int locationY = (int) Math.round(Math.random()*300);		score++;		dispScore.setText("Score: " + score);		press.setLocation(locationX, locationY);			}		}

  6. Hey folks!My name's Anders and I'm a webdesigner/developer! Why else would I be here?I know - HTML (3 years) - XHTML (1 year) - CSS (2 years) - JavaScript (3 years) - PHP (2 months) - MySQL (2 months)I'm 15 years old and I turn 16 this year :)I've learned a lot at W3Schools, and you're the best :)And better, Hege and Kai Jim (don't remember more right now), well, we're all from Norway :blink:Do I have to write more about my self? Well, if I gotta, tell me :)
    Whoa, You've been into Web-Design for quite a while. I've only been into web-design for just over a year now.
  7. I mean I bring the picture that I scanned into a program like Flash, then select say.. the brush tool. Then I take the brush tool zoom into the layer, make a new layer, then trace the drawing with the brush tool that I scanned.

×
×
  • Create New...