Welcome, Guest
You have to register before you can post on our site.

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 2,804
» Latest member: msontop6722
» Forum threads: 856
» Forum posts: 3,643

Full Statistics

Online Users
There are currently 3 online users.
» 0 Member(s) | 1 Guest(s)
Bing, Google

Latest Threads
Looking for Adventure? Fi...
Forum: Random Discussion
Last Post: iHOMEz
11-16-2024, 09:18 PM
» Replies: 0
» Views: 495
Prettys Womans in your to...
Forum: Random Discussion
Last Post: iHOMEz
10-30-2024, 07:45 AM
» Replies: 0
» Views: 783
Prettys Womans in your ci...
Forum: Random Discussion
Last Post: iHOMEz
10-26-2024, 10:50 AM
» Replies: 0
» Views: 810
Beautiful Womans from you...
Forum: Random Discussion
Last Post: iHOMEz
10-19-2024, 02:48 PM
» Replies: 0
» Views: 911
Prettys Womans in your ci...
Forum: Random Discussion
Last Post: iHOMEz
10-06-2024, 05:00 PM
» Replies: 0
» Views: 1,069
Womans from your city - V...
Forum: Random Discussion
Last Post: iHOMEz
07-28-2024, 10:26 AM
» Replies: 0
» Views: 1,443
Supreme Сasual Dating - A...
Forum: Random Discussion
Last Post: iHOMEz
06-14-2024, 11:28 AM
» Replies: 0
» Views: 1,864
Beautiful Womans in your ...
Forum: VB.NET
Last Post: iHOMEz
06-09-2024, 09:23 PM
» Replies: 0
» Views: 1,681
Hangman in Rust
Forum: Other
Last Post: brandonio21
02-04-2018, 11:14 AM
» Replies: 2
» Views: 20,683
How to: Search files from...
Forum: VB.NET
Last Post: brandonio21
11-25-2017, 12:55 PM
» Replies: 1
» Views: 15,991

 
  Drawing 3 simple houses.
Posted by: brandonio21 - 10-05-2011, 06:34 PM - Forum: Java - Replies (4)

I have recently designed a bit of code for a school assignment that actually draws 3 houses, each one with a specified height and width. It is based on an OOP structure. So here is the house.java code:

Code:
//House: Assignment P4.9 by Brandon Milton
/*
*
*
* Written by brandonio21
* http://brandonsoft.com
* http://bpforums.info
*
* Use as you'd like!
*/
import java.applet.Applet;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D;
import java.awt.geom.Line2D;
import java.awt.geom.Rectangle2D.Double;
public class house extends Applet {
int height;
int width;
int x;
int y;
    public house(int theight, int twidth, int tx, int ty){
        height = theight;
        width = twidth;
        x = tx;
        y = ty;
    }
    
    public void draw(Graphics2D g2){
         Rectangle2D.Double base = new Rectangle2D.Double(x,y,width,height); //Create the square that will be the bottom of the house
         int doorHeight = 0;
         if (height < 50){
             doorHeight = height;
         } else{
             doorHeight = 50;
         }
         //^ Size the door to the house if it is small
         Rectangle2D.Double door = new Rectangle2D.Double(x + 20,y + (height - 50),20,doorHeight); //Create the door
         Rectangle2D.Double window = new Rectangle2D.Double(x + 50,(y + height)-60,20,20); //Create the window
         Line2D.Double leftRoof = new Line2D.Double(x,y,x + (width/2),y- (height/2)); //Create the left side of the roof
         Line2D.Double rightRoof = new Line2D.Double(x + (width/2),(y - (height/2)),x+width,y); //Create the right side of the roof
        
         g2.draw(base);
         g2.draw(door);
         g2.draw(window);
         g2.draw(leftRoof);
         g2.draw(rightRoof);
         //Draw them all!
        
        
        
    }    
}

And here is the code for the tester class.. This is just an example, you can recode this to your needs if you are using it!
Code:
//Assignment P4.9 by Brandon Milton
/*
*
*
* Coded by brandonio21
* http://brandonsoft.com
* http://bpforums.info
*
* Feel free to use wherever you'd like!
*/
import java.awt.Graphics;

import java.awt.Graphics2D;
import java.applet.Applet;
import javax.swing.JOptionPane;
public class houseTester extends Applet {
    
    
    int width1 = Integer.parseInt(JOptionPane.showInputDialog("Width of house1")); //Creates an input dialog
    int width2 = Integer.parseInt(JOptionPane.showInputDialog("Width of house2"));//Creates an input dialog
    int width3 = Integer.parseInt(JOptionPane.showInputDialog("Width of house3"));//Creates an input dialog
    int height1 = Integer.parseInt(JOptionPane.showInputDialog("What is the height of house1"));//Creates an input dialog
    int height2 = Integer.parseInt(JOptionPane.showInputDialog("What is the height of house2"));//Creates an input dialog
    int height3 = Integer.parseInt(JOptionPane.showInputDialog("What is the height of house3"));//Creates an input dialog

    int x = Math.max(height1, height2);
    int maxheight = Math.max(x, height3);
//Finds the tallest house height
    public void paint(Graphics g){

        setSize(width1+width2+width3 + 25, (maxheight * 5)); //Sets the window size to give 25px of padding on the right, and a large amount of vertical padding
        
        
        Graphics2D g2 = (Graphics2D)g;
        house hs = new house(height1,width1,0,(0 + (height1*2))); //Draw house with user specs.
        hs.draw(g2);
        house hs2 = new house(height2,width2,width1 + 5,0 + (height2*2));//Draw house with user specs.
        hs2.draw(g2);
        house hs3 = new house(height3,width3,0 + (width1 + width2) + 5,0 + (height3*2));//Draw house with user specs.
        hs3.draw(g2);
        
    }
    
}

Here is the output of the already implemented code(With 100 set for every value):

[attachment=0]<!-- ia0 -->Houses.png<!-- ia0 -->[/attachment]

Enjoy! <!-- sSmile --><img src="{SMILIES_PATH}/icon_e_smile.gif" alt="Smile" title="Smile" /><!-- sSmile -->



Attached Files Thumbnail(s)
   
Print this item

  Drawing a bullsEye to the screen.
Posted by: brandonio21 - 10-04-2011, 07:39 PM - Forum: Java - Replies (3)

This was actually a school assignment, but I thought that I'd share my code with you:

Code:
//Exercise P4.6 - by Brandon Milton
/*
* This bullseye code is made by Brandon Milton, known as brandonio21 on BP Forums
* This exercise is directly from Cay Horstman's: Computing Concepts with Java Essentials
*
*   Commenting is for better understanding
*
* Feel free to use
* http://brandonsoft.com
* http://bpforums.info
*/

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.applet.Applet;
import java.awt.geom.Ellipse2D;
public class bullsEye extends Applet { //Tell Java that this is indeed an applet
    
    public void paint(Graphics g){ //This is what java needs to actually draw something
        Graphics2D g2 = (Graphics2D)g; //Tell java to use the newer graphics2d
        
        int rings = 8; //THIS CAN BE EDITED - This is the number of rings that the bullseye itself has. default is '8'
        
        int i = rings*50; //multiply the number of rings by 50, to get the largest rings width
        while (i > 0){ //As long as the width is not 0,
            Ellipse2D.Double elip = new Ellipse2D.Double(400 - (i/2),400 - (i/2),i,i); //Create a new circle, it's position is in the center of the previous ring, and it's size is the previous rings - 50
            if ((i/50 %2) == 0){ //If it is an even ring
                g2.setColor(Color.red);
                g2.draw(elip);
                g2.fill(elip);
                
            } else{ //It is an odd ring
                g2.setColor(Color.white);
                g2.draw(elip);
                g2.fill(elip);
            }
            i = i -50; //Decrease the size, and draw another ring
            
        }
    }

}

This code draws a bullseye to the screen at the location of 400,400, and grows outward. The number of rings can be edited.

[attachment=0]<!-- ia0 -->javaBullseye.png<!-- ia0 -->[/attachment]

Have fun!



Attached Files Thumbnail(s)
   
Print this item

  VB.NET vs Java in a nutshell.
Posted by: brandonio21 - 10-02-2011, 09:24 PM - Forum: Computing - No Replies

Ever since I started making Java tutorials, tons of people have sent me private messages on YouTube asking which language to learn, Visual Basic .net, or Java.

Well, each language has its own perks: vb.net is more secure, and easier to learn. Plus, it is really easy to design the interface of an application using Visual Studio.
Java, however, is multiplatform, (Meaning it can run on any Operating system), and is relatively difficult to learn. Plus, interfaces require coding knowledge.

Overall, it is really about preference. More companies tend to hire developers who know Java. However, knowing both gets you extra points!!

Here is an image to help anyone that is confused:
[attachment=0]<!-- ia0 -->vbnetvsjava.png<!-- ia0 -->[/attachment]

**Hint, the 2nd code snippet is in Java!



Attached Files Thumbnail(s)
   
Print this item

  Integer Arrays!
Posted by: brandonio21 - 10-02-2011, 09:12 PM - Forum: Code Snippets - No Replies

I recently did a java tutorial on integer arrays, so I thought that I'd post the vb.net version of the code as well!

Code:
Public Sub Execute()
        Dim arrInt(5) As Integer 'Creates an integer array with 5 slots

        arrInt(0) = 1 'Assigns a value of 1 to the first slot in the array
        Dim i As Integer = 0 'Creates an integer, i, and gives the initial value of 0
        Do While i < 5 'While i is 0-4
            arrInt(i) = i + 1 'Tell the corresponding slot in the array to be equal to i+1, so if i was 3, arrInt(3) would be set to 4
            i = i + 1 'Increase the value of i by 1
        Loop
        MsgBox(arrInt(0).ToString + " " + arrInt(1).ToString + " " + arrInt(2).ToString + " " + arrInt(3).ToString + " " + arrInt(4).ToString) 'Convert all the array values to strings, and display them in a messagebox
    End Sub

After posting this little code snippet, I realized that I never really created a video explaining Arrays in vb.net. Since arrays are extremely useful, I may be doing a tutorial on this soon!

Print this item

  Integer Arrays!
Posted by: brandonio21 - 10-02-2011, 08:56 PM - Forum: Java - Replies (2)

I recently made a video tutorial on integer arrays, and some people may just want to copy/paste the code for their own purposes, so here it is, fully commented!
[code2=java]public class arrayTutorial { //Create the class

public static void main(String[] args){ //Create the main method (This is what gets executed)

int arrInt[] = new int[5]; //Create a new integer array with 5 slots
//Note: Indices start from 0
arrInt[0] = 1; //Tell the first slot (index) in the array to have a value of 1

int i = 1; //Give i a value of 1
while (i <= 4){ //If i is less than 5
arrInt[i] = i+1; //Assign the corresponding slot of the array (i) a value of 1 + i; so if i is 2, the 3rd slot of the array would be filled with 2+1, which is 3.
i++; //Increase the value of i by one

}
System.out.println(arrInt[0]+ " " + arrInt[1] + " " + arrInt[2]+ " " + arrInt[3] + " " + arrInt[4]); //Output all the slots in the array in string form (seperated by spaces)


}

}[/code2]

Basically, what I am doing here, is creating a new integer array with 5 slots, using a while statement to fill the 5 slots, and displaying each slot, separated by a space.

Hopefully this helps anyone actually doing Java (As I know this forum is mostly vb.net based)

Print this item

  Getting active again!
Posted by: brandonio21 - 10-01-2011, 12:40 PM - Forum: Off-Topic - Replies (1)

Well, this weekend I was browsing the forum and realized that it is simply full of inactivity.

Right now, I am focusing on completing several personal projects, doing a project for a client, and learning Java.. While at the same time playing Battlefield 3 - So I have had barely any time to post things on the forum.

But, for the sake of people, I will try to post on the forums more often! <!-- sTongue --><img src="{SMILIES_PATH}/icon_razz.gif" alt="Tongue" title="Razz" /><!-- sTongue -->

Print this item

  Step by Step tutorials of VB!
Posted by: Himansh - 09-27-2011, 07:31 PM - Forum: VB.NET (Visual Basic 2010/2008) - Replies (1)

Hi
can Anybody make step by step tutorial of vb please

Print this item

  Help Editor in VB
Posted by: Covert2String - 09-24-2011, 03:59 PM - Forum: VB.NET (Visual Basic 2010/2008) - Replies (17)

Hello, here I am asking for help again <!-- sBig Grin --><img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt="Big Grin" title="Very Happy" /><!-- sBig Grin -->. So, what I want is to know if there's a way to make a programm like a PHP editor, I want my application to "read" the code and change some keywords like "for", "while" to a specified color.

Print this item

  Zooming
Posted by: brco900033 - 09-21-2011, 07:17 AM - Forum: Programming Help - Replies (2)

Hi all,
I have a question, I'm making an image editor but how can I make a code to zoom in and out on the PictureBox?

Thx

Print this item

  Alyus "Fab-Book"
Posted by: xolara - 09-09-2011, 09:25 PM - Forum: VB.NET (Visual Basic 2010/2008) - Replies (4)

Allthough i havnt come up with a proper name for it yet

i felt like i should show you guys some videos of my progress so far

The idea behind the program is for us at Alyus can use it for our current projects and have an easy to share progress/Description/Imaging with eachother

I have 2 videos and it says itself the second video is the newest <!-- sSmile --><img src="{SMILIES_PATH}/icon_e_smile.gif" alt="Smile" title="Smile" /><!-- sSmile -->

Video 1 http://dl.dropbox.com/u/12582973/Fab-Book/fabbook.mp4
Video 2 http://dl.dropbox.com/u/12582973/Fab-Book/fabbook2.mp4


As you can see the program is allmost done. Ive made this program in approximatly 9 hours give or take

i will again upload a video of the final program <!-- sSmile --><img src="{SMILIES_PATH}/icon_e_smile.gif" alt="Smile" title="Smile" /><!-- sSmile -->

Print this item