32,199 Topics
| |
I've tried to define result many different ways, but I just can't get it to work. I know it's just something simple I am missing, but what is it? Can someone point me in the right direction? It currently says 'variable result might not have been initialized'.. but if I … | |
I have made a program in BlueJ using several attributes such as Arrays, Strings etc. I want to know a way in which I can execute this program in any Windows based application or any other platform than BlueJ so that it can be used by people. Any ideas? | |
Why doesn't it display the output for mouseReleased and mouseClicked in console? Is there something that I am missing? import java.applet.*; import java.awt.*; import java.awt.event.*; public class MouseMotion extends Applet implements MouseMotionListener{ public void init() { addMouseMotionListener(this); } public void mouseDragged(MouseEvent e) { System.out.println("mouse is being dragged at location (" … | |
Im trying to make a highlighter that will highlight a word after I have typed it in a JTextArea. The problem I have, is that after I press space, the highlighter doesnt stop. It continues highlighting the next words as well. public class highLighter { JTextArea ref; Highlighter hilite; String … | |
Hey, I have a problem that I've been messing with for several hours, but with no result. I have a basic textfield where I can enter some info and I have to be able to read it and save it to a static variable by both pressing "Enter" and clicking … | |
I have an assignment which is two parts. The first part I have solved. It calls for me to write a program that can read an XML file which then creates a purse a purse object and then prints the total value of the coins in the purse. The second … | |
Hi I am starting to learn Java. I am new to Java. Which book do you think is the best book to learn Java for Beginners? | |
| Hey there. I'm trying to raise a longs to the second power, but as you might know, Math.pow takes two doubles, and also returns a double. Efficiency is kind of important, but it is more important to have this working. Do you know how I might go about solving this? … |
import java.util.Arrays; public class Names2 { public static void main(String[] args) { while (!StdIn.isEmpty()){ String choice = StdIn.readString(); String[] myStrArray = new String[] {choice}; //SORTS STRING ARRAY INTO CASE & THEN ALPHABETICAL ORDER Arrays.sort(myStrArray); //for loop to print int values to console for (int a = 0; a < myStrArray.length; … | |
hi i want to insert image in jtable using netbeans i wrote this code but it just disply the image name many thanks ImageIcon true1 = new ImageIcon("true.gif"); ImageIcon false1 = new ImageIcon("false.gif"); String data[][] = {{"", "", ""}}; String col[] = {"Index", "Specification", "Check"}; DefaultTableModel model = new DefaultTableModel(data, … | |
> I'm implementation polymorphism and have one confusing that if I use instanceof then I'm trying to perform casting which voids polymorphism so will that be any way to avoid instanceof with the code and still have the program working? Block of code where I have used instanceof starts from … | |
i want code for NotePad in java language ^_^ plz help me its Mark by 25 plzzzz | |
| I have a JLabel and a JPanel which both implements MouseClicked methods and I have added the JLabel to the JPanel but when the JLabel is clicked, the MouseClicked method of JPanel is invoked. How to fix this>?? |
Hi Im am bigginer in java and i want to know :If a,b are variables of integer type and S1,S2 are variables of Student,what does mean a=b, si=s2. Is any change in way how the value pass in these examples?? I am waiting for a response best regards Eda | |
**Hey, Hi all! I'm a bachelor student, new to Java. Following code is giving error in PrintDetails() What parameters should I define in it?? Kindly check and tag out my mistakes in the following code.. Thanks ^_**^ class student { String a;String b;char c;double d; student(String name,String rollno,char gender,double gpa) … | |
| I have this printed "ljava.lang.string;@40585b18" instead of a vlaue from the string array called answers. At the moment i am not pick really as to what is pritned out. Just get the app to display something meaningfull from the array will be a good place to start right now. The … |
provide a set of PC-based tools and utilities to organize historical performance data from an OpenVMS system. Purpose of System Synopsis To capture and maintain a history of variables directly affecting the performance of the VMS production systems. Then provide a graphic interpretation of that data to allow for trending … | |
What I'm supposed to do: Rewrite the class below, so that it throws appropriate exceptions instead of returning -1 as an error code. Write test code that attempts to withdraw and deposit invalid amounts and catches the exceptions that are thrown. Original code: class Account { private double balance; public … | |
Hi techies got a small problem a swin related one... I found a similar article here [Click Here](http://www.daniweb.com/software-development/java/threads/89427/how-to-programatically-select-a-cell-in-a-jtree) But seems no answer for that in that particular thread in this forum. Since that is a very old thread thought it would be right to put in my question as a … | |
Need help with just a couple of minor errors. for the lab I am currently doing I have 2 service/class (no clients or application classes). these are my errors Car2.java:138: error: not a statement Cars D = (Car2) car ^ Car2.java:138: error: ';' expected Cars D = (Car2) car Can … | |
The class contains: - Two double data fields named width and height that specify the width and height of the rectangle. The default values are 1 for both width and height. - A string data field named color that specifies the color of a rectangle. Hypothetically, assume that all rectangles … | |
So i'm working on a java program that will eventually be used like a library on an EIS system. My next step is to work with the resource adapter, and i've never done anything like this before. I understand the architecture in this case and what the resource adapter does, … | |
In a nutshell i have a java program that takes parameters from an XML file. I made a .jar file from my java project. Within the java project i have the XML file set to a static directory, i'd like to be able to change that so the jar would … | |
Hello all, I am having problems setting up a connection with a mysql database that i'm going to need to use for one of my projects. My code to establish the connection is as follows: import java.sql.*; import java.sql.Connection; import java.sql.SQLException; import java.sql.ResultSet; import javax.sql.ConnectionEvent; import java.sql.DriverManager; public class SQL … | |
I need to make a checkers board that has to be also resizeable. At the moment I'm using JPanel and it's method paintComponent to paint the squares. But the problem is with the class test: the squares drawn have to be squares and they cant go out of proportion, so … | |
help me in this code .. it is not work .. public static void CreateFile() throws IOException { File f; f = new File("myfile.bat"); if (!f.exists()) { f.createNewFile(); System.out.println("New file \"myfile.bat\"has been created"); } } public static void getFiles(String path) { File dir = new File(path); String[] children = dir.list(); … | |
The major issue I am having right now is my client class cannot run/compile, I tried different methods to fix it from calling it from overload constructor and setScores but neither work. Scoresclient.java:16: error: cannot find symbol myScores.setScores(); ^ symbol: method setScores() location: variable myScores of type Scanner Scoresclient.java:18: error: … | |
I'm trying to create a jUnit test for my EJB's and if my app just contains a few beans everything's all good but as soon as I incorporate JPA and entity-classes my jUnit test blows up. My test fails at ejbContainer = javax.ejb.embeddable.EJBContainer.createEJBContainer(); and the stack trace says the following: … | |
I have this two classes and its giving me an error when i compile it that cannot access BaseClass. package pckage1; class BaseClass { public int x = 10; private int y = 10; protected int z = 10; int a = 10; //Implicit Default Access Modifier public int getX() … | |
So I have a programming lab that we did in class for a few months but I am having major difficulity on it. These are the directions: > Specifications for Calculate grades using loops 1. Create pseudo code for your program first, to be handed in. 2. Make the program … |
The End.