32,204 Topics
| |
I tried to make a try-catch block in a program but when an exception occurs, it doesn't do what I intended int num = 0; boolean noException; Scanner keyboard = new Scanner(System.in); while (true) { noException = true; System.out.print("Enter a number or 0 to exit: "); try { num = … | |
anyone know how to split the text in txt file i have this... try { String newaccount = NewAccount.getText(); String newaccusername = NewAccUsername.getText(); String newaccpassword = NewAccPassword.getText(); FileWriter filewriter = new FileWriter(newaccount + ".txt"); BufferedWriter out = new BufferedWriter(filewriter); out.write(newaccpassword); out.write(newaccusername); //out.write(newAccount); out.close(); LabelInfo.setText("Account Registered !"); } catch (Exception ex) … | |
Every time when trying to build gives me this "The project does not have a build script." what to do ??? :/ | |
Please help. I have an illegal start of expression at line 65 where it says "public static void p(Object...args)" /* * To change this template, choose Tools | Templates * and open the template in the editor. */ import java.io.*; /** * * @author Minh */ public class Dna { … | |
| Does anyone have a sample fully working code, that demonstrates how to change the mouse cursor picture when moved over a certain area in a program? [edit] just to clarify change it to a mouse cursor I designed myself[/edit] ThanQ |
I am trying to use such a hexadecimal floating constant "0x0.DAB789B" in java but it gives me java.lang.NumberFormatException. How can I convert hexadecimal float constant to decimal? I know how to convert hexadecimal **int** constant but that does not work for float constant. | |
Implement in Java a class Coin that describes a coin with a name (e.g. dime) and a value (e.g. 10 cents). Also implement a class Wallet that describes a collection of coins. Supply a method add() to add a coin to a purse, and a method printContent() that prints out … | |
I'm writing a VB.NET software application in which I want to plot some placemarks on a google map which is in a webbrowser control in the application. weburl = applicationpath & "/googlemaps.html" WebBrowser1.Navigate(weburl) To accomplish this I call a javascript function from VB.net in this button event: Private Sub Button1_Click_1(ByVal … | |
public class ClickListener implements ActionListener { public void actionPerformed(ActionEvent e) { System.out.println(e.getSource().setText("Changed")); } } Eclipse tells me that `setText()` is undefined for type Object. This tells me that `getSource()` doesn't actually return the JButton object. How do should I do this then? How I change the text of the clicked … | |
I have doubt that what we are using in java as String, is it class or datatype? String str = "hello" String s1 = new String("Hi") What is the difference in above two statements? Which is object of String class and which is varialble of datatype String? Because as i … | |
Hi all, I have created a java program that reads in the number of rows and columns entered by the user, and creates a board of that size. Then, it takes in the position of cells (x, y) that the user wants to make live on that board. -1 will … | |
Hi,... I tried to run the code using the java emulator but it only provides one phone emulator at a time I couldn't see if it does pass the word, what I did is that I downloaded the sun wireless toolkit which can run multiple number of mobile emulator. I … | |
Hello I have made a simple program, but I have a problem with my IF...ELSE statement. Il explain under the code. Main Class: public class Learnt { //Main void in Learnt class public static void main(String args[]){ //Ask's user for name then prints it String AskForUsersName = "What is your … | |
import java.util.*; class nw { int dis(int p) { int c=0,flag=0; for(int j=1;j<=p;j++) { if(p%j==0) c++; } if(c==2) return 1; } void hui() { int c; int p,q; Scanner sc=new Scanner(System.in); System.out.println("range p"); p=sc.nextInt(); System.out.println("range q"); q=sc.nextInt(); for(int i=p;i<=q;i++) { c=dis(i); if(c==1) { System.out.println(i); }}}} {it says missing return statement! … | |
How can I display a color in java with a certain color, Please help with an example. | |
Hello, I would like to build my application which is interacting with my localhost database. In netbeans before I run the program I need to turn on Wamp and "Start all services" in order for the program to run properly. My question is, when the jar file is made, will … | |
Hi there, I have to calculate the pithagorean triplets up to 500 (it's an exercise I found on the deitel and deitel book) and I got a little stuck, in that it looks like I am getting an infinite loop. The exercise says to use a triple for loop, but … | |
Hello guys I have a problem in resizing the image in my java program here is the code: import java.awt.*; import java.applet.*; public class sampleCaseStudy extends Applet { private Image MyImage; public void init() { MyImage = getImage(getDocumentBase(), "manginasalmo.jpg"); MyImage.getScaledInstance(700, 100, Image.SCALE_DEFAULT); } public void paint(Graphics g) { g.drawImage(MyImage, 0, … | |
Hello Sir, I have a simple Issue but It is not resolve by me i.e input parameter are not store in Ms-Access. I store the input parameter through Standard Action <jsp:useBean>. jsp:useBean call a property IssueData. this property exist in SimpleBean which create a connection from DB and insert the … | |
i have an image stored in the column( img) of mysql table albums. the format is blob. i do not no how to retreive it from the table and display it in a label img1 in my netbeans project. how do i write the resultset code and display it on … | |
Recently got a new windows 8 laptop and having trouble using features in eclipse. For instance I can't connect to my local database, can't connect to the eclipse marketplace and even can't run JUnit tests! (Gives a could not connect to error) I believe there is something going wrong with … | |
public static int findMaxPosition(int n[]){ int i, maxPosition =0; for (i=1;i<n.length;i++) if (n[maxPosition]<n[i]) maxPosition=i; return maxPosition; } | |
Hey everyone, So i've been doing some reasearch and I can't seem to find the answer to my problem anywhere. It could also be that I don't really understand the articles I find in google but I figured I'd ask here since everyone is always so helpful. So for a … | |
Hi Everybody I tried and failed to display images of employees in jTable. I have a MySQL Table which have 4 fields - ID,Name.Phone,Photo(Blob data type). Now I am able to retrive data from this table and display it in JLabel with other data in JTextField, but How can I … | |
is it going to be possible to have a connection if I create a J2ME (netbeans) as client and vb.net (2010) as the server? | |
I keep getting an error in my MoneyDemo class, it reads, "Method checkMoney in class Money cannot be applied to given types; required: no arguments; found int, int; reason:actual and formal argument lists differ in length" Also here is my list of objectives for the program which I'll be graded … | |
public class JavaApplication1 { public static void main(String[] args) { for (int i = 5 < = 100; 1 + = 5){ System.out.print(i); if (i <100){ System.out.print(","); } } } } | |
Can any one please tell me how to connect a simple java web application to Oracle10g Express edition? Which driver should I use? Thanks in advance. | |
I am in need of SDK ME development kit for creating Mobile applications using Netbeans IDE 7.1.1. Favour me in this regard. Velhassan. | |
java and j2me are same or what ? Can I make j2me app. After learning java ? If yes Suggest some good free website to learn java which gives complete a2z course ? |
The End.