32,199 Topics

Member Avatar for
Member Avatar for PDB1982

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()); } …

Member Avatar for apines
0
105
Member Avatar for Son of a gun

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 …

0
54
Member Avatar for TahoeSands

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 …

Member Avatar for jon.kiparsky
0
120
Member Avatar for Sunshineserene

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 …

Member Avatar for BestJewSinceJC
0
6K
Member Avatar for StaticX

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 …

Member Avatar for StaticX
0
156
Member Avatar for hatux

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 …

Member Avatar for JamesCherrill
0
100
Member Avatar for Transcendent

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 …

Member Avatar for kramerd
0
226
Member Avatar for problemmaker

[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 …

Member Avatar for hanvyj
0
8K
Member Avatar for DallasFan3

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 …

Member Avatar for hanvyj
0
161
Member Avatar for ronny22

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 …

Member Avatar for ronny22
0
167
Member Avatar for sohail2409

[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, …

0
47
Member Avatar for yap_1991

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 …

Member Avatar for yap_1991
0
202
Member Avatar for kchadek

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 …

Member Avatar for apines
0
158
Member Avatar for apanimesh061

[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 …

Member Avatar for packetpirate
0
205
Member Avatar for jwill222

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 …

Member Avatar for jwill222
0
158
Member Avatar for aleX_X

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 …

Member Avatar for aleX_X
0
137
Member Avatar for gedas

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 …

Member Avatar for gedas
0
92
Member Avatar for Goyle

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 …

Member Avatar for Goyle
0
100
Member Avatar for titan5

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?

Member Avatar for afas87
0
4K
Member Avatar for LianaN

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() { …

Member Avatar for kramerd
0
674
Member Avatar for nipponsahore

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 …

Member Avatar for nipponsahore
0
62
Member Avatar for LianaN

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!

Member Avatar for LianaN
0
123
Member Avatar for rayden150

[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", "* *","* *","* *", "* *", "* *","*", "* *","* *","* *","* …

Member Avatar for kramerd
0
226
Member Avatar for dave1970

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 …

Member Avatar for stultuske
0
232
Member Avatar for sciprog1

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 …

Member Avatar for sciprog1
0
187
Member Avatar for LianaN

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() { …

Member Avatar for LianaN
0
146
Member Avatar for LianaN

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 …

Member Avatar for LianaN
0
96
Member Avatar for newbie_vs

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 …

0
45
Member Avatar for iraqi4life

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 …

Member Avatar for iraqi4life
0
180
Member Avatar for filmPC

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 …

Member Avatar for apines
0
141

The End.