# help regarding a java project



## sanoob.tv (Feb 17, 2013)

hey
im planning to do a ieee project in java.the project title is   Packet Hiding Methods for Preventing Selective Jamming Attack
i have never done such projects before.and i have no idea where to start.i do have good knowledge in core java n swing.
but dnt knw where to start.can any one help me.im totally lost 
thnx.


----------



## harshilsharma63 (Feb 17, 2013)

Do you have knowledge about the project's topic? If no, then I would suggest you to first get an inside on the topic you'll be working on.


----------



## sanoob.tv (Feb 17, 2013)

i read an abstract,reading the ieee paper now.
i have only done some standard database application,n android apps so far.wanna do something diffent


----------



## sanoob.tv (Feb 18, 2013)

i need to create a simple java app,using swing to send and recieve packets between  two laptops connected to a router


----------



## harshilsharma63 (Feb 18, 2013)

Sorry, but I have no clue on this  . Just read some tutorials and a lot of sample code.


----------



## sanoob.tv (Feb 19, 2013)

k,thnx any way.
im reading upon tcp in java
can you tell me how to add an image in a java swing app.
is there a custom component.so that i can use image as in visual studio?


----------



## vickybat (Feb 19, 2013)

^^ In order read image file from your system, you have to import io package. Check the following code:


```
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.*;
import java.util.*;
import javax.imageio.*;
import javax.swing.*;

public class MyImgPanel extends JPanel {

 private [B]BufferedImage[/B] image;

    public MyImgPanel() {
       try {                
          image = [B]ImageIO[/B].read(new File([B]"your image name and path"[/B]));       // You access this through constructor
       } catch (IOException ex) {
            ex.printStackTrace();
       }
    }

public void paintComponent(Graphics g) {
Graphics2d g2d = (Graphics2d) g;                    // use the Graphics2d class instead of Graphics
        super.paintComponent(g2d);
        g2d.drawImage(image, 0, 0, null);    }                   // see javadoc for more info on the parameters.You can alter the co-ordinates to alter the image
```

I hope this helps.


----------



## harshilsharma63 (Feb 19, 2013)

if you want to display a single, fixed everytime, then just place a jLable, remove its text, right click on it and go to it's properties, then select the image in the 'icon' property.


----------



## dead.night7 (Feb 19, 2013)

sanoob.tv said:


> i need to create a simple java app,using swing to send and recieve packets between  two laptops connected to a router



a basic chat application is what u need with a good understandably of tcp/udp classes in java.net package! have a look at book by joe wigglesworth on networking



sanoob.tv said:


> k,thnx any way.
> im reading upon tcp in java
> can you tell me how to add an image in a java swing app.
> is there a custom component.so that i can use image as in visual studio?



jLabel has a property for setting images too, have that image inside the same folder as that of your java class!

Good job, great idea...!


----------



## sanoob.tv (Feb 19, 2013)

vickybat said:


> ^^ In order read image file from your system, you have to import io package. Check the following code:
> 
> 
> ```
> ...





harshilsharma63 said:


> if you want to display a single, fixed everytime, then just place a jLable, remove its text, right click on it and go to it's properties, then select the image in the 'icon' property.





dead.night7 said:


> a basic chat application is what u need with a good understandably of tcp/udp classes in java.net package! have a look at book by joe wigglesworth on networking
> 
> 
> 
> ...




thnx.
i saw the jlabl meathod,but ran in to a problem with pictures of differnt resolutions.
is there a way to scale the picture to the size of jlabel.

and since i have two days off coz of the strike.il try to read up on the book you suggested


----------



## harshilsharma63 (Feb 20, 2013)

No direct way, VB had an auto-resize property for labels, unfortunately, there's nothing such in Java SE.


----------



## sanoob.tv (Mar 3, 2013)

any one know how to code a grid view in java(swing) like in .net???


----------



## harshilsharma63 (Mar 3, 2013)

Right click on frame > layout then select the layout you want.

Right click on frame > layout then select the layout you want.


----------



## tutorsonnet (Apr 1, 2013)

Nice projects but its a heavy tack you have to learn more and lots of java notes are available on web, so please refer online notes


----------

