32,199 Topics
| |
I happen to read the following code segment from Thinking in Java [CODE]public class PetCount3 { static class PetCounter extends LinkedHashMap<Class<? extends Pet>,Integer> { public PetCounter() { super(MapData.map(LiteralPetCreator.allTypes, 0)); } public void count(Pet pet) { // Class.isInstance() eliminates instanceofs: for(Map.Entry<Class<? extends Pet>,Integer> pair : entrySet()) if(pair.getKey().isInstance(pet)) put(pair.getKey(), pair.getValue() + 1); … | |
Hi Guys, I have a entry that uses keyboard.nextInt() is there a way to limit what it accepts and if its not right return a text string? I have tried using If and else statements for some reason they don't seem to be working. Any ideas? | |
[CODE]try { dataFile = args[0]; } catch (Exception e) { System.out.println("The file was not found. Please input file name now: "); dataFile = scan.nextLine(); }[/CODE] This gets a file name from the command line, and if no file is specified it asks the user to input a file name, however, … | |
hey guys i need java code that would convert .csv files to .xls. has anyone got any examples or anything similar? any help will be appreciated. thanks | |
I am attaching my complete code, which I was currently developing. I am not able to get why doesn't my KeyListener work. None of the KeyListener events are fires on pressing the keyboard. Please have a look and tell me the flaws in my code [ATTACH]22414[/ATTACH] | |
Hi, im trying to move an object that moves only with the user input. For example if i type in 45, it will move 45 spaces. How would I go about doing that? Thank you for your time. | |
please help me... i will make Family Feud game in java... i dont know how will i start my project... T_T.. please help... give me some ideas... please... | |
Can anyone help me to get the estimate value of float value 1001.27124 to 1001.27? Math.round(float) function return the int value. But I want to get float value result with 2 decimal point; Thanks in advance. | |
Hi ! To improve my java programming skills i like to write a really fancy fib. nr. calculator. Did it in C using memory allocation methods and hot to 1M digits in ~10min. So something like Step-Up challenge. The only thing as far as i can see limits my progress … | |
Trying to read a list of numbers in from the arraylist, and stick em into a matrix of int[][] int[][] board; board = new int[row][col]; ArrayList<Integer> temp = new ArrayList<Integer>(); so those are my two variables, and i have a for loop with variables, i and j...so I am trying … | |
First off, I am a Java Noob coding in latest version of NetBeans. I am trying to create a program the will allow the user to enter two decimal values: time and earnings in a swing GUI. [B]Basic Flow[/B] [LIST=1] [*]The user will enter the values in two different text … | |
hai guys, see for example i have 15 banks details to print as pdf. but i wanted it to be printed only 6 banks per page. i have to get 3 pages for this 15 banks as 1-6 , 6-12, 12-15 respectively. Give me the suggestions to do it. | |
i am writing one java code in notecode.once i am compling the code in command prompt it is showing the following error: javac is not recognised as an internal or external command ,operable program or batch file. what does this mean?..i am using jre7 java version.i have also specified the … | |
hi all m having problem deleting table row from button in jtable .here is my error when i press on delete button this code is similar to my original code . please i need immediate feedback m stuck in this error from days.this is the error [code]Exception in thread "AWT-EventQueue-0" … | |
I have an assignment for a class i'm having trouble with heres the prompt: Research reports are required to conform to a given standard (e.g., APA, MLA). These standards specify rules such as the size of the margins, formats for titles, paragraphs, references, page numbers, etc. Consider a program that … | |
Hello: We get the following message when we boot up our Windows Vista laptop, along with it popping up at any time at all when we are using the computer. This is what it says: Java Virtual Machine Launcher Could not find the main class:com.anabel.pp.JettyPersonalizationServerMain.Program will exit. Any help in … | |
Hello, I have written a program for an assignment and all was working well, I tested everything and all that was left was to put in a few error-messages. Then, I changed the format from ISO to utf-8 and when I tried to run it again it suddenly stops at … | |
I want to create MouseListener library from scracth... Its just a assignement ... I have no idea to develop a thing in which i cant use that api directly from java... Please Help. | |
When I debug this method, I can clearly see that currentNode = Workstation, so I am puzzled as to why I'm still entering into the "Node" buffer print, rather than the "Workstation" buffer print. Shouldn't polymorphism handle this for me?: part of Node Class [code=java] public void printToBufferAsHTML(Network network, StringBuffer … | |
objective: Write a class Bug that models a bug moving along a horizontal line. The bug moves either to the right of to the left. Initially, the bug moves to the right, but it can turn to change its direction. Provide a constructor. All methods are included below. [CODE] public … | |
how to move a jframe which has no taskbar? [code] frame.addmousemotionlistener(this); public void mousedragged(MouseEvent e) { // What to write here } [/code] I tried setBounds of jframe but it flicker when we try to move the frame. | |
need help to making change I have read textbook a lot but i still dont know what to do next steps. Here is problem. The program should prompt the user for and accept two inputs: 1. The price (including any applicable tax, etc.) for whatever was purchased by the customer. … | |
I am trying to do basic animations with images, and I am wondering how I could get a smaller image from a larger one without going through and editing it. I made a sprite [URL="http://translate.google.com/translate?hl=en&u=http%3A%2F%2Fwww.famitsu.com%2Ffreegame%2Ftool%2Fchibi%2Findex1.html"]here[/URL] and downloaded the image. As you see in the thumbnail the animation is from all … | |
I am taking data management this year, and we are currently learning about matrixes. I know they are used to encrypt things, and the teacher even used it as an example. my problem is the following. We are only learning how to encrypt and decrypt using a 2x2 matrix. That … | |
Hello! I've made a custom JPanel that overrides paintComponent which paints a rounded rectangle. My problem is that when I place other components in the panel, like a JLabel, they don't get rounded corners like the panel they are in. here is my panel class: [code] private static class BackgroundPanel … | |
Hey there, I am aware of GridLayout, BorderLayout and FlowLayout classes. However, I find them not to work satisfactorily well for me when trying to layout the entire content in a frame. What I usually do is this: I identify parts that I want in my window. For each part, … | |
Hi all, I'm coding Conway's Game of Life for my Java class and I've run into some logic errors. My problem so far is the fact that I have a section of code that looks similar to this: [CODE]if(board[i][j+1].getLife() == 1) board[i][j].setNumNeighbors(1); //Where setNumNeighbors(int n) { numNeighbors +=1} }[/CODE] etc, … | |
I'm using Ehcache beside Hibernate. I need a cache manager in my project that could do these things below: 1- I wanted to refresh some caches 2- I wanted to remove some caches I will be happy if someone can help me and also guide me how to make a … | |
Soo my program is working...but there is just one problem...null is also being printed along with the content or string from the file... is there anyway i can stop null from being printed. The code read asks a user to give a filename .txt then the user is asked a … | |
| I'm trying to create a java applet that displays farhen and cels temperatures in a chart. Temps below freezing need to be displayed in blue, and about boiling displayed in red. It needs to use applet graphics to draw the strings in different colors but I'm fairly lost when it … |
The End.