32,199 Topics
| |
I can't figure out for the life of me why the names of the square and rectangle won't show up....can anyone help? [code] public class Square extends NamedShape implements Shape { public void Length() { System.out.printf("Please Enter Length Value: ", this.getLength()); } public Square(String name) { super(name); System.out.printf("Shape:", this.getName()); } … | |
Hi would you be able to clarify If you use a J list selection to access one of a number of StringArrays in a class. What needs to happen. Is it the selection of an 'name' in the JList can then can act as a reference The part I am … | |
Every time I think I am really making progress in understanding object oriented programming, I run into something that makes me have to go back and start all over again... This time its "subclassing". I believe that I understand the basics inheritance and overriding, but when I start to develop … | |
Hi all, I want to parse the elements in my arraylist to double. May I know how to implement that? [CODE]import java.io.*; import java.util.*; public class Array2 { static ArrayList myDouble = new ArrayList(); static String[] temp; static String[][] finalTemp; static String[] arr; static int rows; public static void main(String … | |
Hi everyone, I am having a little(lot of..) trouble figuring out how to combine a GUI I have made and the code that goes with it. I am vaugley familiar with action listener process, and I understand this is how to give functionality to buttons etc. However, the part I … | |
Hello gentlemen. I have a question over here. with the following piece of code i want to extract data from a document. The question is how can i assign the values [B]Sentences, Words[/B] in the Array. [CODE] String data[][]; //[files][sentences][words] public void ScanSearch() { for (int i = 0; i … | |
This file is saved as Employee.java [CODE]// Employee.java //Employee Class with a construuctor to initialize the first name, last . public class Employee { private String FirstName; //first name for this Employee private String LastName ; //last name for this Employee private double MonthlySalary; //Monthly salary for this Employee //constructor … | |
[CODE]java.lang.NoClassDefFoundError: Main Caused by: java.lang.ClassNotFoundException: Main 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) Could not find the main class: Main. Program will exit. Exception in thread "main" Java Result: 1[/CODE] after i had done my system. this error message pop up and restricted me … | |
Ok, well Ive pretty much finished my program and now all thats left is this error that keeps coming up and I dont know how or where to fix it. The error comes up under the bracket. Iam guess Iam missing a bracket at the end, but when I put … | |
Hi all I made this animation app and I think its all correct however i get a error message which is: Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 2, Size: 2 at java.util.ArrayList.RangeCheck(Unknown Source) at java.util.ArrayList.get(Unknown Source) at Animation.getScene(Animation.java:56) at Animation.getImage(Animation.java:49) at MainAnimation.draw(MainAnimation.java:64) at MainAnimation.movieLoop(MainAnimation.java:53) at MainAnimation.run(MainAnimation.java:34) at MainAnimation.main(MainAnimation.java:10) I cant … | |
[code]private void Search(java.awt.event.ActionEvent evt) { int rows = ((DefaultTableModel)jTable1.getModel()).getRowCount(); int index1 = 0; int index2 = 0; try { index1 = Integer.valueOf(jTextField1.getText()); index2 = Integer.valueOf(jTextField1.getText()); } catch (NumberFormatException e) { e.printStackTrace(); } if (index1 < 0 || index2 < 0 || index1 >= jTable1.getRowCount() || index2 >= jTable1.getRowCount()) { JOptionPane.showMessageDialog(jTable1, … | |
Hi all, I have a GUI and working programs, however I need to put the program into the GUI to make it work, but im experiencing the problem that my GUI codes are all in a class and my codes are in man different classes, is there a way to … | |
First off, yeah I know there are many codes out there for this, but how can one learn without doing. Ok So we need to write a code to see whether two words are anagrams of one another. Here is what I have, it compiles but does not work. The … | |
[CODE] class example { public static void main(string args []) { Sysytem.out.printIn (This is a simple Java program....); } } [/CODE] I am using Windows Vista Ultimate I tried to rum this program in DOS shell...... Error 1 :Exception in thread "main" java.land.NoClassDefFoundError : example I tried to remove it...by … | |
HEY GUYS I'M WORKING ON A CALCULATOR USING THE SCANNER CLASS. HOWEVER THERE IS A CATCH TO IT I CAN ONLY USE ADDITION AND SUBTRACTION TO CALCULATE ANSWERS. I HAVE TO MAKE IT INTERACTIVE AND ASK THE USER WHAT FUNCTION THEY WOULD LIKE TO DO(1.ADDITION,2.SUBTRACTION,3.DIVISION,4,MULTIPLICATION) I'M GOING TO USE A … | |
This is the sample code my proffessor posted online [CODE]import java.applet.*; import java.awt.*; public class AnAppletSubclass extends Applet { public void init() { System.err.println("Hello from AnAppletSubClass.init - the current value of n is " + n); color = Color.green; } public void paint(Graphics g) { setBackground(color); System.err.println("Hello from AnAppletSubClass.paint-- the … | |
hey guys, i have a little problem i have got a method that removes the line of text in a file. for example if i specify a name and the name is on one of the lines in the file.txt it would remove it. what i want is that once … | |
Hi there, i just joined this forum in hope improving my Programming skills. Currently i have a college assignmnt. It is to create a dice game "There is a little known dice game which is played with a pair of dice and has the following rules: the player keeps rolling … | |
I need to create a large integer array but I am not able to increase its size beyond max int value. How do I create larger arrays? | |
Hi! I'm trying to create String array from ArrayList. This task seems to be trivial, however I have a problem because of using "interface". The code and error message are shown below. Please, give me some advices to solve this problem. Thanks! [CODE]public class Class1 { public List<myInterface> getAllTasks() { … | |
hey everybody ... well im facing this difficulty .. i made one project .. and im not able to .. create a jar for it my project consists of the following files a package Prj that contains all the classes along with it i have 2 files.. with contain some … | |
Hi! Does somebody know how to get the total number of MenuItems in JPopupMenu? I'm searching for something like, popupmenu1.getNumberOfMenuItems(). I need it for the FOR statement [CODE](for int i=0; i<popupmenu1.getNumberOfMenuItems(); i++) { ... } [/CODE] Thanks! | |
[CODE] import javax.swing.*; import javax.swing.JFrame; public class Ejer1 { public static void main(String [] args){ JFrame frame = new JFrame (Box); frame.setVisible(true); frame.setSize(300,300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel label = new JLabel(); JPanel panel = new JPanel(); frame.add(panel); frame.add(label); System.out.println("*********"); System.out.printf("%s\n%s\n%s\n%s\n%s\n", "* *","* *","* *", "* *", "* *","*", "* *","* *","* *","* … | |
Need idea for start this program.....? Consider the following Student class specification: public Student() //CONSTRUCTOR Initialized the attributes public String name () This Student’s name public String address() This Student’s address public String matric () This Student’s matric number public int creditHours () Number of credit hours this Student enrolled … | |
Hello Members, How do I change the code below sothat I can have the JLabel at the center of the JFrame and the two JButtons directly below the JLabel? Thank you! [CODE]import java.awt.*; import javax.swing.*; public class Layout { public static void main (String args[]) { JFrame m = new … | |
Hi! Could someone please tell me how can I create an obejct of the Class1 shown below? Let's say I want initialize the List of subjects. I try the following code, but it doesn't work: [CODE] List<ClassInterface> myInterface; myInterface = Class1.getAllSubjects();[/CODE] Thanks! [CODE]public class Class1 { public List<ClassInteface> getAllSubjects() { … | |
Hi! My question is about JFormDesigner plugin for Eclipse. So, I opened JFormDesigner in Eclipse, added the ActionListener to the JButton and defined a procedure to be runned after pressing this JButton. Then I pressed "Build All" and runned the form (*.jfd file) from Eclipse. However, it seems that the … | |
hi, anyone can help with the insertion - when insert into a 2-node -> become 3-node, then if insert again in the 3-node, how it will pass/split up the parent - then, when the parent/root become the 3-node,how can it split up again? Below is what i got: [CODE]public class … | |
There is text file with information held on it, with average rainfall per month. 1914,50.9,87,115.8,32.3,47.1,56.6,97.1,63.9,48.1,62.4,110.3,190.8 1914 being the year and the average rainfall follow it. The year goes up to 2008. I created a enumeration which has Jan-Dec (months) And I need to create a class which will store the … | |
1.In the Java API, the String class and all numeric wrapper classes (Number, Integer, Float...) are immutable. Name 3 other classes in the Java API whose objects are immutable. Give an example of creating a new object from each class. 2. Name 3 classes in the Java API whose objects … |
The End.