36,051 Topics

Member Avatar for
Member Avatar for pooran.c

import java.text.SimpleDateFormat; import java.util.Date; public class StringtoDate { public static void main (String args[]){ String inputDate = "04.11.2013 11:14:45 GMT 00:00"; Date dat = convertStringToDate(inputDate); } public static Date convertStringToDate(String inDate){ SimpleDateFormat sdf = new SimpleDateFormat("mm.dd.yyyy hh24:mm:ss"); Date date = new Date(); try { date = sdf.parse(inDate); } catch (Exception …

Member Avatar for pooran.c
0
2K
Member Avatar for jvcv

How to implement GUI to my code? I know how to make the buttons and etc i just dont know how to "connect them together" thanks `import java.util.Scanner; public class Pizza { public static void main(String[] args) { Scanner inScan = new Scanner(System.in); int choice, choiceEnd, howMany, pizzaNumber; double totalCost, …

Member Avatar for JamesCherrill
0
124
Member Avatar for Imene Hertha

just started programing with java, did microsoft visual basic last semester, but java seems more case sensitive, how can i write a program called CheckPassFail, which prints "pass" if the int variable "mark" is more than or equal to 50; or prints "fail" otherwise.***please help***

Member Avatar for <M/>
-3
345
Member Avatar for justin.dienger

Develop a Screen, a Listener, and an Animator. The screen should have a panel in which a filled ball should be continuously moved. There should be four buttons on the screen. Two (2) buttons on the Screen for movement – labeled Left-Right and Up-Down. The movement of the ball should …

Member Avatar for stultuske
0
2K
Member Avatar for jspence29

I can't figure out why my java applet is not displaying, I have all of the files in the same folder, and I have java enabled on my browser. Here is the code //java code import java.applet.*; import java.awt.*; import javax.swing.*; /** * The HelloWorld class implements an applet that …

Member Avatar for bguild
0
315
Member Avatar for game06

i am drawing two rect in paint method. 1st rect i want to rotate it but 2nd rect i dont want to rotate it. the code i have should rotate only 1st rect but the problem is that when it rotate it missup the x, y postion of rect. this …

Member Avatar for Ezzaral
0
185
Member Avatar for game06

i have asteroids store in arraylist. i want to check collision between player and asteroids. if player get hit than i want to minus one life and move the asteroid backwards so it look like it bounced in to player. right now this code is check for collision between player …

Member Avatar for bguild
0
188
Member Avatar for azdonald

Hi I'm working on a JSP project and i need to retrieve saved images. The images are save on my computer(C:\Users\myuser\Documents\NetBeansProjects\Nomadi\web\Images) I saved the link to a MYsql database.. this is the link i saved(\web\Images\W101.jpg) Nomadi is the project name. When i run my app, the image doesn't show. What …

Member Avatar for LastMitch
0
161
Member Avatar for bibiki

hey there, I have two classes with a one-to-many relationship. For ilustration: public class Customer { Business business; Date created; } public class Business { } Now, when I do the following: new StringBuilder().append("SELECT business FROM ").append(Customer.class.getName()) it works perfectly fine. However, when I include filtering based on created field …

Member Avatar for bibiki
0
142
Member Avatar for inabahtrg

Good day I’m new with JSP, here the problem, I just converting the code from SQL to PostgreSQL, but a problem occur after I change to DataSource ds = (DataSource)envCtx.lookup( "jdbc/postgres" ); and add a scheme to the query. By theory it should be ok but it produce this error …

Member Avatar for LastMitch
0
2K
Member Avatar for G_S

Hello I am a little confused. I had always thought that a class can have objects from other clases as attributes. My teacher recently told me that this is not true... so I am confused now: if one of the attributes of my class is a String, would that be …

Member Avatar for G_S
0
196
Member Avatar for shoaib672002

Ok this the problem i want to download the applet or if not i want it as a animation (swf or gif) Go to this website http://www.colorado.edu/physics/2000/index.pl then click applet tumbannails then go to laser (by srcolling) i want all four applets or make into animation

Member Avatar for stultuske
-1
44
Member Avatar for MasterHacker110

I made this very simple applet just for fun but it doesn't work: package applet; import java.awt.*; public class Applet extends java.applet.Applet { public void init() { } public void paint(Graphics g) { g.drawOval(0, 0, 250, 100); g.setColor(Color.RED); g.drawString("First Applet", 10, 50); } } And heres my HTML code: <html> …

Member Avatar for JamesCherrill
0
186
Member Avatar for chdboy

I have Class called ConnectionDB and in this class I have Main method and another function in the class ConnectionDB,That is private static Connection DBConnectionstring() In this function I have Connection URL ,Drivers inside this function . I want this function to be used in another class (GUILogin) with main …

Member Avatar for chdboy
0
207
Member Avatar for bhallarahul

hello I have a xml like this: <book> <Publication> myPublication0</Publication> <Publication> myPublication<bookName> my book</bookName></Publication> <Publication> myPublication1</Publication> <Publication> myPublication2<bookName> my book2</bookName>asd</Publication> </book> and i want to read through java program and want output like myPublication0 myPublication<bookName> my book</bookName> myPublication1 myPublication2<bookName> my book2</bookName>asd please tell how to get given output

Member Avatar for stultuske
0
181
Member Avatar for joseph.lyons.754

Hey Guys, So I was doin a tutorial and I incorporated it into my code and it works for the most part. The program gives you a list of town names you pick one and hit search. All good so far then the program goes into the database and pulls …

Member Avatar for joseph.lyons.754
0
284
Member Avatar for yyzdslr

I need help with 2d arrays i've posted the problem here [Click Here](http://www.java-forums.org/new-java/71879-please-help-me-im-almost-there.html) (i've posted the problem on java-forums as well) Could someone please tell me what i'm doing wrong or how i could fix this? Thanks!

Member Avatar for JamesCherrill
0
313
Member Avatar for fatalaccidents

Hello all, I'm having trouble writing a spell checker as my recursive function isn't returning what I would like it to. It is meant to chop off the ends of words likes "baker" to bake and check against a predined dictionary. I used recursion for words like "baker's". I have …

Member Avatar for bguild
0
180
Member Avatar for skbluecollars

str1=new String(data,0,data.Length()) why the zero is used in the string function please explain me the what this line says???

Member Avatar for JamesCherrill
0
127
Member Avatar for yavindu

can anyone send me a link for, free video tutorials for java web component development with netbeans.

Member Avatar for LastMitch
0
59
Member Avatar for techd

Hi I have a datepicker: <input class="dmxCalendar2" name="dmxCalendar21" id="dmxCalendar21" /> <script type="text/javascript"> // <![CDATA[ jQuery(document).ready( function() { jQuery("#dmxCalendar21").dmxCalendar2( {"altFormat": "yy-mm-dd", "condDates": [], "firstDay": 1, "showOn": "both", "duration": "slow", "showOptions": {"direction": "up", "easing": "swing"}, "yearRange": "c-10:c+10", "onSelect": "MM_goToURL('parent','allactstest.html');"} ); } ); // ]]> </script> And also a script: <script> var chosenDate …

Member Avatar for LastMitch
0
216
Member Avatar for game06

in enemy bullet class i am creating two different kind of bullets. 'animationFire' and animationFire2. Enemy Bullet class public void paint(Graphics g) { g.drawImage(animationFire.getSprite(), (int)(x),(int)(y), width, height, null); g.drawImage(animationFire2.getSprite(), (int)(x),(int)(y-30), width, height, null); g.drawImage(animationFire2.getSprite(), (int)(x),(int)(y+35), width, height, null); } In Enemy Class i am shooting the bullets. i am doing …

Member Avatar for game06
0
141
Member Avatar for adrian9989

I am trying to write a server-client application for file transfer: the client written in Java and the server written in C++. Unfortunately I have the following error: "java.net.SocketException: Connection reset by peer: socket write error". Here is my code for client: import java.io.*; import java.net.Socket; public class Proba_binar public …

Member Avatar for ktsangop
0
2K
Member Avatar for jalpesh_007

i have made one program,but it will give none of the port number. Following files i have made **SimpleRead.java** import java.io.*; import java.util.*; import javax.comm.*; import java.nio.ByteBuffer; public class SimpleRead extends SpeedometerExample implements Runnable, SerialPortEventListener { static CommPortIdentifier portId; static Enumeration portList; byte[] readBuffer=null; InputStream inputStream; SerialPort serialPort; Thread readThread; …

Member Avatar for JamesCherrill
0
338
Member Avatar for kay19

Well I need help on moifying my report regarding SearchTree.java(Working with Recursion) "Modify the private report to have an additional parameter which indicates the level of indentation at which the visit should be displayed. The public version of report should be modified to call the private version with an indentation …

Member Avatar for riahc3
0
175
Member Avatar for SylvanSagacious

I have a UDP server and need to perform an "all" function. That means when a user sends "all blah blah" the server checks a list of clients and sends "blah blah" to all of them. I've stored the clients in a HashMap and I'm trying to figure a way …

Member Avatar for SylvanSagacious
0
398
Member Avatar for dlgmu537

I have written a super class called Parent.java and it was extended to create a subclass called Child.java. The super class can be compiled properly, but when the child is compiled an error is poped up. //parent class package abc; public class Parent{ protected int st_marks=180; } //child class package …

Member Avatar for jalpesh_007
0
195
Member Avatar for HankReardon

Hello Friends, Can someone please advise me on how to print an array inside of a GUI text field? Thank you, Jim Here is some of my code. /** This private inorder method recursively traverses a binary tree in inorder. @param btree The root of the tree to traverse. */ …

Member Avatar for jalpesh_007
0
2K
Member Avatar for Red_Rain

Hey guys, Writing a project for school and having a little trouble. We are creating a social media program and the teacher never taught us to use databases so we have to store all the data in text files. One of the requirements is to for the users to be …

Member Avatar for mKorbel
0
256
Member Avatar for zebusman

Hi Friends I have just started learning Java.I am getting a problem may be a small one but i coundn't able to figure it out.so here is my Servlet code iam trying to insert data into database after submitting form iam getting **java.lang.NumberFormatException: For input string: ""** I want to …

Member Avatar for zebusman
0
378
Member Avatar for game06

i am tring to debug this problem for about a week but had no luck in it. ![522461a63915f3683bcd1e3e8f00d81d](/attachments/large/4/522461a63915f3683bcd1e3e8f00d81d.gif "522461a63915f3683bcd1e3e8f00d81d") Take a look at this image above. This is how i want the bullets to look like. shoot red lines. ![da7b3eb64b1486e6fec4b7c680889fe7](/attachments/large/4/da7b3eb64b1486e6fec4b7c680889fe7.gif "da7b3eb64b1486e6fec4b7c680889fe7") Now take a look at this image above. I …

Member Avatar for JamesCherrill
0
206
Member Avatar for mferarri

i got this problem from: http://codingbat.com/prob/p178318 This is the question: > Given a string, return the count of the number of times that a substring length 2 appears in the string and also as the last 2 chars of the string, so "hixxxhi" yields 1 (we won't count the end …

Member Avatar for mferarri
0
242
Member Avatar for jalpesh_007

i am new to spring framework. i have learned basic concept of Spring.Now i am trying to simply run one hello world application using spring. i am getting following error.i dont know why? i am using netbeans 7.2 and spring framework 3.1.1 Release. **hello.java** public class hello { private String …

Member Avatar for jalpesh_007
0
1K
Member Avatar for Lynick

Okay so basically my problem is that I have to prompt the user for a set of floating point values once . If they do not enter the right data type then I have to prompt them again. If they dont enter the right type the second time I quit …

Member Avatar for Lynick
0
356
Member Avatar for nova4005

Hello everyone I just finished my last program for class this semester and would love to have some feedback from the memebers here on things that I still need to improve on or good coding practices that I may not know about that can help me become better. I have …

Member Avatar for nova4005
1
468
Member Avatar for Kosamov

Hi Everyone, I've been working on creating this code for a project I've been working on but I can't seem to get it to work. I'm creating a service class that I can then pass to a client class that will read a list of cities that ends in a …

Member Avatar for abhi_d_one
0
176
Member Avatar for hitro456

Hi all, I have some data in the file, which I want to store in the following format : 23 345 9.8 25 457 9.0 11 237 8.3 86 32 2.3 and so on..... I want to store this data in in some data structure, and later I want to …

Member Avatar for JamesCherrill
0
184
Member Avatar for milkman93

Hey everyone, I want to add action listeners to JButtons that were created dynamically by an ArrayList. Here is the code for the button creation. numOfCourse = 6; courseBtnArray.add(new JButton("Course 1")); gbc.gridx = 2; for (int i = 0; i < numOfCourses; i++) { gbc.gridy++; add(courseBtnArray.get(i), gbc); courseBtnArray.add(new JButton("Course " …

Member Avatar for mKorbel
0
487
Member Avatar for bhallarahul

Hi Everyone I need some Assistance, what i am actually doing i read text from pdf and write it on word file(.docx) which is perfectly working but problem is that content of next page is merge with the content of previous page. Now what i want is that when it …

-1
73
Member Avatar for ceelos1974

Hi I got some trouble with my program and I need help. this is the code: public void actionPerformed(ActionEvent arg0) { Object source = arg0.getSource(); if (source == Button1) { System.out.println("Player has choosen the button: " + "button1"); String EP = JOptionPane.showInputDialog("Please enter your file location"); String Path = EP; …

Member Avatar for JamesCherrill
0
169
Member Avatar for toldav

If any one can help me please to answer this questions please: 1. What is the difference between this.dollars and otherMoney.getDollars() 2.- What the return statement of this method is returning. 3.- How this method would be called from the main and give an example Thank you in advanced. // …

Member Avatar for toldav
0
128
Member Avatar for overwraith

If there is a String Buffer, and a String Builder based on array technology, why then is there no equivalent mutable data type based on a Linked List? Or is there?

Member Avatar for overwraith
0
261
Member Avatar for game06

note player is a space ship. in player class i have set up collision so that player cant go above window and below. player class public void playerWCollision() { if(y < 0) { y = 0; } else if(y+height > Main.WINDOW_HEIGHT) { y = Main.WINDOW_HEIGHT-height; } } lets say player …

Member Avatar for game06
0
138
Member Avatar for riahc3

Hello I have this: String price="10,00 €"; int num=2; int sum=Integer.valueOf(price)*num; System.out.println(sum); //Should print out AT LEAST 20,00 But note: That € sign can be $, €, £ or another AND it can come before or after the numeric float amount. What is the best way to do this? Thank …

Member Avatar for mKorbel
0
554
Member Avatar for dlgmu537

Hello Everyone I tried to open a .class file with word format and now all my class files have that Microsoft word icon on it. But I want to remove it and take my .class files to previous style (ie plane style with no icons on it). Is this possible …

Member Avatar for dlgmu537
0
49
Member Avatar for Goldfinch

I've been trying to figure out how to launch a java application from a single double click file like you would Microsoft Word or Firefox. I think I've seen a couple of Java applications that do this, but I haven't seen how.

Member Avatar for <M/>
0
204
Member Avatar for Pobunjenik

Hi, thanks for looking at this thread. :) **The goal:** I have this 2D boolean array (from my [decoder](http://www.daniweb.com/software-development/java/threads/452559/decoder-simulatorcalculator-complement-of-2-problem) thread). I managed to write a method that goes through the rows and appends a '1' or a '0' to a string based on what's in the array (1 for true, …

Member Avatar for Pobunjenik
0
366
Member Avatar for Kosamov

Hi Everyone, I've been working on creating this code for a project I've been working on but I can't seem to get it to work. I'm creating a service class that I can then pass to a client class that will read a list of cities that ends in a …

Member Avatar for Kosamov
0
163
Member Avatar for Pobunjenik

Hi! It's me again and [this](http://en.wikipedia.org/wiki/Decoder) is a decoder! **The goal:** And I'm trying to make a program that solves logical problems related to the decoder device. For that I need a loop that write true/false into a boolean[][] based on the rules. Say we have a decoder with 3 …

Member Avatar for Pobunjenik
0
450
Member Avatar for Raghu88

Hi anyone please help me...... i am trying to export some data to excel file while doing this i got the following exception... here is the stacktrace... Servlet.service() for servlet action threw exception: java.lang.IllegalStateException: getOutputStream() has already been called for this response at org.apache.catalina.connector.Response.getWriter(Response.java:598) [:6.1.0.Final] at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:199) [:6.1.0.Final] at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:125) …

Member Avatar for LastMitch
0
420

The End.