32,199 Topics

Member Avatar for
Member Avatar for nilay84

Can anyone figure out why the following code is not showing the menubar when it is run in eclipse. import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.*; public class MenuExample { Display display; Shell shell; Menu menu, fileMenu, editMenu,viewMenu; public MenuExample() { display = new Display(); shell = new Shell(display); shell.setText("Menu Example"); shell.setSize(300, 400); …

Member Avatar for FALL3N
0
374
Member Avatar for clapton

Hi. I'm a student and I need write a programe bank application in java . I must write a program that the customer could withdraw and deposit from his account.I need a few class? my professor said me that it's very simple but it's dificullte for me. you can help …

Member Avatar for stultuske
0
198
Member Avatar for jarograv

I currently have this code: [CODE]import java.util.Random; import java.io.*; public class randomdwarf { public static void main(String[]args)throws IOException { String dwarves[]= {"Dopey", "Sneezy", "Happy", "Sleepy", "Grumpy", "Bashful", "Doc"}; Random generator = new Random(); int randomIndex = generator.nextInt( 7 ); System.out.println(dwarves[randomIndex]); Runtime.getRuntime().exec("H:\\Profile\\Desktop\\dwarves\\Doc.jpeg"); } }[/CODE] It is a very simple code that …

Member Avatar for Philippe.Lahaie
0
186
Member Avatar for geojia

Hi gurus, this is a homework assignment on finding all closest pairs. I used a quad tree for my algorithm and its running time is compared to the naive algorithm. (I didn't use the java quad tree because I didn't know it existed...) My problem right now is that after …

Member Avatar for rubberman
0
216
Member Avatar for herious89

Hi im trying to calculate the constant e, this is my codes, the program doesnt output correct value, im new to java, please help [CODE]import java.util.Scanner; public class calculateE { public static long factorial( int n ) { if( n <= 1 ) // base case return 1; else return …

Member Avatar for rubberman
0
361
Member Avatar for freedomflyer

Hello everyone. I have a TreeSet<State> that I want to iterator over in order to change the States within the TreeSet (more specifically, a private subclass within each state). However, I will most likely run into problems as I do something like this, or something to this effect: [CODE]for(State s …

Member Avatar for freedomflyer
0
1K
Member Avatar for bcain2121

Hello there. I am writing a game in java for a class of mine but i am getting this bugger ass error and i cant find it. Can someone help me? The whole project including all classes and such is located in the .zip you can download. I swear it …

Member Avatar for JamesCherrill
0
285
Member Avatar for riahc3

Hey I am having problems making a exact copy of a file. It seems that it changes the headers of the file. I tried using the Apache fileutils copyfile method but it seems to change the header completely. The rest of the file looks pretty much OK. I think it …

Member Avatar for riahc3
0
235
Member Avatar for riahc3

Hey I have a FTP server with this [url]ftp://192.168.100.2/folder/[/url] And I have something like anotherfolder: afolderinsidethatone: file1.bin file2.bin file.txt I want to pass all of that to the ftp server so it takes this form: [url]ftp://192.168.100.2/folder/anotherfolder/[/url] [url]ftp://192.168.100.2/folder/anotherfolder/afolderinsidethatone/[/url] [url]ftp://192.168.100.2/folder/anotherfolder/afolderinsidethatone/file1.bin[/url] [url]ftp://192.168.100.2/folder/anotherfolder/afolderinsidethatone/file2.bin[/url] [url]ftp://192.168.100.2/folder/anotherfolder/file.txt[/url] I have this code: [code] public void subidaftp(String ip, String …

Member Avatar for riahc3
0
214
Member Avatar for hurrycart

Hello people. I'm designing a little app, and due to my lack of XP, I hope for some advices on how to deploy it. The App: It's simple Java app. There are many sub-functionalities" like: logging, sending a log via email, error handling, and others about XML technology. But to …

Member Avatar for stultuske
0
128
Member Avatar for 1bung100

I have an xml having same tags (<value> tag) as given below: [CODE]<number> <type>decimal</type> <value>12</value> <value>14</value> </number>[/CODE] I am trying to parse using either Digester or JAXB (without Schema). What I have done is I have created a java class that will map with the given xml. For this I …

Member Avatar for 1bung100
0
2K
Member Avatar for 47pirates

HOw can i private chat with logged in users from a group chat? HOw can i begin the proces?

Member Avatar for dantinkakkar
0
144
Member Avatar for liphoso

with integer arrays when i add them i can have code that looks like this result[0] = array[0] + array2[0] all the arrays being of integer type now if my arrays are of Huge type and i would like to get their sum, how would i do that? this is …

Member Avatar for stultuske
0
242
Member Avatar for konman795

Hello all, I have an assignment in which I need to subclass and implement an abstract method (java.io.OutputStream) to create an output stream called NumStream. The NumStream class converts digits to strings. We are given most of the code it seems and I need to only implement one area. It …

Member Avatar for ztini
0
231
Member Avatar for alreem

mr7b .. To calculate the value of e^x ,, I do this code but I THINK I have mistake . . ! Can any one tell me if it's true or not > ? [CODE]package calculate; import java.util.Scanner; public class Main { public static void main(String args[]){ double x, n, …

Member Avatar for ztini
0
2K
Member Avatar for sariberri

[CODE]import java.util.*; //You may assume that all Points are unique. public class PointSet { private ArrayList<Point> list; private Comparator<Point> compareMethod; //default constructor public PointSet(){ list = new ArrayList<Point>(); } //copy constructor for a point public PointSet(PointSet l){ list = new ArrayList<Point>(); for(Point p: l.list){ this.add(p); } } //randomly generating a …

Member Avatar for sariberri
0
895
Member Avatar for ladybro

Thanks for taking the time to open this. I am just starting to learn Java and cannot seem to get past a point in the program I'm currently working on. I'm making a credit card verifier, where you enter the numbers and an algorithm deems it valid or invalid. I …

Member Avatar for stultuske
0
152
Member Avatar for NicoleD90

I have to create a program that simulates flipping a coin. The directions my teacher gave me are as follows: 1. Program should prompt the user for number of runs 2. Program should prompt the user for the number of times to flip the coin in a single run 3. …

Member Avatar for NicoleD90
0
697
Member Avatar for iRamble88

[CODE=java]import java.util.Scanner; class Sum { private int value; public int get() { return value; } public void set(int sum) { this.value = sum; } } class Summation extends Thread { private int upper; private int lower; private Sum sumValue; public Summation(int upper, Sum sumValue) { if (upper < 0) throw …

0
172
Member Avatar for 09cody

I'm just learning Java, so please bear with my ignorance. I have a feeling (hope) that this question has a very simple answer, just one that is evading me at the moment. For our assignment, we have to write a boolean function that will take a given elephant, "e" (the …

Member Avatar for JamesCherrill
0
297
Member Avatar for gedas

Hey guys, what would be a neat why of geting every third token in the string. lets say there is a: String longString= "i want this"; how would i be able to get "this" ? Thanks

Member Avatar for JamesCherrill
0
1K
Member Avatar for MineCrafter

It keeps giving me this error and i really need help! [CODE] package net.minecraft.src; import org.lwjgl.opengl.GL11; public class ModelMrsMcDade extends RenderLiving { //The three numbers below change the size of your model (you'll need to change the hitbox size too though) protected void preRenderScale(ModelMrsMcDade entity, float f) { GL11.glScalef(1F, 1F, …

Member Avatar for JamesCherrill
0
580
Member Avatar for johang_80

Hello everyone I have a task of changing values in an int[][], for example if I input 1 it is changed to 0 and vice versa. So far I tried the following for a hundred times amending the xs and ys but with no happy ending. [CODE] public void reverseOrder(int …

Member Avatar for johang_80
0
191
Member Avatar for 47pirates

I have a server in python and client in java and i want to share images through the socket how can i do so? help plz

Member Avatar for dantinkakkar
0
167
Member Avatar for Stjerne

Hello, I've a question about DataOutputStream. I'm trying to complete this Pseudo-sentence: [CODE] public void writeObjectToFile( DataOutputStream output ) { < Writing data field values ​​to file. > } [/CODE] This is my code: [CODE] public void writeObjectToFile( DataOutputStream output ) { String filename = "test.dta"; try(output = new DataOutputStream(new …

Member Avatar for JamesCherrill
0
154
Member Avatar for vuquanghoang

I have done almost all things in my project. I think file SlList.java in my project has something wrong( in insert function). When I insert something in the middle of link list, I rest disappear although I link the rest to the next of the node I want to insert. …

Member Avatar for Philippe.Lahaie
-1
254
Member Avatar for divsok

please anybody can give me the access code for "Introduction to Java Programming, Comprehensive, 8/e" book if you've..

Member Avatar for StephNicolaou
0
111
Member Avatar for luskbo

Okay, been working on Android program and since its JAVA based, I figured this might be a place to get some good advice. I have been writing this program to run tcpdump, but for some reason it freezes and crashes. I am able to execute the shell commands, but after …

Member Avatar for luskbo
0
272
Member Avatar for artemis_f

Hello all, I am new to this forum. I think this will be an excellent place for learning things and I am looking forward to gaining more java knowledge. My current predicament is the ArrayIndexOutOfBoundsException I am getting on a program I have written. I haven't been able to figure …

Member Avatar for stultuske
0
1K
Member Avatar for adil_bashir

The End.