32,199 Topics

Member Avatar for
Member Avatar for winecoding

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); …

Member Avatar for JamesCherrill
0
164
Member Avatar for jayyzhao

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?

Member Avatar for NormR1
0
59
Member Avatar for ferretfool0x77

[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, …

Member Avatar for skoiloth
0
237
Member Avatar for gedas

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

Member Avatar for katarey
0
76
Member Avatar for gunjannigam

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]

Member Avatar for gunjannigam
0
7K
Member Avatar for coco24

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.

Member Avatar for JamesCherrill
0
79
Member Avatar for w0ot28

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...

Member Avatar for javaAddict
0
175
Member Avatar for perlsu

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.

Member Avatar for mubin_89
1
4K
Member Avatar for m1n1m3

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 …

Member Avatar for NormR1
0
213
Member Avatar for aanders5

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 …

Member Avatar for aanders5
0
357
Member Avatar for kweigand

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 …

Member Avatar for kweigand
0
172
Member Avatar for haripriyamca05

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.

Member Avatar for Ezzaral
0
65
Member Avatar for neeraj goswami

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 …

Member Avatar for NormR1
0
119
Member Avatar for sohiabmaroof

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" …

Member Avatar for sohiabmaroof
0
2K
Member Avatar for tehhax0r

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 …

0
93
Member Avatar for houghton220

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 …

Member Avatar for houghton220
0
323
Member Avatar for java.util

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 …

Member Avatar for javaAddict
0
1K
Member Avatar for Majestics

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.

Member Avatar for Majestics
0
113
Member Avatar for Duki

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 …

Member Avatar for Duki
0
118
Member Avatar for TigerTeck

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 …

Member Avatar for mrjillberth
0
120
Member Avatar for Majestics

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.

Member Avatar for Kyberium
1
270
Member Avatar for nickh2o

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. …

Member Avatar for nickh2o
0
6K
Member Avatar for sirlink99

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 …

Member Avatar for sirlink99
0
263
Member Avatar for sirlink99

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 …

Member Avatar for Ezzaral
0
112
Member Avatar for SasseMan

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 …

Member Avatar for mKorbel
0
5K
Member Avatar for bibiki

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, …

Member Avatar for bibiki
0
104
Member Avatar for Dmiller071

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, …

Member Avatar for Taywin
0
189
Member Avatar for saman.aghazadeh

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 …

0
96
Member Avatar for Gandrew

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 …

Member Avatar for JamesCherrill
0
197
Member Avatar for loserspearl

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 …

Member Avatar for Ezzaral
0
310

The End.