java

Multiplayer Networked Anagram game

Hello! I need some help about this little project. I'm begginer in java and it seems to me too hard to make it by myself. So please Help me. I will apperciate any help... A waiter delivers a sequence of letters to various players who are connected. Each player proposes a server anagrams he discovered from the sequence of letters: the...

Set Eclipse to automatically switch to Java perspective when terminating debug

Having Eclipse automatically switch to debug perspective while debugging is a great feature - is the opposite available? I'd like it to automatically return to Java perspective when terminating a debug session. A keyboard shortcut to return to Java perspective could be help as well. ...

Eclipse/Java - is it harmful to import java.(namespace).*?

Why does Eclipse take a fine grained approach when importing types? In C# I'm used to things like "using System.Windows.Controls" and being done with it, but Eclipse prefers to import each widget I reference individually (using the Ctrl+Shift+O shortcut). Is there any harm to importing an entire namespace if I know I'll need multiple t...

seam shutdown listener

Hi all, I would like to observe when the application is about to shutdown. I thought this code block would work, but it never catches that event. My component is an event scoped component, I only want it to live for the scope of that event. @Observer("org.jboss.seam.preDestroyContext.APPLICATION") @Transactional public void o...

Java - How do I use a class file?

Hi, I'm new to Java and am wondering about how to import class files into netbeans and use it. I understand that a class file is machine-readable byte code but I don't care what's going on under the hood. I'd just like to import it into my current project and have it recognize it so I can use the class. Also, the class file is embedde...

Eclipse/Java - Values in R.string.* return int?

I thought I'd be classy and use the string.xml file to define some constant strings for things like exception messages. In strings.xml I hit Add, chose the "String" option (not 'String Array'), then gave it a name and value. I was surprised to see that this code doesn't work: throw new Exception(R.string.MyExceptionMessage); And tha...

How to count words in java

Hi All, I am looking for an algorithm, hint or any source code that can solve my following problem. I have a folder it contains many text files. I read them and store all text in STRING. Now I want to to calculate, if any of the word appeared in other files or no. ( I know its not clear let me give an example) For example i have two do...

how to print one string object without set newLine() manually using TextPrinter

Continuing my post for finding the print service application, I'm really interested in java4less(textprinter). How do I to print one string object with multiple line inside, let's say the string name is out: AID : 000922 A/C Number : XXXXXXXXX A/C Name & Address : REKENING ANTARA SHB DGN TOP ...

Accessing instance variables from objects in a list

I'm working on a self-assigned project over break, and am running into one major sticking point. This is a basic line-recognition program in Java. I have a Points class which creates the Point from the ordered pairs & sends it to the Line class for slope & intercept calculation. The results are sent back to the Points class which dep...

Java: Forwarding a port to ServerSocket

I'm building a simple server application, and I can connect to it in the Local Network. But I can't connect over the internet. This is my Server code: ServerSocket server; try { server = new ServerSocket(4000); } catch(IOException ex) { System.out.printf("Could not bind socket 4000\n"); System.exit(1); } try { Socket ...

Wrap XML Element wth text using Java?

I want to transform XML like this: <account>Wally World</account> <city>Anywhere</city> <state>CA</state> Into this by wrapping each element with equals and single quote i.e. ='' <account>='Wally World'</account> <city>='Anywhere'</city> <state>='CA'</state> Need to transform all the element text in large XML files using Java, mayb...

Determine which jar file a class is from

Hi all, I am not in front of an IDE right now, just looking at the API specs ... CodeSource src = MyClass.class.getProtectionDomain().getCodeSource(); if (src != null) { URL jar = src.getLocation(); I want to determine which jar file a class is from, is this the way to do it? Walter ...

What is the best book for 2D graphics using Java?

I need the best 2d graphics book in Java. And also need correct link for ebook for that......... ...

How to hide cursor

Is there anyway to hide cursor other than using transparent gif image? ...

How to inject session bean into a POJO using Spring

I am having a EJB 3.0 Session Bean which implements the Local interface, and I have a pure POJO also. How can I inject a Session Bean into the POJO rather than manual JNDI look up in to POJO through spring(using @Resource and SpringBeanAutowiringInterceptor)?. Is there any way to do that? ...

Regarding Java Calendar class

I wanna programmatically convert an integer in the range 1-12 to corresponding month name. (e.g. 1 -> January, 2 -> February) etc using Java Calendar class in one statement. Note : I want to do it using Java Calendar class only. Don't suggest any switch-case or string array solution. Thanks. ...

Restart of Apache Tomacat

Hi, When we change any code in servlet we need to restart Apache ,but when we change any code in JSP we need not restart Apache. Even though at last JSP is turned to Servlet.I ...

java developer certification: which is more important

Hi I am student with 2 years of core java experience. Most of the work which i have done till now is in Java swing and related to other core api's of java. I do have some understanding of Java EE. But i have to decide which certification I should take next after scjp. Does SCJD is more valuable compared to SCWCD and SCBCD ? Which on...

GWT AdsManager not displaying ads on map

Here's my code: AdsManagerOptions options = AdsManagerOptions.newInstance(); options.setMaxAdsOnMap(1); AdsManager ads = AdsManager.newInstance(map, "google"); ads.setEnabled(true); I tried doing this before the map is added to a panel, after a map is added to a panel, and any other way i could think of that coul...

close window event in java

I added an window state listener as follow: this.addWindowStateListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { ExitAction.getInstance().actionPerformed(null); } }); But when I'm using the X close button the event is not called. I think it's something to do with netbean jdeskto...