java

How to change the hex string to 4 byte in java?

I am doing a assignment about this. For Eaxmple: I have a message (String), and the length is 302 in dec, 12e in hex. String message = "THE MESSAGE BODY"; int lengthOfMessage = number.length(); // 302 String lengthOfMessageInHex = Integer.toHexString(lengthOfMessage); // 12e Now, I need to change the lengthOfMessageInHex from "12e" t...

GUI-design with SWT components using Matisse (from NetBeans) - Still possible? How?

I just stumbles upon a screencast that shows someone designing a GUI with Matisse consisting of SWT-Component: http://showmedo.com/videotutorials/video?name=javaDevijverJ2Spart3&fromSeriesID=35 Does someone know how he integrated the SWT-Support into Matisse? Searching the web did not yield any useful infrmation so far. The screenc...

Java HashMap put in a for loop in

I have a for loop, where i check if there is a certain key in a HashMap, if the key is not there, it should put a new association in the HashMap. The problem is that that it puts the association, but by the next iteration of the loop the association is gone! I don't get it! public void DrawBoard(ArrayList<Integer[]> BoardList, int Frame...

Reversing LinkedList in Java

I am looking at the solution in this post http://stackoverflow.com/questions/354875/reversing-a-linked-list-in-java-recursively I copied the one of the solutions below. I've implemented it and it works fine. public ListNode Reverse(ListNode list) { if (list == null) return null; // first question if (list.next == null) return ...

Java - Enum with array field

Hey, I want to store a list names and individual nicknames for each name as an Enum in Java. The number of nicknames will not vary. The purpose is to be able to get a full name from a nickname. Currently I have implemented this like so: public enum Names { ELIZABETH(new String[] {"Liz","Bet"}), ... ; private Strin...

how would you connect a classic asp web application with a java component?

We have several classic asp web application that instantiates a visual basic 6 component, passes a (possibly huge) xml string, and gets back a (also possibly huge) xml string. This component is the only way we have to interact with the database. We are planning to rewrite this component using java. The idea is to left the rest of the ...

How to use glassPane to create transparent window?

Okay, so I want to make a Java JFrame that is transparent, but than has a the glassPane not transparent so I can make my own style of windows. can this be done? ...

Swing JFrame Responding to Native Window On Close Event

I have a Swing application which consists of a single JFrame set to Always On Top. When running under Windows, I use the following code to open the the native default email client and browser respectively: Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + Utils.formatMailtoUrl(to, subject, body)); Runtime.getRuntime()...

Using superscript in an Android textSwitcher

I can't manage to get my textSwitcher to be able to support superscript text. No matter what I try it shows up as regular size text. Here is what I've tried: Spanned span = Html.fromHtml("<sup>TM</sup>"); String subscript = span.toString(); mSwitcher.setText(getText(R.string.desc_about1) + subscript); Then I ...

How can i do a multiselect in jsp/jstl with selected value?

Hello I have an User with some Roles User.class public class User { private Long id; private String firstName; private String lastName; private Set<Role> roles = new HashSet<Role>(0); public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getFirstName() { return this.firstName; } pu...

Can InetAddress represent host names that can't be resolved?

I parse various data sources with network information in them. I have been using java.net.InetAddress to represent and parse hosts. It works fine being initialized with IP. I have to parse a new source now. It contains hostnames instead of IP's. InetAddress.getByName() throws UnknownHostException if a hostname argument can't be resolve...

Readding panel to layout after editing panel?

Hi, What I'm trying to do is dynamicly edit a panel and readd it to the (Border)layout. The panel contains textfields and I want the user to be able to add or remove textfields to the panel. What I tried is the following: remove the panel from the layout, add another textfield to the panel, readd the panel to the layout. However this do...

to copy the picture from a website into database automatically

How can i compare the Logo of a website to the logo available in my database just by entering the url to the particular explorer?do i need any plugins or it is simple enough? ...

Is there a way in Hibernate to obtain an entity's loaded PersistentCollection without loading the entire entity object first?

This is a puzzler! :D Is there a way to force Hibernate to load a collection for an entity without loading the entire entity first? Let m explain better. I have a Role entity annotated this way: @Entity(name="Role") @Table(name = "ROLES") @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) @javax.persistence.TableGenerator( name...

Get a page's last modified date using Java

Is there a standard way to tell when a page was last modified? Currently I am doing this: URLConnection uCon = url.openConnection(); uCon.setConnectTimeout(5000); // 5 seconds String lastMod = uCon.getHeaderField("Last-Modified"); System.out.println("last mod: "+lastMod); However it looks like some sites do not have a Last-Modifie...

When should we move to Maven 3?

Our project badly needs to move to Flexmojos4 to get a fix, but this requires Maven 3. Our project makes extensive use of Maven and we really love it, but have configured it very heavily. Between a dozen modules we probably have 50+ pages of XML configuration. We also use Eclipse and make heavy use of the M2Eclipse plug-in. We also...

Google App Engine - Can not find my logging messages

I can not find the results of my logging calls. To log messages I tried both: System.out.println("some message"); and Logger logger = Logger.getLogger("MyLogger"); // Logger is java.util.logging.Logger // ... logger.info("some message"); I have deployed my app and after few tests I decided check out some log messages. But ...

Java recursion: pass by reference

I realize this is a hotly debated, controversial topic for Java programmers, but I believe my problem is somewhat unique. My algorithm REQUIRES pass by reference. I am doing a clockwise/counterclockwise pre-order traversal of a general tree (i.e. n-children) to assign virtual (x,y) coordinates. This simply means I count (and tag) the nod...

Max number of dimensions in a Java array

Out of curiosity, how many dimensions of an array can you have in java. ...

From Maven, how do I run a class that lives under src/test/main ?

I have inherited a codebase :) Under src/test/java/ there's a file that I need to run (I need to run its public static void main(String[] args), not a @Test method within it). The closest I have got is: mvn -e exec:java -Dexec.mainClass="com.me.packagex.RunFile" -Dexec.classpathScope="test" but that then fails, and it appears to be ...