32,199 Topics

Member Avatar for
Member Avatar for skyzer

So i've found an example of how to use Semaphore and made my code into there for Readers-Writers problem. What it must do, that it has 1 book, only 1 writer can write a new line there and while he is writing, no1 else can access it. When writing is …

Member Avatar for moutanna
0
2K
Member Avatar for charlieruns

I am trying to read all the files in a folder and for some reason it keeps reading only 1 file over and over again... [CODE]private void openFile() throws IOException { status.setText("Adding Photos"); File file; JFileChooser fileChoose = new JFileChooser(new File("charlie/photo/")); int success = fileChoose.showOpenDialog(this); if (success == JFileChooser.APPROVE_OPTION) { …

Member Avatar for charlieruns
0
97
Member Avatar for charlieruns

How can you get a JList to simple display a one word string. I know the method of JList.setListData(Object[]); I have an object[], but it is multiple lines of information and it looks weird in the list display. How can I get an Object[] to simply display the first line …

Member Avatar for charlieruns
0
82
Member Avatar for AcidG3rm5

Hi need some help to separate my string. I'm reading my text from file. The format is "name,1,2,3" What i need to do is to seperate out the entire string to: String name = "name"; String one = "1"; String two = "2"; String three = "3"; The commas are …

Member Avatar for AcidG3rm5
0
109
Member Avatar for rahulmaurya

i wan to create the setup file of our java project, if it possible plz help me

0
39
Member Avatar for hajjo

paths = [ "nodeA1", "nodeA1/nodeB1/nodeC1", "nodeA1/nodeB1/nodeC1/nodeD1/nodeE1", "nodeA1/nodeB1/nodeC2", "nodeA1/nodeB2/nodeC2", "nodeA3/nodeB2/nodeC3" ] you have list of strings there. how can i create a tree by system.out.println from all those paths. nodea1 ----nodeb1 -----------nodec1 -------------------noded1 ------------------------------nodee1 -----------nodec2 -----nodeb2 -----------nodec2 nodea3 -------nodeb2 ------------nodec3

Member Avatar for moutanna
0
135
Member Avatar for sarath.koiloth

Friends, I am stuck here , I am downloading some files from a url uing GZIPInputStream.I need to store this files.So i declared a bytearray with specified length.As i am downloading files with different size, i think i need to declare a dynamic byte array. Please help me to solve …

Member Avatar for javagrendel
0
141
Member Avatar for Stefano Mtangoo

Hi, How do these relate and differ? I see them Used with queries but cannot understand. I'm just starting JDBC. Sorry if it is noobish ;)

Member Avatar for masijade
0
275
Member Avatar for AcidG3rm5

Hi all, am writing a programming for my assignment. Got stuck in my codes for a small portion. Currently i have trying to extract all the alphabets within a string and cover them to an ascII. For example: I have a string "1a2b3c" What i need to do is to …

Member Avatar for AcidG3rm5
0
104
Member Avatar for redleafrose

hi I m working on this assignment...base class employee sub class staff .now i have to Create a StaffDriver Java program that: a. creates two staff objects b. prompts the user to enter name, id, hours and rate for each object c. compute the pay for each object d. displays …

Member Avatar for wildplace
0
93
Member Avatar for tanha

Hi everyone, I am using Ubuntu 7.10, and I have Java and MySQL installed with the command line as follow: 1. sudo apt-get install sun-java6-jdk 2. sudo apt-get install mysql-server and my JAVA and MySQL are working well, but now I want create connection between JAVA application and MySQL using …

Member Avatar for peter_budo
0
223
Member Avatar for IOwnAndPwnU

Hi, I have been working on a ScrollPane and I need to increase the increments (when you press the up and down arrow), and also make it respond to a mouse scroll wheel. The code I have (one screen in a CardLayout) is: [CODE]public void instructions () { resize (800, …

Member Avatar for quuba
0
111
Member Avatar for softdev

hi, looking at this example code: [CODE] public void writeList() { PrintWriter out = null; try { System.out.println("Entering try statement"); out = new PrintWriter( new FileWriter("OutFile.txt")); for (int i = 0; i < SIZE; i++) out.println("Value at: " + i + " = " + vector.elementAt(i)); } catch (ArrayIndexOutOfBoundsException e) …

Member Avatar for JamesCherrill
0
95
Member Avatar for runee1000

[CODE] import java.awt.*; import java.awt.geom.*; import java.awt.event.*; import java.applet.*; import javax.swing.*; //need this for the timer to work. ///public class DoubleBuffering extends Applet implements MouseMotionListener class Ship { private int xpos, ypos, height, width, speed, xdir, ydir; private Ellipse2D.Double c; public Ship(int x, int y, int w, int h, int …

Member Avatar for quuba
0
877
Member Avatar for miotvsingtel

For those who understand El Gamal signature scheme . U may have known the verification process of the signature : y^a *a^b (mod p ) = g^M (mod p) We have to compute both side of the equation. If they are equal, the signature is verified. but i have issue …

Member Avatar for quuba
0
275
Member Avatar for student.09

I am new to java, taking an intro to java class, my grade is on the border line, need major help! I'm having a lot of trouble getting this program to work. I have written the entire program, but clueless of how to overcome these errors; program needs 2 be …

Member Avatar for wildplace
0
535
Member Avatar for lilpinay

write a program that computes the nth root of a number. given a real number X greater than 1 and less than -1 and given an integer Y, compute the nth root Z such that Z*Z*Z*Z*Z*Z*Z...(Y times)..Z*Z=X, or Z^y=X(Remember if X is negative Y must be odd.) The user enters …

Member Avatar for JamesCherrill
0
171
Member Avatar for gjames

I have two questions that are Eclipse and Mac OS X specific. Question 1: Referring to eclipse preferences > java > Installed JRE's > Execution Environment: Can someone explain the [ execution environment's ] and compatible [ JRE's ]? I'm interpretting this as the execution environment being the JVM eclipse …

Member Avatar for gjames
0
156
Member Avatar for fiveseven

Hi, I have been making a checkbook program for my final project. When I run my program and try to read a file into my array, it is giving me this error: Exception in thread "main" java.lang.NullPointerException It is pointing to this specific line: balance = myRegister.alterRegister(checkBook[i].getAmount()); I'm not sure …

Member Avatar for jwenting
0
670
Member Avatar for ceyesuma

Hello Can someone get me started in the effert to fix this SQL statement to be excepted to create a table in a derby embeded db? [code] public boolean createTables(Connection conn) throws FileNotFoundException, IOException { System.out.println("in createTables:"); boolean createdTables = false; Statement stmt=null; try { String thisTable=ModelUtils.getXMLResource("createAdminTable"); System.out.println("thisTable sql String: …

Member Avatar for ceyesuma
0
334
Member Avatar for BobbieJean

I've got this applet to build with no errors but then I try to run it and when I click the button in the applet, nothing happens...at least, not in the applet. Instead, jGRASP gives me all this stuff and I don't understand a bit of it: ----jGRASP exec: appletviewer …

Member Avatar for ragedsparrow
0
222
Member Avatar for ghostrida45

My program complies fine but whenever I run it the applet loads but its blank and at the bottom it gives me Applet Not Initialized. I have no idea whats causing this if someone could help me out would be greatly appreciated. The Errors im getting are: [QUOTE] at javax.swing.ImageIcon.(init)(ImageIcon.java:167) …

Member Avatar for BobbieJean
0
253
Member Avatar for mozly

I followed a tutorial and built my own little program but get this message: Exception in thread "main" java.lang.NullPointerException at javax.swing.ImageIcon.<init>(Unknown Source) at Gui.<init>(Gui.java:27) at appls.main(appls.java:6) What to do? Here is my code btw [CODE]import java.awt.FlowLayout; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JFrame; import javax.swing.JButton; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JOptionPane; …

Member Avatar for mozly
0
83
Member Avatar for debargha

i am facing problem while taking input via...JOptionPane.showInputDialog()....plz tell me what package i have to import for it.....:rolleyes:

Member Avatar for masijade
0
92
Member Avatar for skiracer

Hello, I am making a program that calculates factorial and summation. I ask the user what they would like to do, then ask them to enter a whole number. The program I wrote has loops, so if the user wants to do this again, they can. When I do the …

Member Avatar for mozly
0
74
Member Avatar for Pyro197

ok, so i have a problem to do in java that i just can't seem to figure out. here is the problem: Write a Java program that prompts the user for how many individuals they will be entering. Then program will then prompts for each individuals name and account balance. …

Member Avatar for mozly
0
126
Member Avatar for beckveg

Hello everyone I want to run a .jar file, but the only way to run in my computer is with the "java -jar file.jar ", but the problem is that the application conects to a mysqldatabase, when I want to add something in the program appear a message that say …

0
117
Member Avatar for smith32

[CODE]File tempFile = new File(fw.getAbsolutePath() + ".tmp"); BufferedReader br = new BufferedReader(new FileReader(fw)); PrintWriter p = new PrintWriter(new FileWriter(tempFile)); String serData=(String)loadService().elementAt(i); StringTokenizer st = new StringTokenizer(serData, ":"); String code=st.nextToken(); String name=st.nextToken(); if (!name.trim().equals(deleteString)) { p.println(st); p.flush(); } p.close(); br.close(); if (!fw.delete()) { System.out.println("Could not delete file"); return; } //Rename the …

Member Avatar for smith32
0
427
Member Avatar for grady-lad

Hi I am doing a lab where I have to print out all of the locales when the JButton is pressed but when I run the program all it does is show the Vietnamese locale anyone any suggestions how to show them ALL ? [CODE] import java.awt.*; import javax.swing.*; import …

Member Avatar for moutanna
0
66
Member Avatar for Lulie

[B] I have this method:[/B] [code] static int countLeaves(BinaryNode node) { if (node == null) { return 0; } else if (node.left == null && node.right == null) { return 1; } return countLeaves(node.left) + countLeaves(node.right); } [/code] and i want to Write a client program that constructs a binary …

Member Avatar for Lulie
0
117

The End.