32,204 Topics
| |
For now the code isn't to complex. Built in Netbeans 7 java 6.... just the basis for now but its very safe connection so thought i'd post it for anyone who needs it. A quit command may be sent to any client by specifying its ID and then press enter … | |
plz help me How to link Access data base with java code. [CODE] public class DataBaseCon { public static void main(String a[]) throws Exception{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:DataBase"); System.out.println("Sucessfully Connected "); Statement st= con.createStatement(); ResultSet rs= st.executeQuery("Select empid,ename from emp"); while(rs.next()){ System.out.print(rs.getString(1)); System.out.println(rs.getString(2)); } st.close(); con.close(); } } [/CODE] Exception in … | |
I am new to using swing. I am trying to get a picture to be displayed in a Jframe when a button is pressed. I cannot figure out how to make this work. This is what I have so far: [CODE] import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.awt.image.BufferedImage; import … | |
I'm using a JFreeChart which I found in this link [ICODE]http://www.java2s.com/Code/Java/Chart/JFreeChartCategoryStepChartDemo.htm[/ICODE] I have modified the code as given below.My problem is how i can change the values in the x-axis so that they don't start from the zero. [CODE]public class Chart1 extends JPanel { /** * */ private static final … | |
I am running into a problem in a card dealing program. When the Deck Constructor tries to run one of the methods associated with the Applet class, the program will fail with an error set typical to running an application as an applet. This is a school project, and the … | |
Hey there, I am building a small database app where I allow users to input and retrieve information in and out of database. As part of my application I have this table courses and a java file Course.java that models a Course object. My Course objects have field variables courseID, … | |
i am reading from file the file is in this format 4 L 100 20 30 200 R 30 20 50 100 O 20 100 100 40 L 30 50 100 100 I'm using string tokenizer now the 4 specifies how many lines I'll have When I read only the … | |
hello,I am writing a program in java in which I use a jtable to print the data to the users.Do you know how can i get the data of a line when that line gains focus? | |
[B]Hello Guys, Hope youre all well :) Please can someone kindly tell me how I can write to a specific line. The value to be written needs to be in long and not as a string. The File is as follows: 1324214082786 1313131 Paid 0.0 the seconds line is time … | |
[CODE]/*********************Pay Button Listener***************************************/ public class payListener implements ActionListener{ public void actionPerformed(ActionEvent e) { String fileName2 = "Ticket/"+ticketIDNumber+".dat"; File ticket2 = new File(fileName2); if(ticket2.exists()){ try{ FileReader fileReader = new FileReader(fileName2); BufferedReader bufferedReader = new BufferedReader(fileReader); bufferedReader.readLine(); //OMIT Entrance Time FileWriter fw = new FileWriter(fileName2); BufferedWriter bufferedWriter = new BufferedWriter(fw); //fw.write("Hello"); bufferedReader.close(); … | |
Hello, I am experiencing problems when trying to remove elements from an array. I've been asked to create a little program which creates bank accounts containing (name, address, bank account number, balance etc.). I have successfully implemented all the functions except deleteAccount (I would also like to add that my … | |
This is the piece of code which i am running : [CODE] public static void main(String[] args) throws Exception { System.out.println("Registering Plugin..."); ServiceConnection connection = ServiceConnection.CreateServiceConnection( "ServiceInstance" ); connection.connect(Constants.VCENTER_URL,Constants.VCENTER_USERNAME,Constants.VCENTER_PASSWORD, true); VimPortType service = null; VimServiceLocator locator = new VimServiceLocator(); locator.setMaintainSession(true); if(connection != null){ System.out.println("Connected successfully to vCenter."); service = connection.getService(); … | |
Hey guys, I am new to Java and recently developed a small GUI-based project in Windows using Netbeans IDE. So I try build the project and retrieve the .jar file and it runs well on my Windows computer. Then I copy the .jar file to a Ubuntu Linux computer and … | |
Dear All, I have a tar file which contains .Z files. File Structure is : x.tar -> [1.Z, 2.Z]. I need to read data from this zip files. So far I have reached a stage where I read entry from tar but am not able to unzip files within the … | |
Note: C:\Users\Hamza\Desktop\Graph.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Tool completed successfully [CODE]import java.io.InputStream; import java.net.URL; import java.util.*; import java.awt.*; import java.applet.Applet; class Node { double x; double y; int lane; int road; double dx; double dy; String lbl; int carW; int carL; double carWaiting; … | |
Hi there, Last night I switched to Ubuntu 10.04 (no, not 10.10, long story). And I wanted to get started programming as soon as possible, so I'm trying to find out how to install Eclipse Helios and the Java JDK 1.6 on my machine? Please note that [B]my machine is … | |
hi, Can any one help me in parsing a file using java. for example in my text file i have data like line.long 0x0 "MIDR,Identity Code" so i need to read this from a file and print it as command=line type=long offset=0x0 description=MIDR,Identity code There are around 100's of lines … | |
Vince Travis Sillhouette Angeles Create a myMath class that contains the ff procedures and or methods 1. Add any number of numbers 2. Multiply any number of numbers 3. Raise a number to the nth power 4. Slope of a line given 2 points 5. Factors of a whole number … | |
Hi! Im doing a program in java that gets info from a database.. thing is that im seting a variable with data from one table, and one data is char and cant find the way to have the .getChar() like the rs.getString() the code is: [code=java] public ModosDeCompra_clase dameModoCompra(Integer id) … | |
hi everyone, I am writing a small client and server application in java which uses SSL sockets and AES, i got this from the net and edited it a bit is this correct and secure? client: [code=java]/* * To change this template, choose Tools | Templates * and open the … | |
how can i drow a graphic in java like the figure in the link below [URL="http://www.daniweb.com/forums/attachment.php?attachmentid=23269&stc=1&d=1324131212"]http://www.daniweb.com/forums/attachment.php?attachmentid=23269&stc=1&d=1324131212[/URL] | |
[CODE]import java.io.*; class file3 { public static void main(String args[]) throws IOException { FileInputStream f1; int i; FileOutputStream f2; try { f1= new FileInputStream(args[0]); }catch(Exception e) { } try { f2= new FileOutputStream(args[1]); }catch(Exception e) { } try{ do { i=f1.read(); if(i!=-1) f2.write(i); }while(i!=-1); }catch(Exception e){}; do { i=f1.read(); System.out.print((char)i); … | |
[code]import java.io.*; class file2 { public static void main(String args[]) throws IOException { int b; b='A'; System.out.write(b); System.out.write('\n'); } }[/code] will anyone can tell that when i don't write System.out.write('\n'); then nothing comes in output. but after adding this statement 'A' got printed, why is it so ? secondly, i … | |
once a thread enters any sychorinsed method on an instance , no other thread can enter any other synchronised method on the same instance ? what does this line mean ? also, how can one method be called by many threads at the same time on the same object ? … | |
[B]guys please help me with this. my problem is that on PaymentNewGUI class i am finding it hard to extract the entrance time from the file to be displayed on the gui if correct ticket number is added, reference to enterListener method in paymentnewGUI class thank you[/B] [CODE]import java.awt.*; import … | |
Hi I want to store variables in a text file (not as an object).my problem is that the class contains ArrayList of another type ,and I wrote one method to store the member variables of my class in "file.txt" ,but I don't really know how to write the ArrayList variable … | |
Guys,i have developed a Java Application.I have already connected it with MySql DB & it's working properly.In DB there is a table calls Music and in that table contains a field calls Song _Path.It includes the path of the song in my computer.In java application there is a "Play" button.After … | |
trying to connect a product class to the main class but i am getting errors i don't understand.like C:\Users\Juanelle\Documents\OOP Final Project\Order Process.java:36: cannot find symbol symbol constructor Product(java.lang.String,double) location: class Product Product product1 = new Product("Roses", 50.00); and in the error message the arrow is pointing at the n in … | |
Hi all I have an assigment but I'm stuck on the loop. I've checked other threads here but got a lot of complicated code that I haven't study yet (i.e.: "System . out .print" is still Screen . message("a") for me) So I have 6 lotto numbers 1,2,3,4,5 And I … | |
HI!! I would like to know some of the alternatives for java swing. I have to create some kind of multithreaded bots for multiple account creations,Scraping etc. using proxies.Although i would like to ask is Java capable of handling this type of bots,because i have read over the internet that … |
The End.