31,001 Topics
| |
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; … | |
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. | |
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 … | |
| 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; } } … |
| 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 … |
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); … | |
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 … | |
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 … | |
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( … | |
| 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 |
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. | |
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; … | |
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 … | |
How to convert a plain text file into a **charsequence** object? | |
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 … | |
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 … | |
// 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 … | |
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 … | |
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 … | |
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 … | |
| 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 … |
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 … | |
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. | |
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); … | |
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 … | |
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 … | |
/*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 … | |
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 … | |
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 … | |
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! |
The End.