32,199 Topics
| |
ways to do random variables in array but not repeat , how i can do that? | |
[CODE] public boolean randomFlower() { Grid<Actor> gr = getGrid(); ArrayList<Location> loc = new ArrayList<Location>(); loc = gr.getOccupiedLocations(); int row = (int)(Math.random() * 19); int col = (int)(Math.random() * 19); Location new1 = new Location(row, col); boolean existent = false; // if i is less than size of occupied locations for … | |
Hey guys. I am currently just a 11th grade student but since I'm done the whole curriculum for my Computers class already, I recently just started making extra stuff for fun. One of things I'm doing is Making a graphical/visual sorting applet. Something like : [url]http://www.cs.ubc.ca/~harrison/Java/sorting-demo.html[/url] I have my code … | |
I am using Lucene Highlighter 2.4.1 for my application. I use the highlighter to get the best matching fragments, and display them. I make a call to a function String[] getFragmentsWithHighlightedTerms(Analyzer analyzer, Query query, String fieldName, String fieldContents, int fragmentsNumber, int fragmentSize). For example : [code=java] String text = doc.get("MetaData"); … | |
hi guys, i am planning to undertake a massive project which would be something to do with wii remote as i am aware the wii remote communicate with the console or computer via blue-tooth. i was wondering what sort of data wii remote sends back to the computer or a … | |
Hi, i am new to java, and i stuck in between with a folder locking problem. i want to create a private folder without encrypting the data, i have two options 1) Either Lock that folder so none of the user (even admin) can't access that private data. 2)Completely hide … | |
Hi Every Body! Please any body tell me, is java is so powerful to do system programming wih it like C language and Assmbly. | |
Hy, I have 4 combo-boxes and each one has a RefreshableValueHolder. If I change the value in one of them, I would like to automatically change contents of the others. I know I have to use the refresh() method of this class, but I cannot figure it out how. for … | |
Hi Everyone, I am a beginner with java, please pardon my stupidity The program below is not working and I have this error. Please let me know what I am doing wrong. public class test { public static void main(String[] args) throws Exception { String Month = "May"; if ( … | |
Hi, I have implemented a simple socket server in Java. Everything works great except the process just dies/times out after about an hour and I do not know why. I run am running the process through my web host's machine using SSH. My steps: 1. Add to '/etc/rc.local' two commands: … | |
Hello I'm new to java and i'm facing some problem... First code refers to File_Chooser class which works perfectly fine for me... [CODE]/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package statguis; /** * * @author Umar Ali */ … | |
I am new to java. when i try some code, i get the 'Caught ArrayIndexOutOfBoundsException: 0' message. i need help how to address the problem. the code was as follows. I am leaving out the class name (first line) [CODE]public static void main(String[] args){ try { double hours = Double.valueOf(args[0]).doubleValue(); … | |
[CODE] public class FirstJndi { public static void main(String[] args) { String name = args[0]; Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory"); try { // Create the initial context Context ctx = new InitialContext(env); // Look up an object Object obj = ctx.lookup(name); System.out.println(name + " is bound to: " … | |
Hello, I'm having a requirement to develop a GUI based JFrame which should have capabilities to add Multiple JPanel on an event occurrence[Ex. button click] and the JFrame should be scrollable. I tried a lot, but I failed. I also tried to add multiple Jpanel in JScrollpane that also failed. … | |
hi guys, i have this senario and i want know if that is possible. i want to apply some aspect-oriented concept. i want to have something like, say two classes. one extract some piece of data from xml file and use JSP to display the data. another class/aspect that log … | |
I have a school assignment where I have to write class files to correspond with my instructor's already written class, which includes the main() method. He has the main class importing the child class of a ParentClass, each of which is in a different package. In the main method, he … | |
Hi all, I have a JOptionPane with a YES button and a NO button. All I want to do is be able to press the left or right button on the keyboard to change the focus on the buttons. By using the mouse it works. Is there some kind of … | |
I have a method that takes in a rectangle shape as a parameter, uses it as a selection box, and finds shapes in an array called shapeObjects that are within the bounds of the selection box. The indexes of those shapes are then added into a new array which is … | |
Hi, I am currently working on curling game for my High School assignment and i have lots of files of code, so i doubt anyone will want to look through them. Im having an issue in which, i have a JPanel and when i call the paintComponent (Graphics g) of … | |
Hi guys; Am stuck on the following piece of code which is meant to delete obsolete files in a directory in an sms server. It runs well from a windows platform on which it was coded in, but can not run from a linux platforrm correctly. On the linux lastmodified … | |
I am using a Multi column JTextPane. Everything is working fine but I also want to add some space after each column in JtextPane to improve the readability of the text in the Jtextpane. In my current project, it is unable to differenciate between text of two columns. I am … | |
[code]package taskvip; import java.util.Random; public class Main { public static void main(String[] args) { int y =0; Random t =new Random (); fun1 e = new fun1(); for ( e.i = t.nextInt(50); e.i < 100; e.i++) { e.A[e.i]= e.k.nextInt(50); y=e.k.nextInt(); } for ( e.i = 0; e.i < 100; e.i++) … | |
For my Programming class I have to write a program to get the Date and time from a Daytime protocol server. If you don't know, the format for the Daytime protocol is as follows: [code]JJJJJ YR-MO-DA HH:MM:SS TT L H msADV UTC(NIST) *[/code] YR being the last two digits of … | |
[code]import java.io.*; public class BaseTransform { private final BufferedReader buffer=new BufferedReader(new InputStreamReader(System.in)); public BaseTransform(){ try{ System.out.print("Enter any integer: "); int input=Integer.parseInt(this.getInput()); System.out.print("Enter a base[2...16]: "); int base=Integer.parseInt(this.getInput()); String answer=this.transform(input,base); if(answer!=null){ System.out.println(""+input+" at base "+base+" is "+answer+"."); }else{ System.out.println("Error!"); } }catch(Exception e){ e.printStackTrace(); } } public static void main(String args[]){ BaseTransform … | |
Hi, I am building a searchengine which searches some html and text files in the web directory. I was trying to use lucene. I was able to index the file and query a word and get the documents which contains that search word. But the problem i was incurring is … | |
This button will only appear if you move your mouse over it. See here: [url]http://mitch9654.zymichost.com/Java/index.html[/url] You hava to move the mouse around the top left my applet is this [code] /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package … | |
I realize this is an extremely low level java problem, but I've been searching and searching and I can't figure out a way to take two characters and combine them into one string. Particularly, I have a char array and I need to take two particular elements out of it … | |
| Hi, I'm trying to get Java to remove a JLabel from a JPanel whenever a button is clicked. Unfortunately it won't do this. I've tested my code and the button click is working for sure, so its the code to remove the component that is acting up. If anyone could … |
I want to develop a landscape design layout tool. it would be a CAD program of sorts but would need to look more aesthetic. at the end of it, it would need to look almost hand drawn. trouble is I am a bit of a noob having only developed a … | |
Im trying to run my java application, but after some time it automatically stops and throws OutOfMemoryException: Java heap space. Now when i try to run it using (say) (-Xmx allocates the maximum heap memory) java -Xmx2000m [AppName] then it says Error occured during initialization of VM Could not reserve … |
The End.