32,199 Topics
| |
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 … | |
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) { … | |
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 … | |
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 … | |
i wan to create the setup file of our java project, if it possible plz help me | |
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 | |
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 … | |
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 ;) | |
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 … | |
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 … | |
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 … | |
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, … | |
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) … | |
[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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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: … | |
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 … | |
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) … | |
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; … | |
i am facing problem while taking input via...JOptionPane.showInputDialog()....plz tell me what package i have to import for it.....:rolleyes: | |
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 … | |
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. … | |
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 … | |
[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 … | |
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 … | |
[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 … |
The End.