36,051 Topics

Member Avatar for
Member Avatar for rotten69

I was just wondering why the constructor makes a call to the method toString() then I have realised that it's because of the method's name. And why is its name so unique? I changed the name but I don't get the same results. Anyone could possible explain this please? Thanks. …

Member Avatar for rotten69
0
340
Member Avatar for scheppy

I have a grid of 225 JButtons in a 2d array of 15 x 15 I was windering do i need 225 if (event.equals (Grid[0][1])) { } or is their a loops or something, thanks in advance

Member Avatar for scheppy
0
372
Member Avatar for janfritz

hi. i'm trying to make a program that will connect two points that i click in my JPanel. i'm trying to connect the two points with a line. i displayed the values of my (x1, y1) and (x2,y2) coordinates whenever i click using the mouse and there is no error …

Member Avatar for hiddepolen
0
232
Member Avatar for scheppy

Ok, so I've imported import java.util.Random; and im trying to get a random number between 1 and 2, 1 and 4,and also 1 and 15, how would i acomplish this, i know how to generate random numbers, but not between 2 certain numbers?, how can this be accomplished?

Member Avatar for scheppy
0
164
Member Avatar for dhija22

Hi, I wonder of you can help me please, I'm new here and looking for an answer to a problem with my Java files. 'Problem' is: When I try to open the 'Java' icon on the 'controll panel' page, it says 'Application not found' !? I have tried re-installing Java …

Member Avatar for dmanw100
0
166
Member Avatar for slasherpunk

So, I wrote the following program to connect to my local mysql server and create a table in the existing "test" database. The program compiled without any errors, but I got the following run-time error: java.sql.SQLException: Cannot connect to MySQL server on localhost:3306. Is there a MySQL server running on …

Member Avatar for slasherpunk
0
15K
Member Avatar for sagy26.1991

hello everyone, I am new to java programming and i am currently studying inheritance. I have following program and i am getting error [COLOR="Red"]"cannot find symbol"[/COLOR] .Please help me.Thanks in advance. [CODE]class Box { double width; double height; double depth; Box() { //default constructor width = 0; height = 0; …

Member Avatar for sagy26.1991
0
1K
Member Avatar for raj26061990

eg. 14 and 15 Find all the factors of 14 and 15. 1,2,7,14 are factors of 14 1,3,5,15 are factors of 15 Sum all the factors of two numbers and if sum of factors of two numbers taken are respectively equal they are Amicable numbers.

Member Avatar for cms271828
0
487
Member Avatar for cms271828

Hi I've made a cube in Javafx 2.0, see [URL="http://www.colin-java.co.uk/pics/ftcfx.png"]http://www.colin-java.co.uk/pics/ftcfx.png[/URL] But as everyone can see, the edges of the shapes / image are horrendous. This is even with smooth set to true, but it appears to do nothing. Setting it to false seems to make no difference. I've tried googling …

0
57
Member Avatar for cadamsjr

Hi everyone, I have a javascript, jQuery, and c++ background so im not completely new but am just starting to learn Java in a University setting. In our first program we are to run it within a Do...While loop so the user can click a JButton for yes or no, …

Member Avatar for cadamsjr
0
192
Member Avatar for friknos

hi i am trying to create a dvd rental system, up till now i have entered the client's details into an array list and have created a loan for every client that rented a dvd. But now i need to edit a part of this loan, for eg i need …

Member Avatar for friknos
0
138
Member Avatar for lordsurya08

I'm using Swing's GeneralPath to create complex shapes and fill them. Usually I do this, and it creates a nice hexagon for me: [CODE] path.moveTo(100, 100); path.lineTo(150, 100); path.lineTo(180, 150); path.lineTo(150, 200); path.lineTo(100, 200); path.lineTo(70, 150); path.lineTo(100, 100); g2.draw(path);[/CODE] Suppose I wanted to create a donut-shaped GeneralPath, and do this: …

Member Avatar for JamesCherrill
0
359
Member Avatar for onosan

Hi, first of all, sorry for my english, but I´m having a problem and I can´t resolve it. This is part of my jsp code: [CODE]<% if( session.getAttribute("usuario") == null ) response.sendRedirect("index.jsp"); ArrayList pacientes = new ArrayList(); String mensaje=""; String dni="", nombre="", apellido="", email="", sexo="", telefono="", fechanacimiento="", obrasocial="", codigo=""; String …

Member Avatar for javaAddict
0
1K
Member Avatar for seredi

i) My Table contains no of columns and a jcheckbox i the last column. ii) I am using a combobox to select certain value. iii) based on the value of combo box the jbutton loads the data into the table. iv) when i [B]reload[/B] the data into the table, the …

Member Avatar for itexamstube
0
782
Member Avatar for jackmaverick1

I've made a little game (not really, just a bit of a start), but the collision detection is a little screwy. It works within 2 pixels for the bottom three sides. However, on the top, there is a buffer of about 20 pixels that it counts as part of the …

0
78
Member Avatar for rue64ja

Hey all, I've finally embarked on my journey of Mobile app development in java and I've ran into a stop sign already, lol. So I am working with the latest stable release of NetBeans, totally new to it, And I am working with a macbook (leopard 10.5.8) yeah I've had …

Member Avatar for rue64ja
0
155
Member Avatar for LogicalOutlier

[CODE]public class Grades{ public int scoreTotal; public int numScores; double average; static String file = "randomNumbers.txt"; int lowest; int x; int temp; public static void main(String[] args) throws FileNotFoundException{ int scoreTotal = 0; int numScores = 0; double average = 0; int lowest = -1; int temp = 0; Scanner …

Member Avatar for NormR1
0
192
Member Avatar for LogicalOutlier

"Draw a grid of 20 streets horizontally and 20 streets vertically. Represent the simulated drunkard by a dot, placed in the middle of the grid to start. For 100 times, have the simulated drunkard randomly pick a direction, move one block in the chosen direction, and draw the dot. Use …

Member Avatar for NormR1
0
736
Member Avatar for usmansajid

Hi there guys, I seem to be having a problem with my java code. Scenario; I have an array, this is generated according to the user; entering 200; will give him 200 numbers. These numbers are supposed to be semi sorted. To achieve this i created a random array, then …

Member Avatar for hfx642
0
1K
Member Avatar for sunny_8088

I have one dynamic drop down list from data base (working fine) Use can select random entries from this table & hit "RETRIEVE" On the bottom of the page I should get result set from other table depending on the multiple values selected by user in first drop down list. …

0
32
Member Avatar for person192

Hi daniwebbers, I am a newbie learning java and keep getting a "cannot find symbol" error when I try to compile my program. I've tried searching but I don't really know what search terms I should be using in this case. Can anyone see the problem? [CODE]import javax.swing.*; import java.awt.event.*; …

Member Avatar for peter_budo
0
218
Member Avatar for Majestics

I m trying to pass a 10.10 value to double and it takes 10.1 instead of this? Any solution.

Member Avatar for mKorbel
0
313
Member Avatar for jackbauer24

Here is my code: [CODE]class Catandmouse { public void CatAndMouse() { Animal cat = new Animal(); Animal mouse = new Animal(); int mouseCaught = (int) (Math.random() * 10); cat.CatchMouse(); int catgetsit = 0; if ( mouseCaught == cat.number ) { System.out.println("The cat caught the mouse!"); } else { System.out.println("The mouse …

Member Avatar for jackbauer24
0
88
Member Avatar for umair jameel
Member Avatar for DJSAN10
0
151
Member Avatar for jade_91

well basically i have this code working to display distance to nearest station and the station name but i want it to show what line the station nearest is located on i've tried to figure it out but just dont seem to be getting anywhere with it the code (including …

Member Avatar for DavidKroukamp
0
103
Member Avatar for hust921

Hey everyone, i need a little help with searching a string and putting that date into another string. ex: [CODE] String com = ""; String mystring = "sometext here: !com shutdown"; // Magic happens System.out.println(com); // Output: "shutdown" [/CODE] "!com" is the constant to search for, shutdown is variable.

Member Avatar for hust921
0
132
Member Avatar for Mr.BunyRabit

Hey there. How do i stop this damn computer form automatically filling in my second Qoute when i make the first one " and then i have to press space for there just to appear one. It messes me around sooo badly with my programming. it does that wiht quotes, …

Member Avatar for Mr.BunyRabit
0
701
Member Avatar for Melow

Hy I want to validate expression as such: [code]AO:10 EM:1 IO:102 AO:SA EM:SA,AKA,LLMN[/code] so on... I'm noe to Regex and i came out with the following function: [CODE] public void checkFormat(String line) { String expression = "^[ACEILMNOU.]{2}+\\B[:]{1}+\\w{2,4}+"; Pattern subscriptionExpretion = Pattern.compile(expression, Pattern.CASE_INSENSITIVE); Matcher matcher = subscriptionExpretion.matcher(line); if(matcher.matches()) { System.out.println("matches " …

Member Avatar for Melow
0
193
Member Avatar for riahc3

Hello Im trying to generate a image from a servlet and display it with browser. Lets say I want to do something like this: [code] protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException { BufferedImage bufferedImage = new BufferedImage(620, 420, BufferedImage.TYPE_INT_RGB); Graphics2D g2d = bufferedImage.createGraphics(); g2d.setColor(Color.black); g2d.fillRect(0, 0, 620,420); …

Member Avatar for riahc3
0
120
Member Avatar for tushar_shimpi

i am having problem in developing a project based on bluetooth. i am not able to import the package javax.microedition.lcdui.*.it showing error that package not exits. please tell me what to do...

Member Avatar for peter_budo
0
33
Member Avatar for nesnes

i got this code form the internet where it can delete a file.but when i tried to use it n my own java program it does not work anymore.it always returns 'Could not delete file'. ~this code is for my method delete[CODE]public void delete(String file, String lineToRemove) throws IOException{ try …

Member Avatar for ~s.o.s~
0
806
Member Avatar for prasanna123

haii... I have written the code for a social networking site like orkut in php but due to guidelines given by my project guide i need to convert this code to j2EE is it possible??? i am new to j2EE can some one plzz tell me a site to learn …

Member Avatar for dmanw100
0
237
Member Avatar for iamthesgt

For a (homework) project, I have a class ComplexNumber that needs to be printed. I have a number of operations that can be done on objects of the class (addition, subtraction, multiplication, division). Each operation returns a new ComplexNumber to be printed. How exactly do I print this? Do I …

Member Avatar for iamthesgt
0
162
Member Avatar for skoon

I am new to programming, so please accept my apologies if this question is simple. My teacher wants us to create a method that searches a stack for the name that occurs most often and returns it for example : If I have these names in my stack: Tiger Woods, …

Member Avatar for Philippe.Lahaie
0
103
Member Avatar for DigitalSheriff

Hello to you all! I am relatively new to java but I am creating a project in java using net beans 7.1 where I create a mysql database that holds the data of a web service. Unfortunately, while my code runs fine, it shows at the beginning the following two …

0
49
Member Avatar for BBA07

[CODE] proiect2 package; import java.io. *; public class String { static BufferedReader buffer = new BufferedReader (new InputStreamReader (System.in)); static String string = null; public static void main () throws IOException, NumberFormatException { System.out.println ("Enter string:"); String string = buffer.readLine (); while (sir.length () == 0) { System.out.println ("The string …

Member Avatar for DavidKroukamp
0
406
Member Avatar for jackbauer24
Member Avatar for jackbauer24
0
99
Member Avatar for hbluthi

Hey guys. I am creating an ordered list using an array. Not an ArrayList or anything else. I can not figure out how to get all of the data from the OrderedList constructor to carry through to my "insert" method. Therefore, when I am checking if "count == 0" it …

Member Avatar for Philippe.Lahaie
0
196
Member Avatar for cloud02

Hi, is there anybody here knows how to store arrays in a text file? let's say the user inputs the id, name, and address and stores it on a text file then shows its output.. ex. 245656, John, 6534 Japan, Male. something like that. or anyone have a similar program …

Member Avatar for DavidKroukamp
0
168
Member Avatar for jade_91

Hi, basically ive been trying to write code to work out where the nearest station for a person is based on their current location. I did have it working to display nearest station name and distance from that station but something went wrong I must have accidently deleted something or …

Member Avatar for DavidKroukamp
0
142
Member Avatar for Melow

Hy, I have to write a program witch recognizes the extension of the file it gets as argument after that it has to validate the file line by line. A file should look like this: ex: Name, Age, Email, OptionalField1, OptionalField2 Anna, 22, [email]anna@smting.com[/email], completed Mark, 24, [email]mark@smting.com[/email], completed completed …

Member Avatar for Melow
0
183
Member Avatar for arden_k

Hi All, I'm trying to get the JSP database connectivity according to (MVC) Model 2 tutorial to work but I'm missing something. I wanted to look at the files available for download to try to locate the answer to my question; danijsptutorial-database.zip and daniwebtutorial.zip. When I try to download the …

Member Avatar for peter_budo
0
207
Member Avatar for StephNicolaou

Hi all, This is also similar to web browsers which use the codes, &d for date, and &l&f&r for document name, etc. I would like to start the page number for 165, for example, is there a code to do this? (For within the print preview/page setup area). I've already …

Member Avatar for StephNicolaou
0
172
Member Avatar for ThaiAmL

Hello! I'm trying to write a program that will eventually carry out matrix multiplication (by another matrix and by a vector) among a few other methods for a homework assignment. However, the assignment says we first need to write a default constructor that creates the 3x3 Identity Matrix. I'm not …

Member Avatar for DavidKroukamp
0
854
Member Avatar for dreamslct

Hi, I am doing an exercise of Head First Java Pool puzzle. I tried many times and finally got the output required but I am still not fully understand that how program produced that output. The code for Pool Puzzle is as under: [Code] class Echo { int count = …

Member Avatar for dreamslct
1
937
Member Avatar for anand01

Hi all, when I use break statement like following it doesn't show any error [CODE] String o="": o = o + 2; z: for(int x = 3; x < 8; x++) { if(x==4) break; if(x==6) break z; o = o + x; [/CODE] but when I interchange the label(z) position …

Member Avatar for anand01
0
236
Member Avatar for sudarshansirsat

Hi, We have Unicode database and I have generated the i-reports and called them from java in my application but it gets opened my regional language fonts i.e (MARATHI) fonts are not shown properly by adobe reader in PDF format can anyone help me how to get Unicode support for …

0
56
Member Avatar for enterpise

[CODE]package test; import java.util.*; import sun.security.krb5.internal.UDPClient; import java.net.*; public class CMD { public static void main(String[] args) throws UnknownHostException, SocketException { DatagramSocket sock = new DatagramSocket (); Scanner keyboard = new Scanner(System.in); String fisrtarg=null; // System.out.println("Enter CMD"); // fisrtarg = keyboard.nextLine(); if (args.length > 0) {//this is important if no …

Member Avatar for enterpise
0
209
Member Avatar for prachi munjal

Hi The code below is not getting executed when i m trying to make a line chart JFreeChart May be theres some problem with the persistence file.Every time I try to run it shows Jasper Exception... It shows the following [B][I][U][I]errors[/I][/U][/I][/B]: **An error occurred at line: 30 in the jsp …

Member Avatar for stultuske
0
254
Member Avatar for Rajesh Voleti

Hi I am currently doing a project on the aglets. I have a problem in the installation of tahiti server. I have downloaded the asdk 1.0.3 and set the environment variables. Then i run the agletsd (tahiti server file) as administrator and followed the initial steps. Then a command prompt …

0
33

The End.