31,001 Topics

Member Avatar for
Member Avatar for Baduizm

I have this Singleton class: package com.CCharles.Singleton; import java.util.ArrayList; public enum Singleton{ INSTANCE; public void createList(){ ArrayList arrayList = new ArrayList(); for(int i=1;i<101;i++) { arrayList.add("Job "+i); } for(int i=1;i<101;i++) { System.out.println(arrayList.get(3)); } System.out.println("DONE"); } public void sayHello(){ System.out.println("Hello World"); } } and I am accessing Using: package com.CCharles.Singleton; import com.CCharles.Singleton.Singleton; …

Member Avatar for Baduizm
0
180
Member Avatar for anuj_sharma

Hi, I have an application that is running in the system tray. It displays a popup menu when the user right clicks on it. I need to set shortcut keys for displaying the popmenu and also for the menu items. Is this achievable? If yes, then please advice.

Member Avatar for anuj_sharma
0
141
Member Avatar for bo0ga

I'm very new to programming, so sorry if this is a dumb question. Is it possible to write a program that can view the source of a webpage and extract and re-write a certain part of the code? For example, I would want the program to view the source of …

Member Avatar for bo0ga
0
2K
Member Avatar for joankim

Learning Java, I have never used the keyword "this". So I am wondering when it is smart to use it. I know that it does prevent name conflicts: public class test { int x; int y; public test(int x, int y) { this.x = x; this.y = y; } } …

Member Avatar for devninja
0
277
Member Avatar for sonicx2218

So my java class is a joke, and we're expected to learn how to do our assignments via the web...I'm a hard worker, but I'm just not good at this. [Assignment pic](http://oi50.tinypic.com/aw3zx2.jpg) There's the assignment image. I think i got how to do the first part with the adding random …

Member Avatar for sonicx2218
0
543
Member Avatar for swagen

package gui; import javax.swing.*; Import java.awt.event.*; import java.applet.Applet; public class FE extends Applet implements ActionListener { private JLabel lb = new JLabel("Enter text :"); private JTextField jtf1 = new JTextField(10); private JButton jb = new JButton("ENTER"); private JLabel lb2 = new JLabel(" "); public void init() { add(lb); add(jtf1); add(jb); …

Member Avatar for devninja
0
3K
Member Avatar for FUTURECompEng

The output of the following line of code is: Not Done End boolean notDone = false; if (notDone = true) System.out.print("Not "); if( notDone = false) System.out.print("Done "); System.out.println("End"); The answer is false but I am having a hard time understanding why. Aren't the if statements setting notDone equal to …

Member Avatar for FUTURECompEng
0
265
Member Avatar for HungMob

I keep getting an error with the "ButtonListener." I don't know what it is that's causing it, but help would be appreciated. import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class MovingCarPanel extends JPanel { private int delay = 2; private Car car; private Timer …

Member Avatar for DavidKroukamp
0
187
Member Avatar for Baduizm

I Have This Workers List: private List<Worker> buildWorkerList( Producer producer ) { List<Worker> workerList = new ArrayList<Worker>( 11 ); workerList.add( new WorkerImpl( "Garnett", producer ) ); workerList.add( new WorkerImpl( "Durant", producer ) ); workerList.add( new WorkerImpl( "Xavier", producer ) ); workerList.add( new WorkerImpl( "Daniel", producer ) ); workerList.add( new WorkerImpl( …

0
172
Member Avatar for mehnihma

I need Subversion server for eclipse and client which works on Mac, I need something free or a 30 day trial Do you have some idea? Thanks

Member Avatar for ~s.o.s~
0
115
Member Avatar for Majestics

Its just a simple question , but i m totally confused that why php and asp hosting are cheaper then jsp. Also what jsp provide which are not provided by php and asp? Thank you in advance for your kind replies.

Member Avatar for ~s.o.s~
0
95
Member Avatar for Afropuff01

So I'm using OpenGL for a game in java, but I'm stuck on an extremely confusing problem. Class: private class TitleBuilding { private double x1, y1, x2, y2; private double percentage, randValue=1; private byte windowType, numBuildings; private Random random2; private byte index; public TitleBuilding(double percentage,byte numBuildings,byte index) { this.percentage=percentage*.01; this.numBuildings=numBuildings; …

Member Avatar for NormR1
0
152
Member Avatar for jhamill

Hey so this is my code for checking for palindromes...it compiles fine, the problem is it doesnt work. Basically I converted the four sentences into strings without spaces or other characters and added them to a new string called newstr....i used the newstr to check for a palindrome in the …

Member Avatar for NormR1
0
307
Member Avatar for winecoding
Member Avatar for DEAD TERMINATOR

I'm trying to write a method that displays the contents of a hashmap on screen. This hashmap contains Strings and an array of int for every String. I've put the String aspects of the hashmap into an arraylist and I'm trying to use another method to print the arrays for …

Member Avatar for JamesCherrill
0
300
Member Avatar for trektrak

Ok, to be frank... I've just started java yesterday... after few months playing with web application programming (php/js) ... today... I'm building the most simple programming using java .. which is .. login system... username and password... Ok, to make it more usefull... eventho it is simple... I would like …

Member Avatar for trektrak
0
146
Member Avatar for dwlniles

// This is the error message I'm getting..C:\Program Files\Java\jdk1.6.0_25\bin>javac c:\java\Grade1.java // c:\java\Grade1.java:49: variable grades might not have been initialized // switch(grades) // ^ import java.util.Scanner; import java.text.*; import javax.swing.*; import java.util.*; import java.io.*; public class Grade1 { public static void main (String[] args) { String str, lgrade, studentName, courseName; int …

Member Avatar for zeroliken
0
254
Member Avatar for erms

Hi, I got an image with 2 colors, black (background) & white (text color), text is "A B C D" I have extracted the white pixels locations, & now I want to figure out the alphabets that are written in this image. Kind of like a screen reader does. I …

Member Avatar for erms
0
104
Member Avatar for charmcity04

I am creating an program that allows a user to register for a conference. When I press the "Run" button in Netbeans I get a message saying "Build Successful," but the program does not show up on the screen. What am I missing in my code? I am new to …

Member Avatar for NormR1
0
2K
Member Avatar for choosenalpha

Greetings All, I have a brain fart. I am trying to print the first and second number in the array which is [0] and [1]. I have the for loop going through each element in the array integersCount[] so I can find those positions. But do I need an if …

Member Avatar for choosenalpha
0
205
Member Avatar for v3ga

I just started learning Java (Currently, I know basic swing components like JPanels, text areas, textfields etc) and I have chosen a Logic Circuit Simulator as a project. My objective is to simulate the working of logic gates by making circuits using drag & drop. So far, I have thought …

Member Avatar for v3ga
0
1K
Member Avatar for katiecathey

I need help with creating the room class and dungeon class, i keep going back and forth and now I am just confusing myself. DUNGEON ADVENTURE PROGRAM PURPOSE: The purpose of this is assignment is for you to practice working with two dimensional arrays as well as to continue developing …

Member Avatar for JamesCherrill
0
702
Member Avatar for Majestics

I want to assigne value to string array but i dont know the size of the array from start... Is there any way to do it Programatically for(int i=0 ; i < unkownSize; i++) string[i] = some value I hope my question is clear.

Member Avatar for NormR1
0
141
Member Avatar for raj.mscking

Good To Meet you All! Sir In my server This is the JButton action for start server private void strsrvActionPerformed(java.awt.event.ActionEvent evt) { getClint(); } This is action Performed sir.., public void getClint() { try { ServerSocket ss=new ServerSocket(1030); try { JOptionPane.showMessageDialog(null,"Server is runing"); while(true) { Socket s=ss.accept(); Service a=new Service(s); …

Member Avatar for NormR1
0
256
Member Avatar for anuj_sharma

Hi, I am trying to get a screenshot of the active window on the screen, for which unfortunately Java does not have an API. It allows me to capture the screenshot of the whole screen but not of the active window. Now, I did a bit of workaround but it …

Member Avatar for anuj_sharma
0
257
Member Avatar for thechadv1

I need to develop a graphical representation of a balanced binary tree using random numbers from an array with the number of elements entered by the user. That part I got down and it is working fine. The next part of the assignment requires me to display the number of …

Member Avatar for NormR1
0
242
Member Avatar for Johannady2

/*This code counts the vowels in strings? It has to use user defined methods: */ import java.lang.String; import java.io.*; import java.util.*; public class vowelConsonant2 { static Scanner scan = new Scanner(System.in); public static void main(String args[]) { String text; int actualI, actualC; System.out.println("Enter the String:"); text = scan.nextLine(); System.out.println("There are …

Member Avatar for NormR1
0
275
Member Avatar for IIM

Anyone have idea about how can we use webcam to take pictures in java. Is there any specific port or something to enable webcam? Wondering how to do this. I don't want to use API like JMF or something.I just want to know how can we establish connection and get …

Member Avatar for IIM
0
89
Member Avatar for huphane

public class Exercise { /** * @param args the command line arguments */ public static void main(String[] args) { String A[] = { "Joseph","Ariana","Xena","Rene","Peter","Diana","Rihanna"}; String B[] = {"Madona","Diddy","Joe","Alice"}; for(int j = 0; j < A.length; j++) { for(int s = j +1; s < B.length; s++) for(int i = 0 …

Member Avatar for NormR1
0
281
Member Avatar for Constantine08

I would like to know how to compile the jBullet demos, found here: http://jbullet.advel.cz/download/jbullet-20101010.zip in the eclipse IDE. It seems like it should be a fairly easy but i may be missing some small simple task. If you do know the answer, please be fairly direct and detailed. Thanks!

0
139

The End.