398 Posted Topics
Re: [QUOTE=dave_t;1754509]Oh God! rewriting the file ?! @JamesCherrill What do you suggest? How to remove quickly a part of a file?[/QUOTE] Its really not that much coding...check here:[url]http://www.daniweb.com/software-development/java/threads/188879[/url] and here:[url]http://www.daniweb.com/software-development/java/code/408638(shows[/url] logic of using stringbuffer replace()) and this:[url]http://www.daniweb.com/software-development/java/threads/188879[/url]. I guess there are many ways, easiest though might be just to read in … | |
Re: [QUOTE=vaironl;1747540]Main class/Frame [CODE]import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.GridLayout; import java.io.ObjectInputStream.GetField; import javax.swing.*; public class Frame { private static final int WIDTH=900; private static final int HEIGHT=800; private static JFrame frame = new JFrame("Recipe Application"); private static final Panel panel = new Panel(); public static … | |
![]() | Re: [QUOTE=krejar;1753830]My problem here is that I am trying to get the getBigJackpot() to correctly woork. If I were to win say 10 coins, it would store in an int, but if I were to win 5 coins, that 10 would stay and disregard the 5 coins won. If I were … ![]() |
Re: [QUOTE=47pirates;1753873]Hello, i want to send images over socket .I had two methods one for converting the images to byteArray "convertImageToByteArray()" and another for converting byteArray to image "convertByteArrayToImage(byte[ ] b)" and i am trying to send bytes through socket and receving it , how can i do so please help.....[/QUOTE] … | |
Re: [QUOTE=Hypnos_16;1753286]I have to make a program that outputs something similar to the appearance of a phone. With intractable buttons, (0 - 9) a T button that outputs "Calling" and an E button that outputs "End-Call" Now i have that much done [CODE]import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Dimension; import java.awt.Color; import … | |
Re: [QUOTE=scheppy;1753807]I know that .bat isnt java, but I dont know were else to place this thread So ive finished my program, has sounds, images and other junk all in a folder on my desktop. as soon as you open the folder you can see the file program.java and also folders … | |
Re: [QUOTE=mallikaalokam;1753480]at p.x; it displays error:not a statement[/QUOTE] Okay let me see how I can help, you have a class called Poco which is the main class, yo then have 2 other classes Login and Display... In your main class main method Poco your logic should be to Create an instance … | |
Re: [QUOTE=Ms New to Java;1753647]hey sir this is what i come up to [CODE] int x; int y; int z; int count = Integer.parseInt(JOptionPane.showInputDialog(null,"Enter any Number:")); int spaces = count-1; for(x=1;x<=count;x++){ z=2*x+1; for(y=1;y<=spaces+z;y++){ if (y<=spaces) System.out.print(""); else System.out.print("*"); } System.out.println(); spaces --; } } } [/CODE] i got some of the … | |
Re: [QUOTE=Kalle21;1753642]hello i trying to learn how to type in for exampel 5 and its going to type out 5 4 3 2 1 0 [CODE]import java.util.Scanner; class indexerad_variable { public static void main( String args[] ) { int i= 0; while (i<= 100){ System.out.println("your number: "); System.out.println((100-i)); i++; } } … | |
Re: [QUOTE=Ms New to Java;1747099]My assignment is to create a program that accepts a list of exam scores (ranges from 0-100) and output the total number of grades and then the number of each in letter grade.. but my problem in the beginning of doing my program is: [CODE]public class Grades … | |
Re: [QUOTE=aanders5;1753083]Okay, so I think it will be easier to show you then explain. I am making Minesweeper, I have 100 toggle buttons, I have a randomizer to place 10 bombs. [CODE] ArrayList<Integer> bomb = new ArrayList<Integer>(); Random rand = new Random(100); for (int i = 0; i < 10; i++) … | |
Re: [QUOTE=sirlink99;1752514]ok. I have changed it a little bit, and I have changed the result. I temoved the toString(), and now it gives me squares. Why is this?[/QUOTE] check here i did this to show you run it and see output:[code] char[] a = new char[3]; a[0]='A'; a[1]='B'; a[2]='C'; String tmp=""; … | |
Re: [QUOTE=scheppy;1752531]ok, so i have lots of audio in my program that only plays once, and that all just works fine and perfect This is what i do to play music [CODE] try { InputStream a = new FileInputStream ("Sounds-Music/MainTheme.wav"); theme = new AudioStream (a); } catch (java.io.IOException z) //catching the … | |
Re: [QUOTE=117;1752396][ICODE] import java.awt.*; import java.awt.event.*; import javax.swing.*; public class sys_windows extends JPanel implements ActionListener, MouseMotionListener, MouseListener { private JPanel titlebar, titlepane; public JPanel content; private JLabel title; private int xPos, yPos, prevX, prevY = 0; private int xSize, ySize = 0; public JButton[] btn = new JButton[3]; public Container container; … | |
Re: [QUOTE=mrod123;1752479]The output looks like this: 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 I know how to use a string but not sure how or where to input a file and have … | |
Re: [QUOTE=Rowdy Busch;1742109]can I install/run 64 bit drivers and use a 64 bit driver for Access when all I have is a 32 bit version of that application? Additionally/Lastly: Can I run a 32 bit version of the JRE on a 64 bit OS without any issues/problems? Even as a developer, … | |
![]() | Re: [QUOTE=sonicx2218;1752291]I can't seem to figure out how to separate the code I wrote into 3 separate methods. 1. The main method, 2. the method that creates the strings i need and sends em back to the main method, 3. and the method that displays the if statement. [CODE]import java.io.*; import … |
Re: [QUOTE=Evenmu;1752283]Hey I am a student and i am new on the algorithm subject. I have been given a compulsory assignment that is to set up a program that have Liked list with Nodes. The problem is that i dont understand how to do this: - remove the first node - … | |
Re: [QUOTE=ndrichim;1752206]Hello there.i have to find if elements of a row are equal to elements of another row.this is my code but it wont work. when k becomes 1, i want the for loop at i to start with i=2; can you help ????? int b[][]={ {1,2,23,4,5}, {6,1,8,9,28}, {11,12,13,14,15}, {1,17,18,19,20},}; for(int … | |
Re: [QUOTE=riahc3;1751172]Hey I would like to do a ".bat' type of command in Java: Something automated. Im trying to run a program that is sort of shell itself so it just need to input certain words/letters into the command line box. Lets see if I can explain it better with a … | |
Re: [QUOTE=jpsider;1752269]So where did I go wrong? [CODE] import java.text.DecimalFormat; public class ShoppingCart { private double totalCost; private LineItem[] myItems; private int max = 100; int numberOfItems; //Provide a constructor for this class public ShoppingCart(int size){ max = size; //Set every new cart to "empty" this.totalCost = 0; //Intialize the array … | |
Re: [QUOTE=rushikesh jadha;1752239]i want create jar file of my source code using netbean but i dont know how to do that please help![/QUOTE] File->New Project->Java->Java Application. Make project name same as your source codes main class(excatly) and then click finish. Now copy and paste your source code onto the tab that … | |
Re: [QUOTE=steven8579;1751590]In SortedIntList I have to override the Add method in IntList. SortedIntList should sort the numbers as they are added to the array. not at the end. My problem is that I can't get it to sort. This code gives me an array out of bounds exception. Here is the … | |
Re: [QUOTE=Queen Lala;1751807]import java.awt.*; import javax.swing.*; /*<applet code="SampleApplet1",200,300> */ public class SampleApplet1 extends JApplet { int num; public void init() { num=20; } public void paint(Graphics g) { g.drawString("Hello to Applets.Session"+num,70,80); g.showStatus(getAppletInfo); } public int getAppletInfo()//Overrides super class method { return("Created by PTSS"); } public static void main(String arg[]) { SampleApplet1 … | |
![]() | Re: [QUOTE=mehnihma;1751463]That is asked in the lab that I need to do[/QUOTE] check this out not the best but its something, as mKorbel said and i agree java never intended a menu to be used like that, and its not a good question at all for the lecturers to ask but … |
Re: [QUOTE=mohamed moamen;1751897]I'm do program that's can record sound , how i can but this sound in MP3 file ?[/QUOTE] check here for sound recording:[url]http://www.jsresources.org/examples/SimpleAudioRecorder.java.html[/url] you could then convert to mp3 using:[url]http://openinnowhere.sourceforge.net/lameonj/[/url] | |
Re: [QUOTE=chazzkat;1751656]Hi everybody! I am pretty close to finishing this program. It is supposed to calculate a person's energy use based on their past and current bill. I am stuck on the calculations and else/if statements. Thanks in advance for any feedback. [code]package craft_week4; //Import scanner library import java.util.Scanner; //Begin Class … | |
Re: [QUOTE=bhallarahul;1750506]Hello everyone i want to convert pdf file in docx file, which contain table, text as well as image can you tell me any any class or method which help to me to extract in the same way as it pdf file have i m using pdfbox api[/QUOTE] I think … | |
![]() | Re: [QUOTE=Gsterminator;1751561]Hey everybody! So my problem is the very last part, getting the results of my calculation. So what i've done is created a stack with my very own stack class. The = button is suppose to display the result but i get a runtime error. Please help me out. Oh … ![]() |
Re: [QUOTE=Dexxta27;1751130]I have to make a small paint program using the GUI. I need to know how to use the combo box. I know I have to make an array with the list of colors but I don't know how to add it to an action listener and choose the items. … | |
Re: [QUOTE=ringo_tech;1744994]but i want to send the packet to all clients almost in the same time with list the sending would be sequentially[/QUOTE] yup NormR1 is right you will never be able to send to every client at the exact same moment, the list might send sequentially but it will have … | |
Re: Well you dont mention any error or anything but im doubting its working, check here for some more info: [link](http://www.java2s.com/Tutorial/Java/0240__Swing/ProgressBarandTask.htm) | |
Re: [QUOTE=swy;1751100]I'm trying to read in the following text file: Jim Nasium mgr Fitness & Leisure 45000 Lazy Susan mgr Home Furnishings 55000 Gene Theory mgr Fine Jewelry 10000 And I have the following code: public abstract class Employee { private String name; private double grossPay; private double netPay; private final … | |
Re: [QUOTE=thepythonguy;1751238]I know this is a pretty silly question, but what is exactly an object instance variable? To explain what I mean, take two classes:- [CODE=Java]public class Duck { boolean hasAtail; double height; public void go() { System.out.println(hasAtail + " " + height); } } public class DuckTestDrive { public static … | |
Re: [QUOTE=47pirates;1750920]those two characters comes appended after "ul::" as ul::xxusername. I can get the clean data in terminal but not in GUI why it is so.....[/QUOTE] Im confused though ... You say when you display the data in the terminal it displays correctly but not in the UI? Well i can … | |
Re: [QUOTE=rushikesh jadha;1751129]how to include database files into my source code package.[/QUOTE] what do you mean by database files? the actual database or the package needed to use the DB? Check here:[url]http://www.vogella.de/articles/MySQLJava/article.html[/url] and here:[url]http://zetcode.com/databases/mysqljavatutorial/[/url] | |
Re: [QUOTE=rushikesh jadha;1751158]when i run my code using IDE it run fine but when i run it using command prompt it show following errors Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\Documents and Settings\Administrator>cd\ C:\>cd bank2 C:\bank2>javac *.java CurrentTransaction.java:2: error: package com.mysql.jdbc does not exist import com.mysql.jdbc.Connection; ^ … | |
Re: [QUOTE=redish23;1751078]Hi, I am currently about to start a project in designing a JAVA GUI; Cinema booking system. Please does anyone have an example code I can have a look at in order to see what structures to cover and how to build my own code?[/QUOTE] Please do not revive old/solved … | |
Re: [QUOTE=harinath_2007;1750812][CODE] System property "mbrola.base" is undefined. Will not use MBROLA voices. [COLOR="Red"]Exception in thread "main" java.lang.NullPointerException at Main.main(Main.java:76)[/COLOR][/CODE] Strange. Why there is no error when i run the same code from netbeans. The program runs absolutely fine from netbeans.[/QUOTE] Check this:[url]http://www.java-forums.org/advanced-java/37345-problem-mbrola-base.html[/url] and this:[url]http://stackoverflow.com/questions/3976152/troubleshooting-system-property-mbrola-base-is-undefined-will-not-use-mbrola[/url] and also this:[url]http://stackoverflow.com/questions/2486985/freetts-problem-in-java[/url] I myself had the … | |
Re: [QUOTE=dennysimon;1750792]hello all the text file's content is the same until user add item into it,and the code used in a stand alone machine thank denny[/QUOTE] Well I guess you could store the text file within your packaged jar file, either by adding it during compile time by looking here:[url]http://javaworkshop.sourceforge.net/chapter5.html#Creating+and+Viewing+a+Jar+File[/url] or … | |
Re: [QUOTE=3nrichedd;1749335]Working on this program that uses 2 classes and a client program to test them, I keep getting this error pointing at my constructor, not sure what i am doing wrong but could use some assistance if anyone is able to offer, the error i am getting is: cannot find … | |
Re: >Hi. im kinda new here . i just want some help with this code i cant seem to figure out my problem, i already declared a constructor but it keeps on saying cannot find symbol when i compile it -_- import javax.swing.JOptionPane; import java.io.*; public class Sample_Thread { public static … | |
![]() | Re: [QUOTE=stultuske;1750560]as I said, there are various ways to do this. but if you want to do it like this, why add the: part? you could have just as easy do it like this: [Code=Java] for (int i = 0,j=0; i < s.length(); i++) { if (Character.isDigit(s.charAt(i))) { str[j]=s.charAt[i]; j++; } … |
Re: [QUOTE=sharathg.satya;1749941]Is exception handling useful in compile time errors logical errors and even runtime errors?[/QUOTE] Exceptions are only used for runtime errors in code. The compile time errors/ logical errors are thanks to the actual java compiler, as far as i know. | |
Re: [QUOTE=MichaelCJ10;1750273]Ok im getting some where. But i need to do one more thing to complete the program perfectly,i need my second object.Katie, to have a budget of 1500000, and Peter, my first object , have 550000, the way ive done it is just to call peter, do my method for … | |
Re: [QUOTE=sarathsshanker;1750206]So the super() keyword is used to extend the Object Class?[/QUOTE] it basically calls the super classes method with the same name. i.e.: if this method is in a class called SomeClass and it's been inherited from the class SomeOtherClass, then this method calls the functionality of the SomeOtherClass.someMethod() this … | |
Re: [QUOTE=gedas;1750013]hey guys, I need a way to ftp a file from a server however i dont want to ftp all the files as there are some files that exceed 200mb what i need is to ftp a part of the file. in other words i would grep for a string … | |
Re: [QUOTE=ndrichim;1749952]hello.i have a homework in java wich asks to create this program: there would be n persons who are going to rate songs. for n persons we will ask their name,surname,sex and age.after this each person will rate(vote) with points the song we have given to them.there are 15 songs … | |
Re: [QUOTE=mallikaalokam;1750044]import java.lang.*; import java.io.*; import java.util.*; interface Batm { final static int minbal=500; abstract void withdrawl(); } class Bal implements Batm { int amt,cbal; Bal(int amt,int cbal) { this.amt=amt; this.cbal=cbal; } void withdrawl() { if(cbal>minbal) { cbal=cbal-amt; System.out.println(amt+" "+"withdrawn"); } else { System.out.println("bal nt sufficient"); } } } class Atm … | |
Re: [QUOTE=kalcio;1749927]bonjour, j'ai un problĂ©me de compilation concernant un projet,malgrĂ© que j'ai un main class voici les erreurs: run: java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at com.anthonyeden.lib.util.XArrayList.<clinit>(XArrayList.java:86) at com.anthonyeden.jnm.JNM.<clinit>(JNM.java:174) Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) ... 2 more Could not find the main class: … |
The End.