31,001 Topics

Member Avatar for
Member Avatar for nikita.chandra

Hi! please help me for how can i scroll through database using JDBC. if i m creating 4 buttons say First,Last,Next,Previous. First button will take me to the first record of the database. Last button will take me to the last record of the database. Next and Previous will show …

Member Avatar for javaAddict
0
252
Member Avatar for LordRazon

I need to make this a popup when a button is clicked. This is the code for the Button. [CODE] JButton moreOptionsButton = new JButton("More Options"); moreOptionsButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { timer.stop(); } } );[/CODE] I need this information to come up in a new window. …

Member Avatar for hanvyj
0
2K
Member Avatar for 123a

Hi, I basically have 1 arrayList with 10 elements. [CODE] //arraylist with10 elements private ArrayList<String> arrayList1 = new ArrayList<String>(); //arraylist with nothing in it. private ArrayList<String> arrayList2 = new ArrayList<String>(); public void copy() { Collections.copy(arrayList1, arrayList2); } //The code above will copy all the elements in the first arraylist to …

Member Avatar for JamesCherrill
0
101
Member Avatar for spades0001

I'm trying to make my for loop print ODD numbers and print their sum and average. Here's my code: public class Loop_For2 { public static void main (String[] args) { double sum = 0f; int ctr = 1, ctr2 = 0; for (;ctr<=10; ctr++, ctr2++) { System.out.println(ctr); sum += ctr; …

Member Avatar for tong1
0
128
Member Avatar for morancr

I'm not sure why it's not calculating right. When I enter a negative number, the if else statement or something does not register it's a negative number. There is a before and after, and you can see where it does not register negative numbers. Thanks in advance for your help! …

Member Avatar for morancr
0
148
Member Avatar for mcdonalds

Hi there, I'm having a weird error, When I click on my submit button my eventhandler that should be capturing the data from my JTextField is throwing an error : This is my first week using Java so I'm sorry if this is a newb thing. My Main function simple …

Member Avatar for Taywin
0
85
Member Avatar for insanely_sane

Been working on this for 2 hours non stop. Can't seem to figure out exactly what's the problem. Perhaps I'm taking a wrong approach to this problem. Right, I need to copy a singly linked list to another new list. Can use any method EXCEPT RECURSION. Here's the code so …

Member Avatar for Taywin
0
3K
Member Avatar for ceyesuma

Hello I just started working with JTabbedPane tabs. I have been using the index to navigate the pane. Now I add and remove tabs from the pane so clearly the index navigation is no good. Does anyone know some code for an easy solution for using the title or something …

Member Avatar for ceyesuma
0
97
Member Avatar for CompSci_Guy

I am good at created a little block diagram; however, I struggle with tracing these out and I have a midterm in a few hours. I am confused about all the casting and also about #4 and #7. I thought #4 would be a compiler error because the "Decared Type" …

Member Avatar for apines
0
947
Member Avatar for MAGall

Hi, Im new to java, mostly done networking in the past, im trying to create a program that will run a basic simulation of a number of heats for a 100m sprint. It mostly about the use of collections so nothing to complex but im completly lost. I've created a …

Member Avatar for MAGall
0
202
Member Avatar for Chalandria

Here is the start of my program. I am having a little trouble linking the farToCel/celToFar user defined methods with the final equations in the action statements. The output is whatever the user enters and 0 for "fah" and "cel". Example: displayTF.setText(inputTF.getText() + " Celsius is " + cel + …

Member Avatar for Chalandria
0
157
Member Avatar for sadia.ab

plz help.....in solving this problem While developing the Virtual University Learning Management System (LMS), there was a requirement stated that: “Students should be able to post their questions on MDB of LMS, so that it may help them to clarify their concepts in case of any confusion, after they have …

Member Avatar for Ezzaral
0
88
Member Avatar for Cuchara

So I have an array and I need to get the values of it that are larger than a set integer. It would be something like this apart from it doesn't work due to different data types. [code]myVariable = array[i]>otherVariable;[/code] where myVariable and otherVariable are integers. Any help?

Member Avatar for apines
0
80
Member Avatar for Khodz

Hello all, This is a very simplistic simulation but i'm hoping to show bacterial growth using this simple piece of code. [CODE]public class Bacteria { boolean living; Bacteria x; int population; public void spawn() { living = true; try{ Thread.sleep(2000); } catch (InterruptedException e ) {} Fission(); try{ Thread.sleep(100000); } …

Member Avatar for Khodz
0
610
Member Avatar for soccer13

Is there no such thing as hasNextChar? I'm trying to make a program to figure out a grade point average, and a solution I've come up with to deal with the +/- is to assign it as a char and give it a value from there, but I run into …

Member Avatar for apines
0
7K
Member Avatar for spades0001

I made a flowchart that will print counting numbers 1-10 automatically, and I'm supposed to print their sum and average at the end. Now, I have to convert the flowchart into three Java programs: For, While, DoWhile. I'm having a bit of a problem on the flowchart and the programs. …

Member Avatar for apines
0
192
Member Avatar for nipponsahore

Hey .. Everyone ... I'm now to java .. I'm trying to figure out .. how everything fits together .. well .. i have a project that I'm working on .. .. basically it a type of quiz working on java .. where a user takes a simple MCQ quiz …

Member Avatar for nipponsahore
0
179
Member Avatar for nipponsahore

Thank You .. EveryBody .. for Your Support .. Finally Got my Project Working again .. Now.. Im facing Only 1 Problem .. The JRadioButtons .. Remain selected even when I get to the next Question .. the Previous selection .. remains .. Selected.. any help how i can .. …

0
63
Member Avatar for serph09

The question is asking: A run is a sequence of adjacent repeated values. Write a program that generates a sequence of 20 random die tosses and that prints the die values, marking the runs by including them in parentheses, like this: 1 2 (5 5) 3 1 4 6 1 …

Member Avatar for kezkez
0
180
Member Avatar for AlvinLiu

[CODE]import java.io.FileReader; import java.io.IOException; import java.util.Scanner; import java.util.Arrays; import java.util.NoSuchElementException; public class ReservationBook { private Reservation[] data; public Reservation[] readFile(String filename) throws IOException { FileReader reader = new FileReader(filename); try { Scanner in = new Scanner(reader); boolean done = false; while(!done) { try { int numberofR = in.nextInt(); data = …

Member Avatar for Taywin
0
156
Member Avatar for wobuaini

I am sort of told that O(c^n) complexity could be the case of string permutations. but what is this specific 5^n? can anyone think of a simple algorithm with O(5^n)?thx

Member Avatar for Taywin
0
74
Member Avatar for o0oKodako0o

I have a ArrayList and JTable load Object from ArrayList to display on table. When i sort table by using method: [CODE]table.setAutoCreateRowSorter(true);[/CODE] by using that method, i can sort table by clicking on header of the column i want to sort! But after sort, the Object of row which i …

Member Avatar for o0oKodako0o
0
652
Member Avatar for de.ICeman

I have Brought a voucher For SUn JAva EXAM ,So where do u register for this exam ,cant find any links on SUN site And WHICH SUN JAVA EXAM should i give first SCJP OR some other???????????

Member Avatar for peter_budo
0
100
Member Avatar for plasticfood

here is some code from one class... [CODE]public boolean ticketStatus(){ if (fine > 0){ status = true; } else{ status = false; } return status; } [/CODE] and this is from another class... [CODE]public void getTicket(){ if (parkingticket.ticketStatus()){ toString(); } else{ System.out.println("you do not have a ticket. "); } } …

Member Avatar for Taywin
0
115
Member Avatar for sureshksk

Hi all, I am using java bean class in my web application(it is not extending servlet).My need is to get the context path of the application in that class.If yes how. I am using "./".It doesn't work. Please help me

Member Avatar for sureshksk
0
66
Member Avatar for atticusMom

Currently working on a project where we have a message board server. I've gotten most everything to work except my last part where we want an arrayList that returns Oldest Messages and one for newest messages. Here is what I have so far and have tweeked and commented out some …

Member Avatar for Taywin
0
117
Member Avatar for RaghadAsfar

Hi, I need to know if we can use the if satament with methods and how? and what is the illegal start of expression?

Member Avatar for javaAddict
0
78
Member Avatar for shamagantu

The problem: Java will not install on my laptop. My laptop was purchased a little over three and a half months ago. It is an eMachines 440-1394; Windows 7, two Gb RAM, 250 Gb HDD When I purchased the laptop, I was able to install openOffice (with Java? I am …

Member Avatar for apines
0
310
Member Avatar for lykathea

I am trying to implement a stack where one can push to the front and to the back of the stack. However, my implementation is very slow. Can anyone help me think of a better method? Thank you! [CODE]public class Pch11_x1 { /** * @param args the command line arguments …

Member Avatar for lykathea
0
114
Member Avatar for muncher10

I can't seem to find out why it doesnt work with average or smallest but largest and sum does work. //constructor public class DataSet { private int sum = 0; private int count = 0; private int Smallest; private int largest; public DataSet() { } public void addValue(int a) { …

Member Avatar for apines
0
156

The End.