32,204 Topics

Member Avatar for
Member Avatar for jam7cacci

I'm trying to do a for loop where in it will count the number of times it will be clicked. For example I have a button where i can click that says purchase. Now, from there I want to restrict it by only once. One purchase and that's all he/she …

Member Avatar for Ezzaral
0
87
Member Avatar for PhiberOptik

Hi Guys, I have been googling for a while, I think the problem is I don't know what I'm looking for is called. I want to write a program that watches my screen (I assume it would take screen shots really fast) and then analyzes them finding the moving pixels. …

Member Avatar for PhiberOptik
0
106
Member Avatar for BestJewSinceJC

I'm using the same file menu with the same menu items in multiple places. As such, they should have the same actionListeners etc since the same windows should open when they are clicked. How do I get netbeans to automatically do this (make them all use the same events and …

Member Avatar for Ezzaral
0
100
Member Avatar for enuff4life

hopefully its easy. in main class I have got method from proff [CODE=java] private class AddBBQChips implements ActionListener { public void actionPerformed(ActionEvent ae) { addChips( BagOfChips.Flavor.BBQ ); } } private void addChips(final BagOfChips.Flavor flavor){ BagOfChips bag = new BagOfChips( flavor ); System.out.println(bag.toString()); }[/CODE] and from my class "BagofChips" [CODE=java] public …

Member Avatar for JamesCherrill
0
138
Member Avatar for karan_the

Write a JAVA program that generates a "random" (drunk) walk across a 10 X 10 array. Initially the array will contain all periods(".") The program must randomly "walk" from element to element – always going up, down, right, or left (no diagonal) by one element. The elements "visited" will be …

Member Avatar for javaAddict
0
171
Member Avatar for TechnoArt

Can somebody provide me the solution's for below 3 question: 1) Construct a program that is capable of printing the multiplication table for two variables. For example if the user enters x as 5, and y as 6, the multiplication table that will be printed out is as follows: 1*6=6 …

Member Avatar for masijade
0
162
Member Avatar for m_sam6

how to implement a java class making dynamic queries in java that access mySql tables query,insert & delete taking changing conditions & parameters every time like : SELECT field_names FROM tablename WHERE condition every time it takes different field_names , tablename and conditions

Member Avatar for sillyboy
0
47
Member Avatar for charlie81

I am getting an error saying NumberOperations can't be instantiated. Here is the code. [CODE][LIST=1] [*]public static void main(String[] args) { [*] // TODO Auto-generated method stub [*] // declare variables [*] int num1, num2, sum, diff, product, average, absolute, max, min, adjusted1, adjusted2, adjustedSum; [*] // Display Program Title …

Member Avatar for knowledgelover
0
167
Member Avatar for k2k

I fixed the StackOverFlowError problem from my last thread.. however, my ActionListener is still not working. if any GUI guru here may point out the issue, it would be great. i think this is something very simple and i miss it. [code] //my ActionListener class import java.sql.*; import javax.swing.*; import …

Member Avatar for k2k
0
111
Member Avatar for neutralfox

Hello everyone, I am currently developing a chat application and I want to encrypt all send messages. I am using the example below: [code] import javax.crypto.Cipher; import javax.crypto.KeyGenerator; import javax.crypto.NoSuchPaddingException; import javax.crypto.IllegalBlockSizeException; import javax.crypto.BadPaddingException; import java.security.Key; import java.security.Security; import java.security.NoSuchAlgorithmException; import java.security.InvalidKeyException; public class DESCryptoTest { public static void main(String[] …

Member Avatar for neilcoffey
0
641
Member Avatar for redmaverick

[CODE] import java.util.Scanner; public class testcircle { public static void main(String[] args) { System.out.println("welcome"); double i; Scanner sc = new Scanner(System.in); Scanner scan = new Scanner(System.in); String choice = y; while (i<=10) { while (choice.equalsIgnoreCase("y")); { System.out.println("Enter the Radius"); String radius=sc.next(); System.out.println("Enter the Object name"); String Object = scan.next(); if(Object.equalsIgnoreCase("circle")) …

Member Avatar for BestJewSinceJC
0
448
Member Avatar for cherryduck

Hi everyone, I'm trying to create a simple Java game, The Last Space Invader, where you control the last space invader and the tank automatically tracks and shoots at you. The code for my invader is as follows: [CODE]import javax.swing.*; import java.awt.*; import java.io.*; import javax.imageio.*; import java.awt.event.*; public class …

Member Avatar for cherryduck
0
494
Member Avatar for k2k

hi, would someone please point out what is wrong with my ActionListener setup? [code] // in my menu class, parse JScrollPane and JTable to the showTable constructor in the ShowTable Class showTableMItem.addActionListener(new ShowTable(scrollPane, table)); [/code] [code] /* * set local JScrollerPane and JTable to be the JScrollPane and JTable from …

0
76
Member Avatar for neutralfox

Hello guys, I want to know if its possible to use the same socket to transfer two things at the same time. [code] // set up input stream for objects input = new BufferedReader(new InputStreamReader(clientsoc.getInputStream())); // set up output stream for objects output = new PrintWriter(new OutputStreamWriter(clientsoc.getOutputStream())); output.println(nickName + " …

Member Avatar for neutralfox
0
171
Member Avatar for abhi_elementx

hi. I get a NillpointerException. Here's my code: [CODE] private void Login_ButtonMouseClicked(java.awt.event.MouseEvent evt) { String usrname = uname_TextField.getText(); String pass = passwd_PasswordField.getText(); String pwrd = pass.toString(); String args[] = null; boolean auth_flag = false; try{ R = S.executeQuery("select uname, passwrd from Employee_Master;"); while(R.next()){ if(usrname.equals(R.getString("uname"))){ if(pwrd.equals(R.getString("passwrd"))){ this.dispose(); [B]args[0] = R.getString("uname")[/B]//causing nullpointerexception …

Member Avatar for BestJewSinceJC
0
114
Member Avatar for Prateek Parmar

hii i am new learner of java.. I just want to know that it is necessary to declare a default constructor if we are declaring parameterised constructor..

Member Avatar for verruckt24
0
90
Member Avatar for neutralfox

Hello friends, Got a new question, can someone explain to me how to put an HTML link in my Java program. Example ... "Click here to visit the developer website". So when someone will click on the link, the web page should automatically open in the browser. I searched on …

Member Avatar for neutralfox
0
100
Member Avatar for geek-girl

Hi, I'm pretty new to java and I'm not asking for anyone to do any coding for me. I just need pointing in the right direction. How do I go about printing out the objects of an array sorted alphabetically by name without altering the original array. I know I …

Member Avatar for BestJewSinceJC
0
163
Member Avatar for smsamrc

i have to do a java program to perform polynomial operations. i can manage those operations part. but i have a problem when storing the terms of the polynomial in to a linked list. for example when it is given polynomial("4 2 5 3 6 0"); // 4x^2+5x^3+6 may be …

Member Avatar for smsamrc
0
2K
Member Avatar for custurd12

my program won't even run so i must have missed something drastically but i don't see it.... anyway, Create a class called Factor that has a public method called calculateFactor. The method has two two arguments of type integer and checks whether the smaller of the two integers is a …

Member Avatar for stephen84s
0
144
Member Avatar for redmaverick

[CODE]public abstract class CircleShape { public double radius; public CircleShape(){} public CircleShape(double radius) { this.radius=radius; } public void setradius(double radius){ this.radius=radius; } public String toString() { return "radius"+ radius; } abstract String getDisplayText(); } [/CODE] [CODE]public class circle extends CircleShape{ private double area; public double area() { return radius*radius*3.14; } …

Member Avatar for BestJewSinceJC
0
2K
Member Avatar for osjak

Hi All, I am just learning Java and there is a concept that I cannot grasp. I am writing a simple exercise program that works with stacks. I have a sum method for two different types - Integer and Double. They both have the same logic, so it seems redundant …

Member Avatar for BestJewSinceJC
0
714
Member Avatar for ViLeNT

Hello, I am attempting to create a program that accomplishes the following: *I am to develop a heap, that is tree-based(not array) *The heap should be ascending *Include the method toss() -This method will randomly toss a node into the heap and will not maintain the proper heap conditions *Include …

Member Avatar for BestJewSinceJC
0
114
Member Avatar for abhi_elementx

hi. I have a jlist on a frame. I want to add items dynamically in the list. So, I am using DefaultListModel..Here's my code: [CODE]public class AdminFrame extends javax.swing.JFrame { private Statement S; private ResultSet R; DefaultListModel model = new DefaultListModel(); JList Employee_list = new JList(model); /** Creates new form …

Member Avatar for JamesCherrill
0
74
Member Avatar for llemes4011

I don't know where this question came from, but... Is there a way to start at one directory, say... C:\ . and I wanted to go into that folder, and printout a list of the folders/files in that directory, and then do the same for the rest of the folders …

Member Avatar for llemes4011
0
96
Member Avatar for ClimaxBeetle

Hello, this is my first time in participating in this forum and also this is the first time that I've used Java for my entire life. The objective behind my problem was: "Create an Animal Interface that has two methods: eat and move. All these methods do not have any …

Member Avatar for BestJewSinceJC
1
133
Member Avatar for abhi_elementx

Hi. I have two tables in mysql - [B]customer_master[/B] and [B]contact_master[/B]. customer_master has a primary key - "cust_id" ,which is a foreign key in contact_master and "cust_name" which is also a foreign key in contact_master. I have a [B]frame[/B] which will do [B]CRUD operations for contact_master[/B]. The frame has two …

Member Avatar for BestJewSinceJC
0
825
Member Avatar for jam7cacci

I'm trying to compare two variables that is being inputed by the user but then it wont function [code] if (txt_pay.getItem() < txt_amount.getItem()) { jOptionPane1.showMessageDialog(this, "please enter the right amount"); } [/code] what could be wrong? the error says [quote] operator < cannot be applied to java.lang.string [/quote] another one …

Member Avatar for jam7cacci
0
109
Member Avatar for manfosys

Hi to all, I wrote the java pgm for download the webpage content(html+images) and write on local host.Its wrks fine .But some time it stop while downloading .ie it download only some pages and images.I wrote pgm within try &catch.It doesnt throw any exception like connection time out,connection reset; iam …

Member Avatar for peter_budo
0
95
Member Avatar for k2k

hi, i have just written a simple hello world java program in my linux server, installed jdk ... and tried to compile and run it and it gave me some errors. please details below: [root@localhost javaFiles]# cat HelloWorld.java [code] import java.util.*; import java.io.*; public class HelloWorld { public static void …

Member Avatar for k2k
0
130

The End.