Recent Notes

Displaying keyword search results 51 - 60
Created by alfa on April 11, 2011 21:40:51    Last update: April 11, 2011 21:40:51
Integer.bitCount counts the number of one-bits in the two's complement binary representation of the specified int value. Example code: public class CountOnes { public static void... For long , there's Long.bitCount()
Created by alfa on April 08, 2011 14:42:23    Last update: April 08, 2011 14:42:23
public class TestInnerClass { private stati...
Created by alfa on April 08, 2011 14:14:46    Last update: April 08, 2011 14:26:13
It's a lot easier to use swing JOptionPane to present a dialog. But if plain awt is what you want, this is the code. A Dialog is a Window object, so you paint it just like you would for a window. import java.awt.*; import java.awt.event.*; ...
Created by alfa on April 08, 2011 12:33:08    Last update: April 08, 2011 12:33:08
This example captures the screen of the current Java application window, instead of the full screen. import java.io.*; import java.awt.*; import ...
Created by alfa on April 04, 2011 18:09:43    Last update: April 08, 2011 12:27:11
import java.awt.Graphics; import java.awt.event...
Created by nogeek on April 07, 2011 21:07:55    Last update: April 07, 2011 21:07:55
You can use the javax.xml.transform.Transformer class to "transform" an XML stream (string in this case) to a DOM tree - effectively parsing the XML string. import java.io.*; import javax.xml.transform.Tr...
Created by nogeek on April 07, 2011 20:54:17    Last update: April 07, 2011 20:54:17
Use javax.xml.parsers.DocumentBuilder to parse xml. DocumentBuilder.parse() takes: java.io.File org.xml.sax.InputSource java.io.InputStream java.lang.String as a URI to an XML document Example code: import java.io.*; import javax.xml.parsers.Docu...
Created by alfa on April 06, 2011 12:48:44    Last update: April 06, 2011 12:48:44
package com.demo.io; import java.io.*; ...
Created by Dr. Xi on April 05, 2011 08:34:17    Last update: April 05, 2011 08:35:06
The Java servlet API does not provide a getStatus method for HttpServletResponse until version 3.0. This is a wrapper that provides getStatus for servlet API 2.5 and older. You have to override 4 methods because sendError etc. does not call setStatus . import javax.servlet.*; import javax.servlet.ht... You can plug it in a servlet filter like this: public void doFilter(ServletRequest req, ...
Created by alfa on April 04, 2011 16:05:41    Last update: April 04, 2011 16:05:41
import java.awt.*; import java.awt.event.*; ...
Previous  2 3 4 5 6 7 8 9 10 11 Next