JFrame with custom border not showing controls
I'm trying to make my own custom border, and I have done this through overriding the paint function in the JFrame. The problem which I have run into, is the fact that paint is being called after the …
JTextArea not updating dynamically
I have a JTextArea inside a class that I want to update dynamically. Currently it is only displaying the text I append to it after all the processing is done. I have tried to implement the following …
Creating a ConcurrentHashMap that supports “snapshots”
I'm attempting to create a ConcurrentHashMap that supports "snapshots" in order to provide consistent iterators, and am wondering if there's a more efficient way to do this. The problem is that if …
Health for each enemy
as my game progresses the enemies get stronger. To make the enemies stronger I made a private int called thealth (probably a bad programming choice) and each time the sprite is touched thealth--; ...
how to have an external Jar or windows .exe made from an external jar download a file from the internet and write to the hard disk?
Is their any external libraries that do this well and are easy to implement? I've searched the forums and can't find much on this subject. (Java) I am most concerned about writing to the hard disk
How to implement interfaces with homographic methods in Java?
In English, a homograph pair is two words that have the same spelling but different meanings. In software engineering, a pair of homographic methods is two methods with the same name but different …
Convert arithmetic string into double in Java
I have a program where the user inputs 6 doubles, and the program outputs every combination of operators that can go in-between the doubles as 1024 separate strings. Here are the first two results if …
Can't get value of Map<BigDecimal, String> by key
I have a map like Map<BigDecimal, String> functions = new HashMap<BigDecimal, String>(); When I try to access the value of map from a JSF page, it displays nothing. I checked the size …
Implementing API keys for my API
I have created and api and i want to have some control over who use it, how often etc. I want to have a API key strategy so that the users must provide the key in order to use the API. However i don't …
Difference between List, List<?>, List<T>, List<E>, and List<Object>
What are the differences between List, List<?>, List<T>, List<E>, and List<Object>? Now I do not blindly ask this question, so please don't close this thread. Let me first …
JSF SelectOneMenu get Entity
I am trying to obtain a Customer entity from a JSF SelectOneMenu component: The classes I have are as follows: Customer Entity @Entity @Table(name="CUSTOMERS") @NamedQuery(name="Customer.findAll", …
How to sort a large text file's data into a multi-dimensional array?
I have a very large data file. It starts off with a big paragraph that I want to ignore or remove from the equation, then it has a year e.g. 1974, then 6 spaces, then a number to represent a month, …
Binary search tree and in-order traversal
I am trying to quickly implement a Binary search tree in Java. What is the best class to use that has methods for in-order traversal? (I have heard of TreeMap class. But it looks like the class does …
Java XML Reading an XML file from top to bottom
I want to read an XML starting from the top to the bottom using Java. However, I don't want to use recursive functions because I want to be able to jump to a different element and start reading from …
Why am I getting a ClassNotFoundException in a java application?
I am getting an error that states, java.lang.NoClassDefFoundError: usemathobject/Main and I'm not sure why I'm getting it. After doing some searches, I found a thread that deals with this error. In …
gitignore apikeys in my project
I want to make an java application. This is stored on gitHub (so uses git for versioning). Now this programm uses apikeys in example from Google. I want to hide this Api key in the versioning system …
How i can exclude a string when using comparator
Present i am using Comparator to sort my objects .I have the items in list as follows FIRST ITEM SECOND ITEM THIRD ITEM LAST ITEM FORTH ITEM Comparator code is: public static ...
ClassNotFound exception
public class dummy { public static void main(String[] args) { System.out.println("hello world"); } public void init() { //"dummy2" class defined in a different jar dummy2 d = …
JDBC connection does not run with .jar file, but with eclipse project
I'm really looking at a mystery here. I created a Java program in Eclipse and established a JDBC connection. The code is the following: import java.sql.*; public class login { public static ...
Hiding API keys used in an open source application
I'm currently developing a desktop application based on a 3rd party web API, and have registered for their program and been given two access keys in return. However, if pasting these keys as strings …
How to check if there is at least: two letters, one number and one special character?
How to check if there is at least: two letters, one number and one special character in java? Here is my code but I dont know if I'm in the right direction. public static boolean validarCodigo(String …
gettext-commons per-request locale in servlet
The gettext-tutorial states that The preferable way to create an I18n object is through the I18nFactory. The factory caches the I18n object internally using the the package name of the provided …
What triggers a Firewall to block a TCP Socket?
I was wondering what would cause a Firewall to block a TCP Java Socket from connecting. What would trigger that? Thanks!
How to safely convert from a Collection of generic types to an array?
For various reasons I want to convert a list to an array, however the Collection contains objects that are themselves generics. I have tried the following four options to get it to compile without …
Eclipse Always Re-Indexes Repository in Android
When I'm working in android, at the very bottom-right corner of my Eclipse window, it reads, "Re-indexing repository" whenever I save a file. When this is enabled, Eclipse runs very sluggishly, and it …
Why my JTable isn't showing?
Guys I have a problem with my JTable, my JTable(tblLivro) which contents should be the result(ArrayList) of my query (working) , but when I try to put the rsult in my jtable it just doesn't work, it …
Can i insert a some code in HTML to set android wallpaper
This would be my first post ever on stackoverflow.com I have found many many of the answers to my questions but this one question i cannot figure out. I know that it is possible to invoke few android …
Predict a file hosting url?
I have a program that will type the mediafire URL that you can download it from. The only problem with this situation is that I can't really know the url from which to download the program from until …
How to put data into HashMap<key, Object>
I am a new to programming. I have a program that iterates excel file and put values into hashmap HashMapbut object in a hash map is always has last record. I'll post my code and may be you can tell me …
Accessing a returned value from a different case
Hi It's the 3rd time i'm posting this question on this forum and up to now no one has been capable to enlighten me about this situation. I only pasted the code that matters here and will try to ...