I set the JPanel background color as white. However when I save it into JPG or other image format, the background are all in black. I have put this code TYPE_INT_ARGB but it doesnt work. How can I set the background to other color? e.g. blue, white etc.
public void paintComponent(Graphics g) {
int width = getWidth();
i...
hi every 1
I'm converting a byte array into int by doing this:
ByteArrayInputStream bais = new ByteArrayInputStream (data);
DataInputStream dis = new DataInputStream (bais);
int j = dis.readInt();
But it returns a signed number where I want an unsigned number, because I want to send that number to the server as an integer during encr...
I have a list element which is populated via a query, this is then run through a for loop which sends this list to the front end, a jsp and prints them.
Wanted to know if by calling the list.clear() outside the for loop, it will clear the list object, so will this lead to better memory management? or should one use the weakhashmap for ...
Our JavaEE application has a services which is responsible for installation and start up of other services depending on the configuration stored in a database. Services are installed using the
ServiceControllerMBean.install(
org.w3c.dom.Element element,
javax.management.ObjectName objectName)
method. This method requires a cla...
I'm trying to compile many files using the Compiler API.
Say I have a directory structure
.../program
+/org
+/foo
|+ Main.java
+/bar
+ Tools.java
Is there any way to discover all the Java files and make it compiler everything without resorting to recursing into all the directories and finding all the *.java file...
I'm working on a project that needs Jasper reporting, I have used the code fragment mentioned below to view the report in NetBeans 6.1 (the report is originally generated and compiled using iReport 3.6.0),my requirement is to print this report using a simple Swing application.
Code fragment:
public class JasperCheck {
public s...
I'm trying to save jface TreeViewer expansion state to refresh it after calling setInput() method. I tried getExpandedElements, setExpandedElements, getExpandedTreePaths, setExpandedTreePaths methods of TreeViewer bu it doesn't work.
Object[] expandedElements = viewer.getExpandedElements();
TreePath[] expandedTreePaths = viewer.getExpan...
Dear folks,
It is about WebDriver, particularly HtmlUnitDriver and FirefoxWebDriver
I used the same proxy settings for both HtmlUnitDriver and FirefoxWebDriver, but only FirefoxWebDriver works.
What I got with HtmlUnitDriver was "Access denied" from the proxy server. I got a blank page when I didn't use proxy settings. I don't think i...
I am wanting to develop an Automatic Attendance System using a thumb reader. When the user enters the office campus, they must put their thumb on to a thumb reader and is then marked as present.
Can anyone suggest a thumb reader that supports API for reading and comparing thumb-print images, so that I can easily integrate it with my att...
I have defined a class FieldProperty with some of properties corresponding to field defined in it.ArrayList object contains objects of class FieldProperty. now i want to store data in table .There is one record in table corresponding to each object of FieldProperty.if i call query for each record insertion.It will be very slow.Is there a...
how to create singleton classes for multiple uses
and how to connect to jsp with that singleton class
...
Please consider this code. Is it using Circular Reference? If not why am I getting CircularReferenceException, while enabling NO_REFERENCE mode in XStream. Anyone, please clarify the thing.
@XStreamAlias("BalanceEnquiry")
public class BalanceEnquiry extends EAIRequest {
@XStreamImplicit
private List<BalanceEnquiry.Detail> detai...
I'm using jbossIDE Eclipse 1.6. when deploying my .ear app, I get a java.rmi.MarshalException.
what's surprising is that just a few min ago, everything was OK.
I feel like this jbossIDE Eclipse thing is really useless. it's crashing all the time.
java.rmi.MarshalException: Failed to communicate. Problem during
marsh...
Hi, I am trying to integrate my software(developed in java) with a rifd reader.The data read by the reader when a card was swiped is 0068276206 and when the same card was swiped on fingerprint system with a reader it displayed the card number as 0001167342.
To get the value(0068276206) i read the data into a byte array(using java io...
How would I convert the following code to C#
DecimalFormat form
String pattern = "";
for (int i = 0; i < nPlaces - nDec - 2; i++) {
pattern += "#";
}
pattern += "0.";
for (int i = nPlaces - nDec; i < nPlaces; i++) {
pattern += "0";
}
form = (DecimalFormat) NumberFormat.getInstance();
DecimalFormatSymbols symbols = form....
Hi,
I am having an issue when trying to create beans from a spring Application Context inside a bean instatiated by sptring using constructor arguments.
I have implemented the ApplicationContextAware interface but it populates the context after the instance is created (obvious).
But then, if you need to get beans from the constructor...
Edited this question because of my bad examples.. Here is my updated question:
Would the following be equal in speed and memory allocation:
int b;
for (int i = 0; i < 1000; i++)
b = i;
and
for (int i = 0; i < 1000; i++)
int b = i;
...
How can I change the background color of the item which is selected in JList dynamically?
...
Hi everyone,
I want to install a specific jdk (the latest for example).
For this, i went to jdk download homepage: http://java.sun.com/javase/downloads/index.jsp
I look for a mac version but i'm a bit surprise to have only downloadable version for linux, window and solaris..
Here the message for Mac:
"Apple Computer supplies their own...
I want to make a simple Go board to design an Computer Go game.
In a go game, you lie a "stone" (white or black) on a position where horizontal and vertical lines intersect.
What are some simple ways to restrict users from placing their stones in other locations?
Maybe I'm just not seeing a simple solution.
EDIT
I guess I should rep...