How to use "this" reference of outer class from the inner class?
I am developing an Applet which has two buttons. once initialised I add Actionstate listener(this)In my action performed method , surely I must clarify in that method whic button must do what, in other words, let's say there is a yes and no button. must two methods be created for each button ...
I need to write a program to convert a binary number to its decimal and hexadecimalnumbers. The interface is as the following. The Option buttons will allow users to decide thetype of the operation. The input box will be used to accept a number. After click on the Runbutton, the converted ...
I've tried about 20 different solutions, even codes generated by programs, but.. I cant get this applet to work! I should be in folder what is in root directory. when i write my site addr and that folder name where index is to run applets html which runs class file it shows gray screen! One of ...
i made a class which is name rational this program must include private variables and a constructor which store the rational at reduced form ,my idea is to make a method which make the rational at reduced form and then i put it betweet the two braces of the constructor but i have som problem at ...
Hi,Can anyone see what I'm doing wrong?This inputs mouseclicks and displays them on screen. I'm calling the saveNode method from another class to return the nodes Vector so I can save it. I'm getting a nullPointerException.This class paints my pointsimport javax.swing.*; import ...
864 byte By
gurdza at 2007-9-30 1:01:34
Hi I need some help finding out if two String are similar.But I have a set String say "java()" and I want to know if the second string is similar to the first i.e. if "java(something)" contains "java()"As you can see I am not to sure what will be in the brackets of the second string that I am ...
import java.io.*;class MoronStuff {public static void main(String[] args) {BufferedReader in = new BufferedReader(new InputStreamReader(System.in));System.out.print("Enter the value of x: ");char x = (char)in.read( );System.out.print("Enter the value of y: ");char y = (char)in.read( );}}i type ...
1269 byte By
Hal@a at 2007-9-30 1:01:58
HelloCan you tell me where the errors are here. I write this in notepad and saved it as HiApplet.java...// Java packagesimport java.awt.Graphics; // import class Graphicsimport javax.swing.JApplet; // import class JAppletimport javax.swing.*;import java.awt.*;public class HiApplet extends ...
I'm trying to ouput text on several lines within a plain message box, what is the correct way to do that?All my messages are running on one line. I tried looking at the API to see how it works, but I didn't have any luck pasting the code from the API into a new java document to compile and ...
I am very new to java,when i wrote my first java program ,the code followsclass Example2 {public static void main(String args[]) {int num;num=100;System.out.println("This is num:"+num);num=num*2;System.out.print("the value of num*2 is ");System.out.println(num);}}I compiled,no errors were found ...
2142 byte By
va1210a at 2007-9-30 1:02:20
I am using the following code snippet to take care of all MySQL transactions in an application of mine. The problem is, I'd like to be able to create objects of AppCore and use the getQuestion method without having to use throws, trys and the like. How should I go about changing the code? Help ...
1357 byte By
Seb_74a at 2007-9-30 1:02:42
Hi :)I've just started out with Java, and I follow the great tutorial on Sun's Java-page.I've followed two applet examples. First the "Hello world" and then "ClickMe" where you click in a box and move a red dot around when you click.I copy the original files from the tutorial and compile ...
753 byte By
Ihossa at 2007-9-30 1:02:44
this is more of a theory problem than a coding problem. ive been using flash for 2 years now and in flash you got something called push for an array, which adds another element at the end. that does not seem to exist here. therefore i use this code: (its for a socket server)Socket[] ...
I am trying to find a better way to detect if at least one uppercase letter exists in a specified string passed into the function. I have made it work here, but I am told there is a way to do this in one line of code probably using the String class methods!!! Any ideas?public boolean ...
Hitry{// process code here }catch (IOException e){ e.printStackTrace();}What does printStackTrace do when catch is executed?
i just did it!i mean, jverd's sitelooks great, congratulationsif i'm allowed to say so, i'd not "justify" url's paragraphsGood lucknote: (almost quoting jverd's site words)"DisclaimerI am in no way affiliated with The J World"
Hello again world.My question is of a general nature. I am trying to teach myself Java and I think I understand classes, objects, and methods in all of their incarnations. I understand interfaces, inheritance, and the API . I am now trying to tackle GUI programming and am already having a ...
Hey folks. I am having a lot of fun with Java. VERY cool language :)I have been taking notes myself, and I realized yes it is a good thing for memory, but my writing is horrid. if I ever need to refer to them for hints I will be lost.Are there any really good online references with quick ...
211 byte By
obusemea at 2007-9-30 1:03:42
I'm looking for some Java source code, libraries, or APIs that will encode an uncompressed audio file into the Advanced Audio Coding format. Anyone know of where to look or how to start?Thank you.
228 byte By
frosti3a at 2007-9-30 1:03:44
any help on these questions will be GREATLY APPRECIATED ! i was wondering if this is tru: Double is wider than float, and float is wider than int. If it is or is not true, what is the difference between double and float ?
1993 byte By
harwokca at 2007-9-30 1:03:46
i am a student who is in an intro to java course. my question involves using a driver program. my assignment is to create a driver program that prints out 20 random playing cards. i wrote a card class that looks like this class Card{private String suit;private String face;public Card (String ...
181 byte By
selbjxa at 2007-9-30 1:03:47
Hi i am trying to place images in a java application, as well as sound however i am not sure what code to use for this. Would any one be able to help me out with this at all?
128 byte By
mo_ali1a at 2007-9-30 1:03:51
i have a int score... and a int questionNo how would i work out the % and scorescore = question / score*100
Hi all, I've got a class (in my own package dl.app.client which I can run fine through JBuilder. However, when I run it through the command line, I get the following error (which goes away when I remove the package declaration from the class). Again, this is only from the command line. ...
Hello,I am trying to run a program from the command line but keep getting the following errorRegistry key 'Software\JavaSoft\Java Runtime Environment\CurrentVersion'has value '1.3', but '1.4' is required.Error: could not find java.dllError: could not find Java 2 Runtime Environment.Both ...
I have Java 2 SDK Standard Edition v1.3.1_10 installed.I am running Win XP HomeThe code I am trying to run is:class HelloJava{ public static void main(String args[]){System.out.println("Hello Java!");}}I compile it, no errors. But when I try to run it, it doesn't work. This is the message I ...
How to make a gif file be displayed in a JPanel?
ok im not sure if i'm even posting this in the right place but i need alot of help..I just recently upgraded my comp from Windows ME to XP pro.... I then went and logged on to my AOL internest service and went to go update my web page which i need a Java Applet to access and got a thing saying ...
ok im not sure if i'm even posting this in the right place but i need alot of help..I just recently upgraded my comp from Windows ME to XP pro.... I then went and logged on to my AOL internest service and went to go update my web page which i need a Java Applet to access and got a thing saying ...
Hello everyone. I am starting to program in Java and using the Graphics2D class is giving me some problems. I downloaded the Java SDK and I now have Java 2 version 1.4.2_03. I searched online and it appears that I should have the java.awt.Graphics2D already, but my program doesn't find it when ...
Hi, I am trying to write a method that will execute a Windows 2000 dos command. I have researched the jdk documentation and other online materials, but I am not able to get this to work. Hopefully it is a syntax issue I am having. Does anybody have an example you would like to share?
Hi guys,I am checking for open ports in a system but it takes quite a long time .is there anyway to run the process faster this is my code.public ArrayList getAvailablePorts(InetAddress targetAddress){try{if (targetAddress == InetAddress.getLocalHost()){return ...
908 byte By
chai321a at 2007-9-30 1:04:52
Hi,I am new to Java and got into following problem.Can somebody , please let me know how to solve following problem :--> Create a class named DataValidator that contains two static methods named parseDouble and parseInteger. Each method should use nested while loops and exception handling to ...
Hi!!In my program we have created 2 theads.The first thread calls the program from which the text is taken. The other prg thread wants that text. plz tell me how to communicate the two threads.Madhura
602 byte By
rugnowa at 2007-9-30 1:05:31
I'm trying to have a combobox on a messagebox and the user would select an option from this combobox and then press the ok button but i cant get both the combo and the button to appear together on the messagebox - any ideas? I read the java tutorial and it says you can add both but so far ...
import java.sql.*;/* *comment */public static void main(String[] args){System.out.println("How can I do with it ...
Se headline. Just curious to know the answer to this. I know the technical answer. The methods are already declared public so you can't override them with a private method, but why arn't they declared private from the start? You never want to reach one class's listeners from another class, ...
921 byte By
Rufus0a at 2007-9-30 1:05:58
I have a program using a vector, I store BufferedImage objects in it. But when I try to access them later the compiler won't let me because the method in Vector defines that Object is the type of object being passed, and cannot convert it to a BufferedImage.I tried using an Object to store it ...
I need to get this code to readi in a file from anywhere, which it does, and then calculate the sentences, words per sentence and syllables per word, this is my code so far// Standard imports.import javax.swing.*;import javax.swing.event.*;import java.awt.*;import java.awt.event.*;import ...
490 byte By
Lanexxxa at 2007-9-30 1:06:49
Hello,There is a method :public boolean equals (Object emp) { if ( emp instanceof NewEmployee) {NewEmployee tempEmp = (NewEmployee) emp; return this.socSecNum.equals(tempEmp.socSecNum);} else {return false;}}The problem is that I acctually don't understand why we have to use this type cast ...
94 byte By
cjo_78a at 2007-9-30 1:06:54
Have installed Sun1 studio but it can't find my SDK... Is there a way to set the path?
it shows Exception in thread "main" java.lang.OutOfMemoryErrorI dont know how to debug...............
I am using "Sun One Studio 5".I've mounted a directory using "Explorer [Filesystems]".The directory I've mounted contains sub-directories and the ".java" file are in those sub-directories.for example: "c:\my file system">"first_sub_directory">second_sub_directory>"HelloWorld.java"I ...
I need to get a four digit int: number = JOptionPane.showInputDialog("Enter Number: "); number1 = Integer.parseInt(number); Then, I need to be able to step through each digit of the four and then: add 7 mod 10... combine them and show them in a dialog. Thanks in advance for your help! P.S. I ...
Hi,I'm having problems with the class below. When I run it and call the actionlistener listening for 'Get', it gives me a null pointer Exception if I leave the line:JFrameDemo j = new JFrameDemo(); out. But an instance of this class have already been created above in the constructor of this ...
374 byte By
rpjava1a at 2007-9-30 1:08:09
We currently have an appliet that runs in the jvm 1.3. The mnemonics and combo boxes are working in 1.3 but when the applet is run in 1.4.1 the underline for the mnemonics disappear, the alt keys no longer work and the down arrow on the combo boxes do not respond to clicking. Does anyone have a ...
1706 byte By
vik_paa at 2007-9-30 1:08:22
I have a binary file containing 59982 rows and 20 columns, hence giving a vector. there are 8 byte double values in each posn i.e12....2018bytedoublevalue18bytedoublevalue28bytedoublevalue202..59982I am trying to print out all of the double values with the following code but it does not appear ...
The following Insert code works perfectly when called.public void insertFunctionality(String lastName, int goalsIntScored) {String sql = "INSERT into PlayerTable (PlayerLastName,PlayerGoalsScored) values(" + "'" + lastName + "'," +"'" + goalsIntScored + "')"; try ...
HeyHow do I check if the source file equals to destination file?I am writing a copy text file program.Here is my code below:import java.io.*;public class CopyFile{ public static void main( String [ ] args ) {if( args.length == 0 )System.out.println( "No files specified" );for( int i = 0; i < ...