32,204 Topics

Member Avatar for
Member Avatar for ctclements

public class StringSet { public static void main(String[] args){ StringSet ss1 = new StringSet(); ss1.insert("the"); System.out.println(ss1); } /** * Creates an empty StringSet object. */ private String[] data; public StringSet () { data = new String[0]; } /** * If e is null, throws an IllegalArgumentException. * Else, if there …

Member Avatar for jalpesh_007
0
119
Member Avatar for Hakoo

Hello, I am facing this difficulty here : First I'll give code public class Game extends JFrame { private JPanel contentPane; //private JPanel settingPane; protected JLabel lblPlayerName2; // I am using this one for my testing JLabel[] lbls = new JLabel[9]; private final ButtonGroup buttonGroup = new ButtonGroup(); public static …

Member Avatar for Hakoo
0
288
Member Avatar for mcmanuel20

/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package primenumber; /** * * @author mcmanuel */ public class PrimeNumber { /** * @param args the command line arguments */ public static void main(String[] args) { int num, a, b, …

Member Avatar for Taywin
0
168
Member Avatar for greg2186

I have a homework question that I'm a little thrown off by. Mostly because we haven't messed with strings much in class. Any help would be greatly appreciated. Using the UML class diagram as a reference, complete the Student class declaration. (fill in the blanks) class Person { public String …

Member Avatar for greg2186
0
263
Member Avatar for ncis_sg1

I am trying to understand how exactly you are meant to prompt a user for two numbers and then list a menu for them to choose the course of action they want to do with those numbers however I am quite new to java and do not understand the concept …

Member Avatar for ncis_sg1
0
4K
Member Avatar for pattmorter

Hey everyone. So I'm trying to create a siple text editor for handling HTML. I got the majority of the program written to where when you click the toolbar the text is inserted. The only problem is that it only inserts it at the end. So Now I'm trying to …

Member Avatar for pattmorter
0
245
Member Avatar for riahc3

Hello I have the following: String somestring="203/9834/345"; somestring.replace("/",""); System.out.println(somestring); But it does not remove the slashes. How can I remove them? Thanks

Member Avatar for riahc3
0
140
Member Avatar for hwoarang69

this code works fine. all it's doing is setting collision around enemy. and if player touches player from the right than player moves to the right. if player touches enemy from left than player moves to the left. playerX = player x postion playerY = player y postion playerW = …

Member Avatar for Taywin
0
247
Member Avatar for cnad

i am newbies here. i need help in build fuzzy logic in java. actually i did not have any idea how to built it. i want to built a fuzzy system using java for my final project. # i need a sample as my guide to build this system. # …

Member Avatar for Taywin
0
465
Member Avatar for ibthevivin

>Write a Java program that recursively reads ten names from a file, and then outputs the total number of characters in the names, the list of names, and the list of names in reverse order. All looping must be performed recursively. > Jay Walker Erol Flintstone C. Erol Madre Billy …

Member Avatar for Taywin
0
2K
Member Avatar for rssk
Member Avatar for viv941

Hi, Can anyone guide me that how to create interactive graphics (like the following link) 1) http://www.nytimes.com/interactive/2009/03/10/us/20090310-immigration-explorer.html. 2) http://www.guardian.co.uk/business/interactive/2012/oct/17/eurozone-crisis-interactive-timeline-three-years. I am new to languages and dont have any specific knowledge.So any suggestions from where to start,any self help tutorials web links or websites,etc Thanks, Viv Please try this link http://www.marijerooze.nl/thesis/graphics/

Member Avatar for JamesCherrill
0
172
Member Avatar for Omar89

**Write a single Program in Java that illustrates the use of following Object Oriented Programming (OOP) features Classes Objects Inheritance Methods State**

Member Avatar for stultuske
0
131
Member Avatar for easyscript

Am trying to draw image on jpanel or jlabel when button is been click on, so i added actionperformed on my button as follows. private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: Image imag = new ImageIcon(this.getClass().getResource("img/top_bg.jpg")).getImage(); showPix1.setLayout(new BorderLayout()); showPix1.add(new paintPhotos(imag,20,20), BorderLayout.CENTER); } I have a …

Member Avatar for mKorbel
0
821
Member Avatar for rahul.ch

StringBuffer sb = new StringBuffer(new String("Hello")); //Case 1 StringBuffer sb1; //Case 2 String s = new String("Hello"); // Case 2 sb1=s; //Case 2 StringBuffer sb3; //Case 3 sb3 = new String("Hello");//Case 3 Case 1 compiles fine and outputs *Hello* but Case 2 and Case 3 gives compiler error saying incompatible …

Member Avatar for rahul.ch
0
197
Member Avatar for rssk
Member Avatar for stultuske
0
126
Member Avatar for hwoarang69

so i know japplet, jframe, jdialog, jwindow, jpanel windows to create gui. japplet = you use japplet for website with no resizeable or main buttons jframe = ??? ... try to explain as much as you can. i want to know adv and dis of these window.

Member Avatar for jalpesh_007
0
188
Member Avatar for jack_hehe

`** # I know it should be written that : ArrayList ar = new ArrayList(); while(rs.next){ int mxtype = rs.getInt("mxtype"); } int mxtypes[] = ar.toArray();//here will be point out ,need to convert to ...... # **`

Member Avatar for jalpesh_007
0
143
Member Avatar for Jlearner

My logic for run background music when click button. b.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { ContinuousAudioDataStream loop=null; AudioPlayer mgp=AudioPlayer.player; try{ AudioStream bgm=new AudioStream(new FileInputStream("C:/Users/Public/Music/Sample Music/Sleep Away.mp3")); AudioData md=bgm.getData(); loop=new ContinuousAudioDataStream(md); } catch(IOException ex){ } mgp.start(loop); loop=null; } }); Hello EveryOne, I am new to Java and creating a small …

Member Avatar for harinath_2007
0
287
Member Avatar for capt_nemo

I am writing a java netbeans platform application that alerts end users when certain dates, conditions are met, etc... So I want to give the option when the end user installs the program of whether or not the program starts when they log into the computer or not. I also …

Member Avatar for capt_nemo
0
185
Member Avatar for cmps

Hello!!! mmm am learning OOP in Java ... and now I'm facing a prob in reading/writing .txt file here's my code: import java.util.Scanner; import java.util.Formatter; import java.io.File; import java.io.FileNotFoundException; public class Tester { public static void main(String[] args) { Scanner scan = null; Formatter formatter = null; File fileI; File …

Member Avatar for cmps
0
2K
Member Avatar for deadsolo

Hi, I am currently working on a script that will compare two numbers from a file. I am thinking that I need to use a regular expression in order to get the numbers, however I don't know what the regex would be since there are multiple numbers through out the …

Member Avatar for deadsolo
0
294
Member Avatar for MegaBigBigYo

Hi all - I am having a little trouble getting going on the methods for this assignment. I need to use a method which passes a Scanner as the object to create an array that is the correct size, but has null values. It reads in a file which contains …

Member Avatar for MegaBigBigYo
0
186
Member Avatar for cmh0114

For part of my project, I need to write a piece of code that will perform a task (beeping) once per second for ten seconds. I found this code online and tried to modify it to fit my needs, but I couldn't seem to get it. This code doesn't beep, …

Member Avatar for JamesCherrill
0
849
Member Avatar for somjit{}

this code is my attempt at modifying a simple game i found in the book "head first java".. (pg-98 if anyone's interested) the game is about sinking battleships! ... actually... its just about declaring some blocks of a virtual array to comprise a battleship, and the user makes guesses about …

Member Avatar for JamesCherrill
0
237
Member Avatar for Kronolynx

I wrote this program, when i run it, everything seems to work ok, but in the eclipse console i get a long list of errors, what is wrong with my program and how should i fix it? thanks import java.applet.Applet; import java.awt.Color; import java.awt.Graphics; import java.awt.List; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; …

Member Avatar for Kronolynx
0
268
Member Avatar for gourav_rao

1. need to read details of customer in a Account class 2. need to inheritence Account class to define a method for fixed deposit & saving deposit in main class i have to just call all this class pls help ....

Member Avatar for JamesCherrill
0
82
Member Avatar for Shanti C
Member Avatar for agca

Hi, what is the best way to provide followings? 1) Server Client sides 2) File serving by client request 3) Streaming by segments with iteration sample code also please.

Member Avatar for JamesCherrill
-2
182
Member Avatar for engrjawad

What is a flag in java? when do we need it in our program? what it is used for?

Member Avatar for jalpesh_007
0
183

The End.