Forum

Posts

RECENTLY INDEXED PROGRAMMING SOLUTIONS OF Java


Checking if something is equals to anything in an array  

My code so farimport java.util.Random; Java Code: class Test{ public static void main(String[] args){ Random Attack = new Random(); int rud = 0; int rod[]={2,5,4,3,6}; for(int... Continue Reading
Views : 44
Thursday 25th of October 2012

Customising GUI in netbeans  

Hi, I have been trying to use a jLable to import picture of buttons and then use the events to make it act more like a button, however since the resolution of the text on the button is very bad when I try to import it into netbeans then I have to extends the Jlabel class that has a... Continue Reading
Views : 26
Thursday 25th of October 2012

Hashset and Custom Objects problem! Wont add! :(  

Hi, I am trying to add custom objects to a Hash Set. However, every time I try to print out the elements added, it only shows the last element as having been added :S I have two problems:1. Custom objects wont add properly to my Hash Set2. How do I access... Continue Reading
Views : 68
Thursday 25th of October 2012

constructor question  

Class A contains the following line Java Code: AssignVariablesDC3 p = new AssignVariablesDC3(12); mh_sh_highlight_all('java'); ... Continue Reading
Views : 29
Thursday 25th of October 2012

I have created a Java Chat Server, now where do i put it  

Hello, this is my first post on this forum.Using NetBeans i have created a Java desktop application, a ChatServer, i packed the classes in a jar file and if i launch it on windows i can see the JAVA GUI opening and tracing all the incoming connection. The client is made in Flash, i have... Continue Reading
Views : 48
Thursday 25th of October 2012

How do you store a random integer in an array  

I have a program which requires me to randomly generate 25 integers from 0-99 using an array. I don't really know where to start. I thank anyone who helps me. , i done this before.hope this may help you. Continue Reading
Views : 36
Thursday 25th of October 2012

Trying to calculate cost based on size  

So I have my main VendTest Java Code: public class VendTest{ public static void main(String[] args) { Vending v = new Vending(); v.turnOn(); v.calcCosts(); v.turnOff(); }} Continue Reading
Views : 34
Thursday 25th of October 2012

problems with print statement  

The output that I want is thisThe out put should look like this: * The grade at index 0 is ___ * The grade at index 1 is ___ * The grade at index 2 is ___ Java Code: Continue Reading
Views : 30
Thursday 25th of October 2012

Mersenne twister random generator  

Hey, I found a mersenne twister algorithm but I have no idea who to use it in my program to generate a number from 0-100. Is it used like the default java generator of java?Like: public static int RandomIntNumber() { Random gen = new Random(); Continue Reading
Views : 29
Thursday 25th of October 2012

How do i make a bunch of arrays into a list  

When i sort it now the list comes out like this [1,2,3,4] how can i change it so the output comes out like this? 1234 Heres the code i have so far if it helps. Continue Reading
Views : 34
Thursday 25th of October 2012

Trouble working with/calling Objects! Any Help  

Hi,I finished the code for an assignment and am having some trouble making the code compile. It is giving me all kinds of cannot find symbol errors. In what may very well be related, when I pop the top value of my stack, it tells me that the package theStack does not exist. Continue Reading
Views : 67
Thursday 25th of October 2012

Fibonacci sequence  

Hi I have a problem with the following code which is when I enter some of Fibonacci sequence numbers it gives me the numer is not in sequence e.g. if I enter 2,3, or 8 it gives me not in sequence although they are in sequence but if I enter 1 or 5 it gives me in... Continue Reading
Views : 24
Thursday 25th of October 2012

How to cause a second prompt to run after the first.  

I am working on an assignment for a first year Java course. For the program I am writing, I need to be able to ask the user for a card (as in deck of cards) size, and then ask them for a card suit. The program will then draw out the card suit in *'s. The printing is not my problem. This is the... Continue Reading
Views : 36
Thursday 25th of October 2012

Number formatting  

OK. Here's my problem. I'm making a program that takes the first twelve digits of an ISBN, calculates the last digit, and then adds hyphens. I realize that the placement of hyphens varies depending on the particular ISBN, but my teacher is an idiot. I haven't finished the program yet, so a... Continue Reading
Views : 22
Thursday 25th of October 2012

what's wrong here   

hi, i m just trying to find a name from Array by using scanner..no error here, but not showing although its there... Java Code: String[]... Continue Reading
Views : 17
Thursday 25th of October 2012

Need some help  

Hi Every one, i am learner for development field i know some basic of Java and executed some program using Java (maximum UI creations and little of back-end works) so when when these projects were going on my guide and manager said that your are hard coding the so learn how to code... Continue Reading
Views : 58
Thursday 25th of October 2012

newbish question  

Good evening, Suppose, there is a file that has 1 line Java Code: TAGS = 107,35,75,88 mh_sh_highlight_all('java'); Suppose there... Continue Reading
Views : 27
Thursday 25th of October 2012

To take a benefit by all, i have an important question  

For the benefit of all people here in the forum,i have a very important question, I dont understand the Clone(Clonable) interface at all,,,Can any1 wriite a short example so that we can understand this interface. I google it , it gives hard examples.... Continue Reading
Views : 42
Thursday 25th of October 2012

Help with regex  

I have a program in which i'm creating TelephoneNumber objects which have ints areaCode exchangeCode and number. I'm using a regex to make sure that the input is an actual phone number. I want to know if there is a way to use a back reference to assign the first three numbers to areaCode, the... Continue Reading
Views : 26
Thursday 25th of October 2012

Help with 2D Arrays.  

Im going to have two seprate 2D arrays. I know how to add the rows of a 2d array and i know how to add the columns of a 2d array, but i dont know how to do this. There are TWO 2D Arrays. I need to add the index of the first 2d array with the same index of the other 2d array, etc.... Continue Reading
Views : 7
Thursday 25th of October 2012

Message processing - what's a better way  

Support you need to consume this messasge and pick up a tag 107. 8=FIX.4.49=64235=X49=CME52=1269878006469107=ZTZ048 ... Continue Reading
Views : 16
Thursday 25th of October 2012

how to set application icon  

how can i set application icon?? Continue Reading
Views : 44
Thursday 25th of October 2012

change color on mouse click  

Someone please help. I need to write a program that sets the background of a panel as black when the mouse is clicked and white when the mouse is released. I have a TrackMouse program but it just tells if it's in the panel or outside and if it's pressed or dragged and the coordinates. I'm not... Continue Reading
Views : 39
Thursday 25th of October 2012

String regioMatches help  

System.out.println("x123455".regionMatches(0,"x1", 3,2)); //-?? how to make it return TRUE !!!!!!!!!!!!it keeps returning false !! anybody can help me ,, to explain thsi Continue Reading
Views : 32
Thursday 25th of October 2012

string prompt doesn't appear in showInputDialog  

I have the following code... newSpecialAbilityName = (String) JOptionPane.showInputDialog(parentGUI, "Enter name of Special Ability to add.", "xyz", JOptionPane.PLAIN_MESSAGE, null, null, ""); The result is a dialog box that doesn't display the string, "Enter name of... Continue Reading
Views : 27
Thursday 25th of October 2012

Mac JavaWebStart App problem (works Windows, not MAC)  

I have a JAVA GUI App deployed using JWS. It works on all Windows Machines I try it on, however, when I try it on some peoples MACs it won't start and I get: javax.swing.drop mode:no class def found But it only happens on a few peoples MACs, if I go to best buy and try... Continue Reading
Views : 34
Thursday 25th of October 2012

Why isnt this working  

int foo = 10.9 + 2112 / 100 % 2 - 2; , Try changing 'int' to 'double'. , Hi, this refers to type casting. You can cast type int to double, but reverse not, because it will lose precision.... Continue Reading
Views : 31
Thursday 25th of October 2012

2d Arrays Code help!  

Im trying to make code where there are 2, 2D arrays, that the user can choose to add together or subtract. Right now, im jsut trying to get the user input to work, but im getting a lot of errors. What am i doing wrong? Continue Reading
Views : 80
Thursday 25th of October 2012

Apple Items  

Below is what I have to complete, and the program is what i have done so far. I am having problems with the red items. Can someone let me know what might be wrong and di I have everything I should! Thank you in advance! 1.-Need to write the exact same program.C. Write a... Continue Reading
Views : 8
Thursday 25th of October 2012

Executing two threads simultaneously.  

Hello, I have two threads and I want to execute them simultaneously. This is my code: Java Code: public final class MainClass { public static void main(String[]... Continue Reading
Views : 57
Thursday 25th of October 2012