DavidKroukamp 105 Master Poster Team Colleague Featured Poster

The whole thing is quite a heap of code - not sure it's worth posting it all. Any particular areas you think may be interesting?

Understandbly it should be a heap of code :).

Areas that are interesting?!? Definitely the below:

things like gravity, air resistance, and lossy bouncing

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

I did a similar thing for use as a teaching aid in tutorials, and it looks a lot like yours - a JPanel with paintComponent overidden to draw all the game objects, and a hierarchy of game objects that do not need to be JComponents or anything else. Perhaps the only interesting difference is that I separated the behaviour of the game objects from their display - that's because I was modelling things like gravity, air resistance, and lossy bouncing in the objects themselves, and if I put all that with stuff like drawing animated GIFs all in one class it got far too big.

The one area I found really hard was handling collisions between non-rectangular objects, especially when there are lots of objects. It took ages to get an implementation that could show dozens or even hundreds of balls all bouncing off each other.

Yes one thing I must still do is OO my logic more i.e seperating the behaviour of the game objects from their display.

As for your project it sounds extremely interesting, I too would like to add physics to the above code, but yeah I think I better do some refreshing on my high school physics lessons first :P.

It would be really awesome if you could post your own code snippet of your game I think it will help many more than mine is right now :)

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

Why would you accept all the overhead and potential conflict of using a very large and complex class like JPanel when you don't use any of its methods?

Oops sorry James I thought the above was directed towards my code i.e GamePanel class. But I see it was a reply to previous poster :).

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

But ehy you arent using jpanels as game objects

That is another way, but IMO it will decrease performance if we have many sprites rendering/moving at the same time, thus moving many JPanels etc, it is more performance efficient to draw directly via paintComponent. It also forces us to adopt a Null/Absolute LayoutManager which is really not a good idea, especially if we have a HUD (Head Up Display) than we would have to put the HUD on a glasspane, and redirect mouse events to our game panel etc, so just more work in general.

why would you accept all the overhead and potential conflict of using a very large and complex class like JPanel when you don't use any of its methods?

True James, I should change the perhaps to JComponent, atleast others now know what can be done to improve things

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

I have seen many questions on autocompeletion for java text components like JTextField JTextArea JTextEditorPane etc.

There are not many options either:

1) 3rd party library (like SwingX)
2) DIY (i.e using DocumentListener, JWindow with JLabel etc and a few requestFocusInWindow calls)

I chose number 2 and put the code up here for others to have a working foundation that can be improved to your needs.

Basically you would just make sure the AutoSuggestor class is within package hierarchy than you would do something like:

        //create JTextComponent that we want to make as AutoSuggestor
        //JTextField f = new JTextField(10);
        JTextArea f = new JTextArea(10, 10);
        //JEditorPane f = new JEditorPane();

        //create words for dictionary could also use null as parameter for AutoSuggestor(..,..,null,..,..,..,..) and than call AutoSuggestor#setDictionary after AutoSuggestr insatnce has been created
        ArrayList<String> words = new ArrayList<>();
        words.add("hello");
        words.add("heritage");
        words.add("happiness");
        words.add("goodbye");
        words.add("cruel");
        words.add("car");
        words.add("war");
        words.add("will");
        words.add("world");
        words.add("wall");

        AutoSuggestor autoSuggestor = new AutoSuggestor(f, frame, words, Color.WHITE.brighter(), Color.BLUE, Color.RED, 0.75f);

A suggestion cna be clicked with the mouse or alternatively the down key can be use to traverse suggestions and the textcomponent

JTextField pop up window will be shown under the component:

8b41e7d1c4627b8d4248d53df62907e1

while JTextArea and any other JTextComponents will have it visible under the Carets current position:
b50012c98765c57a4ed1ac488e06db35

Hope it helps others.

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

The most important part I think: 2D or 3D?

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

See How to Use Combo Boxes has all you need to know there, Specifically Providing a Custom Renderer than you woild simply call setSelectedItem(Obejct o) unless you can post an SSCCE of your current approach.

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

The problem is here:

        System.out.println("Please enter income:");
        income += key.nextDouble();
        System.out.println("Please enter income:");
        if (key.nextDouble()<0)  {   
            System.out.println("Thank you for using tax calculator, your total income entered is:" + income);
            System.exit(0);
        }
        else if (key.nextDouble() <0 || income <= 0){
            System.out.println("Thank you for using tax calculator,the program will now exit");
            System.exit(0);
        }

You keep calling nextDouble in your if statements which ofcourse after a double has already been read it will read a white space.., rather read the double into a value and check it like that.

for example:

public static void getIncome() {
    Scanner key = new Scanner(System.in);
    double income = 0;
    System.out.println("Welcome to Tax Calculator");
    System.out.println("Please enter your income:");
    double d = key.nextDouble();
    income = d;
    while (income > 0) {
        System.out.println("Please enter income:");
        d = key.nextDouble();
        income += d;
        if (d < 0) {
            System.out.println("Thank you for using tax calculator, your total income entered is:" + income);
            System.exit(0);
        } else if (d < 0 || income <= 0) {
            System.out.println("Thank you for using tax calculator,the program will now exit");
            System.exit(0);
        }
    }
}
DavidKroukamp 105 Master Poster Team Colleague Featured Poster

Hmm I found this code somewhere on the net as a question on a forum (lost the link now), but I patched it up and altered it (still not the best) but hopefully it will give you the basic idea:

dfgf

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Graphics;
import java.awt.HeadlessException;
import java.awt.Point;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.dnd.DnDConstants;
import java.awt.dnd.DragGestureEvent;
import java.awt.dnd.DragGestureListener;
import java.awt.dnd.DragSource;
import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetAdapter;
import java.awt.dnd.DropTargetDropEvent;
import java.awt.geom.Rectangle2D;
import java.io.IOException;
import java.util.ArrayList;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSeparator;

public class DndExample {

    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                createAndShowGUI();
            }

            private void createAndShowGUI() {

                final JFrame frame = new JFrame();
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

                DropPanel dropPanel = new DropPanel();

                Rectangle2D rectangleA = new Rectangle2D.Double(20, 20, 120, 50);
                Rectangle2D rectangleB = new Rectangle2D.Double(60, 90, 120, 50);

                MyLabel label1 = new MyLabel("gray", rectangleA, Color.GRAY);
                MyLabel label2 = new MyLabel("green", rectangleB, Color.GREEN);

                JPanel dp = new JPanel();

                dp.add(label1);
                dp.add(label2);

                JLabel label = new JLabel("Drag text here");
                dropPanel.add(label);

                JSeparator js = new JSeparator(JSeparator.VERTICAL);

                new MyDropTargetListener(dropPanel);

                MyDragGestureListener dlistener = new MyDragGestureListener();

                DragSource ds1 = new DragSource();
                ds1.createDefaultDragGestureRecognizer(label1, DnDConstants.ACTION_COPY, dlistener);

                DragSource ds2 = new DragSource();
                ds2.createDefaultDragGestureRecognizer(label2, DnDConstants.ACTION_COPY, dlistener);


                frame.add(dropPanel, BorderLayout.WEST);
                frame.add(js);
                frame.add(dp, BorderLayout.EAST);

                frame.pack();
                frame.setVisible(true);

            }
        });
    }
}

class MyLabel extends JLabel {

    Rectangle2D rect;
    private final Color color;

    public MyLabel(String text, Rectangle2D rect, Color color) {
        super(text);
        this.rect = rect;
        this.color = color;
    }

    public Rectangle2D getRect() {
        return rect;
DavidKroukamp 105 Master Poster Team Colleague Featured Poster

To clarify, you would like to be able to drag a component from one JPanel to another or the smae panel?

Also are you looking for DnD option only? Or custom too?

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

Here are 3 great links that should answer your question:

Some of the reasons being:

1) Multiple inheritances does complicate the design and creates problem during casting, constructor chaining etc thus the reasons for omitting multiple inheritance from the Java language mostly stems from the "simple, object oriented, and familiar" goal.

2) Ambiguity around Diamond problem

Java solution:

Instead, Java's designers chose to allow multiple interface inheritance through the use of interfaces, an idea borrowed from Objective C's protocols. Multiple interface inheritance allows an object to inherit many different method signatures with the caveat that the inheriting object must implement those inherited methods.

It is also interesting to note C# also doesnt allow for multiple inheritance of classes and rather multiple interface inheritance.

I guess this is also the reason why Java best practice it to make every class implement an interface, thus you can implement your multiple classes by implementing their interfaces on the new class.

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

Im not sure what is the expected output, but I can see the discount JLabel (sLAbel)?

kgfsd

Please be more specific.

A thing to note though regarding your code, no need for the setVisible(..) on JLabel as you dont call setVisible(false) you simply clear text.

Also dont forget to create Swing components on Event Dispatch Thread via SwingUtilities.invokeLater(Runnable r) block.

DavidKroukamp 105 Master Poster Team Colleague Featured Poster
DavidKroukamp 105 Master Poster Team Colleague Featured Poster

I have recently been interested in Java Swing and Game development, so naturally I began creating many different 2D games.

During them I found myself having to rewrite much code, but eventually I decided to write some classes that would help me whenever I wanted to make a game.

Here is the basics for a single threaded game loop with multiple user input (i.e player moves with W, S, A and D and player 2 with UP, LEFT, RIGHT, and DOWN. Player1 can shoot with SPACE and player 2 wuth ENTER)

Basically there is an abstract class GameLoop which require you too override draw(), update(float elapsedTime) and checkCollisions(). This GameLoop will that be started and will call those methods as to render the screen at a set amount of frames per second. It uses a Fixed Time Step Game loop and is startable, pauseable/resumable and stopable. See here for more.

Next we have an Animator class which basicaly allows us to add an ArrayList of BufferedImages and timings for the images to be displayed. This class is mainly there to be used with GameObject. If you were wondering wwhy GameLoop had a method update(float elapsedTime) it is for the Animator class so it know how much time has passed and wether or not it should change images currently displayed.

GameObject class as the name suggest represents any object that we can draw to the GamePanel. It extedns the Animator class which allows it the functionality to have multiple …

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

Here is a small sample Swing GUI I made to get you started:

Untitled95

import java.awt.BorderLayout;
import java.net.MalformedURLException;
import java.net.URL;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;

/**
 *
 * @author David
 */
public class SwingGuiTest {

    private JFrame frame;

    public SwingGuiTest() {
        initComponents();
    }

    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                new SwingGuiTest();
            }
        });
    }

    private void initComponents() {
        frame = new JFrame();
        //set what to do when frame X is pressed
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setResizable(false);


        //create componnets
        JButton button = new JButton("Button");
        JTextField tf = new JTextField(6);
        JLabel l = null;
        try {
            l = new JLabel(new ImageIcon(new URL("http://www.percona.com/live/nyc-2012/sites/default/files/daniweb_logo.png?1344973349")));
        } catch (MalformedURLException ex) {
            ex.printStackTrace();
        }

        //add componnets to frame
        frame.add(l, BorderLayout.NORTH);
        frame.add(tf, BorderLayout.CENTER);
        frame.add(button, BorderLayout.SOUTH);

        //size and show frame
        frame.pack();
        frame.setVisible(true);
    }
}

Hope it helps

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

You could import the com.samsung.util.AudioClip class into your java class. Then you can reference the java docs from the link below to see how to use it.

http://www.j2megame.org/j2meapi/Samsung_API_1_0/com/samsung/util/AudioClip.html

Keep in mind that you can only use .midi, .mmf, or .mp3 audio with this class. If you prefer making the code custom to your solution then you may want to refer to the link below for another tutorial.

http://docs.oracle.com/javase/tutorial/sound/playing.html

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

why do you have:

                case "player1": currentPlayer = player1;
                                break;
                case "player2": currentPlayer = player2;
                                break;
                default: currentPlayer = player1;
                         break;

do this

                case player1: currentPlayer = player2;
                                break;
                case player2: currentPlayer = player1;
                                break;
                default: currentPlayer = player1;
                         break;

as we want to compare the 'currentplayer' var to the 2 player name variables

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

maybe something like

String p1,p2,currentPlayer;
...
p1="name1";
p2="name2"
currentPlayer=p1;//player 1 always starts I guess :)

while(!gameOver) {//loop for the game span

    if(!isPotted(..)) {
    //if a ball is not sunk we change the names
    //if the currentPlayer name is the same as player1 name we switch the currentPlayer name to the opposite of course

    /*if(currentPlayer.equals(p1)) {currentPlayer=p2;}else {currentPlayer=p1;}*/

        switch(currentPlayer) {
            p1: currentPlayer=p2;
                break;
            p2: currentPlayer=p1;
                break;
            default:
                currentPlayer=p1;
        }
    }else {
    //The ball was potted by the same player so no name changes take place
    }
}
DavidKroukamp 105 Master Poster Team Colleague Featured Poster

What exactly is your question? does your existing method work and you would like a more effecient way to do the name switching when balls are sunk? or does it not work?

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

Well to disable it as in make it no more visible thats a bit hard (maybe impossible) why not add a WindowListener and then have Iconified handler like so:

frame.addWindowListener(new WindowAdapter(){

      public void windowIconified(WindowEvent e){
            frame.setVisible(false);
      }
});

this will react when the JFrame is minimized and make it not possible (make it visible instead if default setVisible(false).

Alternatively you may use a JDialog but that lacks a in-built maximize button

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

found a nice site with an example for you to have a look at: http://www.rgagnon.com/javadetails/java-0426.html

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

I guess my netbeans complied using jdk 6 libraries & rules but not the compiler

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

reference to test is ambiguous

found an interesting article: http://www.coderanch.com/t/326225/java/java/Ambiguous-Reference-method especially this:

The problem here is that, when a value is passed to a mathod, it may be automatically converted to a wider data type For example, this is perfectly legal:

public class Test  
{  
    public void doIt(int a) {...}  

    public static void main(String[] args)  
    {  
        Test t = new Test();  
        byte b = 1;  
        t.doIt(b);  
    }  
}  

This is valid because a byte can be safely converted to an int. Therefore, an implicit cast takes place prior to invocation of the doIt method. You don't actually send a byte to doIt, you send an int to doIt. That int was created by implicitly widening the original byte value.

In your case, you have three integer literals. In Java, a numeric literal is considered an int. Therefore, you're trying to pass 3 ints to a method. The compiler then looks for any methods by that name that can take 3 ints. There is no such method, but there are these other two that can take combinations of ints and longs. Well, an int can be converted to a long, so these methods are applicable.

so as we can see the compiler doesnt know which to choose in the OPs code an int can be impliclity converted to a double, though I'm not sure why it won't replicate this on other PC's with same version, maybe its an IDE bug?

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

How did you checked on both the versions?Can we keep both version installed on the same pc?

I have both JDK's (yes you can) so just let my Netbeans compile under the libraries of each. I did your code too and all fine, I even went to JDK 5 (using netbeans project properties) but no error.

Not sure whats wrong.

Thank you David.

Pleasure

DavidKroukamp 105 Master Poster Team Colleague Featured Poster
public class JavaApplication186 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Test.x("abc", 1, 2);
        Test.x("abc", 1.0, 2.0);
    }
}

class Test {

    public static void x(String s, int... i) {
        System.out.println("i " + i[0]);
    }

    public static void x(String s, double... d) {
        System.out.println("d " + d[0]);
    }
}

Hmm I got this exact code to compile under JDK 7 and JDK6?

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

Did you even read the link? and read does not mean look at it, well either way here is the link on the page I gave under Lesson 4- http://www.leolol.com/drupal/tutorials/3d-graphics-jogl-opengl-etc/jogl-lesson-4-3d-shapes-and-rotation-opengl

unless I misunderstood you

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

@vegaseat Mythbusters proved the 7 times dry paper folding thing as busted! OIS (Out of Interests Sake)

If you could theoretically fold a 1mm thick piece of paper 100 times it would be thicker than that observable diameter of the universe!!!!

See here for more info: http://therealsasha.wordpress.com/2011/08/

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

I'm not sure, what in specific you are looking for, but here's a great place to start: http://jogamp.org/wiki/index.php/Jogl_Tutorial

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

LOL, Hmmm seems my memory is slipping! A sign of old age, but thanks I see now, though I still do think having a single way to upvote and downvote would be better (regardless of a comment), but in the land of the dead you play dead (I guess) :)

DavidKroukamp 105 Master Poster Team Colleague Featured Poster
DavidKroukamp 105 Master Poster Team Colleague Featured Poster

I'm not sure if I'm the only 1, but since the new site has been up, which looks great just took a while to get used to, reputation has not gone up (it has a little but not what it used to be). By this I mean, great users that I knew (reframed from mentioning names) would increase rep, more then I change underwear. Although I wasnt really one of them my rep would substantially increase, but since the new site, and the new upvoting system, where you have to hover over the 'Upward arrow' and then move your cursor down to the 'vote & comment box' before any rep is actually given, otherwise, only a single upvote (+1) would be given which does not increase reputation just the upvoted post counter, rep has hardly increased, now upvoted posts counters are on the rise.

Now IMO I answer questions because I like too, but also too get some aknowledgement/rep which makes me feel like a genious :P, however, now I barely see anyones rep increasing and if it does hardly by anything. This voting system is very confusing. I also struggled to grasp this, now how to we exepect new users to graps it to? I myself even got confused (see here), in that article Dani said it was done for transparency (which is agreeable, but why not rather give everyone a standard amount that when thet upvote a post only 'x' amount will be added and when …

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

@stultuske, java has been exposed to having many flaws, leading to a great number of malware infections, which is still on the rise due to Java not being updated on many PC's. But I guess as lonh as you have a Good AV even though a virusmay use an exploit fom Java 6 the AV will catch it, but why risk it I guess is the question

peter_budo commented: Irrelevant and off topic -3
DavidKroukamp 105 Master Poster Team Colleague Featured Poster

Please give the full error message thats printed from the console.. with the line number and thrown exception etc and of course the section of code the error is pointing too

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

Did you try a Google, or this might help

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

Yes I agree with stultuske, try make your Netbeans frame resizable, and see maybe if the JTable is added , just not in the place you though..... To add a panel to a Netbeans created frame i think you'd have to add your own code in the netbeans gui creation like this: http://stackoverflow.com/questions/816286/how-to-include-custom-panel-with-netbeans-gui-builder the link has quiete a few links that will get you started.

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

Im not sure but I think this and here and maybe this

HTH

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

Type that into Google, after all thats why its there.

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

Im sure this and this will help, they show how to send SMS using smslib in java, and here are the SMSLIB Docs, it would be goog to go through them.

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

Have you tried appending cmd.exe to your query like this: "cmd NET TIME \servertosynchwith /SET /YES" I think that should work, you have to call command prompt with arguments which will be the "NET..."

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

Any questions or do you just want to share code? if so I dont think this is the place?

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

Uhm how about the strings substring(int startIndex,int endIndex) or the lastIndexOf(String s) methods. This is really simple, could you show some code you have tried? A quick Google

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

try these links im sure this will do: http://support.microsoft.com/kb/222092 , http://blog.mwrobel.eu/how-to-call-dll-methods-from-java/ , http://stackoverflow.com/questions/771145/how-do-i-call-dll-inside-java and http://www.java-forums.org/advanced-java/2064-how-call-dll-java.html and it seems you can use this really quick technique to load your dll use:

System.load("C:/Windows/System32/yourdllname.dll");

or

    System.loadLibrary("C:/Windows/System32/yourdllname.dll");
DavidKroukamp 105 Master Poster Team Colleague Featured Poster

Hmm are you talking about the Encapsulation feature OOP languages provide? if so see just add the 'private' modifier to variables and methods that you want hide from other classes that may initiate your object. Note, if you use private modfier on variables that are needed in the calling class then just create appropriate mutators and accessor methods to change and view private instance data. see here for more information:http://en.wikibooks.org/wiki/C_Sharp_Programming/Encapsulation

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

Hmm what LayoutManager sre you using? Most Layouts have a constructor that accepts the vertical and horizontal gap bewtween components: for example using

 panel = new JPanel(new BorderLayout(5,5));

will create a default BorderLayout with a 5 spacing for horizontal and vertical components
or in your case maybe you are using a GridLayout?

 panel = new JPanel(new GridLayout(2,2,10,10));

The above wil create a 2x2 gidlayout with 10 vertical and horizontal spacing

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

Netbeans unfortuantely underlines the entire line making it hard to see where the error is! And as James said sometimes the IDE generated syntax error messages make things more confusing

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

change the thickness of a Line2D

Hmm this shoud help:

import javax.swing.*;
import java.awt.*;
import java.awt.geom.*;

public class TestLine extends JFrame{
 private MyPanel panel;
 public TestLine() {
    setSize(200, 200);
    panel = new MyPanel();
    getContentPane().add( panel, "Center" );
    }

 public static void main( String [] args ){
    TestLine tl = new TestLine();
    tl.setVisible( true );
    }
}

class MyPanel extends JPanel {
    final static BasicStroke stroke = new BasicStroke(2.0f);
    final static BasicStroke wideStroke = new BasicStroke(8.0f);

    public MyPanel(){}

    public void paintComponent( Graphics g ){
        Graphics2D g2 = (Graphics2D)g;
        g2.setRenderingHint
          (RenderingHints.KEY_ANTIALIASING, 
            RenderingHints.VALUE_ANTIALIAS_ON);
        g2.setStroke( stroke );
        g2.draw(new Line2D.Double(10.0, 10.0, 100.0, 10.0));
        g2.setStroke( wideStroke );
        g2.draw(new Line2D.Double(10.0, 50.0, 100.0, 50.0));
        }
}
DavidKroukamp 105 Master Poster Team Colleague Featured Poster

its basically telling you that you are using a deprecated api.. meaning : its an older class or method and that it might cause an error like a buffer overflow... http://www.javacoffeebreak.com/faq/faq0008.html my netbeans says: getText() is "Deprecated. As of Java 2 platform v1.2, replaced by getPassword." for lines 39 & 40. http://stackoverflow.com/questions/10443308/why-gettext-in-jpasswordfield-was-deprecated

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

hmm i havent tried your code, but back when i was doing my own server client encryption, i realizd that if i never converted the data to base64 and sent it over the socket it would decode incorrectly, i think due to symbols etc.... so i first encrypted the data, then coded to to base64, sent it over the socket, decoded it from base64 and then decrypted it, thus prevented a loss of data. http://www.rgagnon.com/javadetails/java-0598.html.

[edit] however if your code does not even work normally ie without sending it over the socket and decrypting but rather doing it on your home pc then then the above will not apply to your problem. only if the problem occurs when you send it over the socket for decryption does the above apply.

here are a few links that might help then: http://eternusuk.blogspot.com/2008/09/java-triple-des-example.html and http://www.java2s.com/Code/Java/Security/TripleDES.htm and http://orlingrabbe.com/3des2_cbc.htm

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

JTextArea has a setText() method and a getText() method use the getText() to get your previous written text and then use setText() to add the new text and the old text. NB this wont work

textarea.setText(whatever+textarea.getText());

you will have to use a temp variable to hold the results of getText()

DavidKroukamp 105 Master Poster Team Colleague Featured Poster

dont think java has that as a built-in api, maybe look to using google maps api or another one that can take an ip and get current location? or you could just use the knowledge of an ip structure and get the location like that? : http://www.javaranch.com/journal/2008/08/Journal200808.jsp#a2. Also see here: http://stackoverflow.com/questions/1415851/best-way-to-get-geo-location-in-java and http://stackoverflow.com/questions/2244989/need-a-client-side-api-for-determing-geo-location-of-ip-addresses