32,199 Topics

Member Avatar for
Member Avatar for zach1280

//Payroll Program Part 2 package payrollprogrampart2; /** * * @author Zach */ import java.util.Scanner; public class PayrollProgramPart2 { public static void main(String args []) { System.out.println("Welcome to Zach's Payroll Program"); Scanner input = new Scanner( System.in ); String employeeName; System.out.print("What is the employee's name?"); boolean stop = false; while (!stop) …

Member Avatar for zach1280
0
539
Member Avatar for mohamed moamen
Member Avatar for mohamed moamen
0
139
Member Avatar for gourav1

[CODE]class Newthread implements Runnable{ String name; Thread t; Newthread (String threadname) { name=threadname; t=new Thread(this,name); System.out.println(t); t.start(); } public void run() { try { for(int i=5;i>0;i--) { System.out.println(i); Thread.sleep(1000); } }catch(--------){ --------} } } class A{ public static void main(){ new Newthread("one"); new Newthread("two"); new Newthread("three"); try{ Thread.sleep(10000); }catch(){} } …

Member Avatar for ~s.o.s~
0
326
Member Avatar for cluelessx

Hello, I've had a good search to see if anything else was posted in relevance with this, but can't find anything that suits my exact needs. I've been given a Java assignment to take in a file, and read how many characters it has (omitting white-space and new lines) and …

Member Avatar for stultuske
0
193
Member Avatar for rotten69

Hey everyone, I was doing an exercise from Java book and I didn't get how this code works.. I know how the switch statement works. However, I don't understand why they pass a number to the Random class and also to the .nextInt() method on rand. And also, I am …

Member Avatar for rotten69
0
182
Member Avatar for rotten69

Hi everyone, Could anyone please tell me why that line in the if-statement body is breaking the method? [CODE] static int [] doubleMe(int [] list){ int [] y= list; int c = 0; int [] w; for (int i= 0; i < list.length; i++){ c = list[i]; if (c % …

Member Avatar for rotten69
0
181
Member Avatar for nsyncpilu

Hy , I have a table , in which i am adding new rows , after 6 rows with data I want to add a empty row with the background color red then another 6 rows with white background [CODE]private void populate(){ DefaultTableModel model = (DefaultTableModel) table.getModel(); int i,j; for(j=0;j<6;j++){ …

Member Avatar for nsyncpilu
0
1K
Member Avatar for queenz68

I'm in an intro programming class and have a problem. Hoping someone can assist me. What I'm trying to do is import a data file and have it read the array in reverse order. That part I have. The second thing I'm trying to do is have it total the …

Member Avatar for queenz68
0
97
Member Avatar for ces06546

Making an airplane seating map and the code does not break after the number 88 is selected and does not print our the array, any help? Thanks [CODE]import java.util.*; import java.util.Scanner; public class AirplaneSeats { public static void main(String[] args) { char[][] seats = new char[13][4]; char filledseat = 'x'; …

Member Avatar for zeroliken
0
1K
Member Avatar for n3red

Hi, I it possible to implement an ActionListener to a global or local variable so that if variable changes the Listener performed a certain function / method etc.. I am working on a GUI application i am guessing there has to be a better solution than wrapping my main code …

Member Avatar for hfx642
0
1K
Member Avatar for oldezwe

Here is my code... [CODE]import java.sql.Connection; import java.sql.DriverManager; import java.sql.Statement; public class example1{ public static void main(String[] args) { try { Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","user","password"); Statement state = (Statement) con.createStatement(); String username = "John"; String password = "John1"; int experience = 0; int level = 1; String insert = "INSERT …

Member Avatar for vadriaan
0
207
Member Avatar for desert564

pls help me with this the user enters a number n.consider the sequence from 1 through n in ascending order.insert either '+' or'-' between each of the digits so that the resultant sum is zero. for eg: input=7 output= 1+2-3+4-5-6+7=0 1+2-3-4+5+6-7=0 1-2+3+4-5+6-7=0 1-2-3-4-5+6+7=0 however when i programmed it i only …

Member Avatar for NormR1
0
185
Member Avatar for vijay4

am able to draw different programs on swings using mouse drag.but if i draw one diagram the previous diagram is getting vanished. how to avoid that ? i want to have all the drawn diagrams on the screen [CODE]import java.util.*; import javax.swing.*; import java.awt.event.*; import java.awt.*; import java.awt.Graphics; class draw1 …

Member Avatar for NormR1
0
159
Member Avatar for deanus

Hi, I'm doing a project with java using the console and I'd like to perform some actions (such as printing to the screen etc) while waiting for input. I was planning to accomplish this by using unbuffered input, by polling the keyboard and performing other actions alternatively, but apparently retrieving …

Member Avatar for JamesCherrill
0
83
Member Avatar for kusumadas

Hi, Am finding 1 diffculty in jtable pls help me... i want to set jtextfield value in jtable of particular column and also that jtextfield value will be dynamically changing... even i have tried the below code... [code]String mn=jTextField2.getText(); jTable3.getColumnModel().getColumn(1).setCellEditor(new DefaultCellEditor(mn));[/code] but its not working...

Member Avatar for mKorbel
0
95
Member Avatar for gourav1

hi, my problem is that : let i m declaring a package P1 and i have defined one class as public in it.now i know that i can use it anywhere. but let if i want to make a second class as public then it can not be possible.but if …

Member Avatar for gourav1
0
122
Member Avatar for dark_sider_1

Hi there, It's been a long time since I've used delimiters in the Scanner class in Java. If I wanted to have any numbers between an expression, such as xx/xx/xxxx or an infinite amount of numbers between them with just the forward slashes as delimiters, what would the syntax be? …

Member Avatar for JamesCherrill
0
212
Member Avatar for JerryRong

Guys I don't know the output of the following loop please help me out [CODE]for ( int = 10; i > 0; i--) { system.out.println ( i*2); } [/CODE] and one more: [CODE]while( a < 20 ) { a += 3; System.out.println( a ); }[/CODE] Thanks!

Member Avatar for mrjillberth
0
130
Member Avatar for vaironl

Could someone please tell me why is my JScrollPane not aligning together with my JLabel of description? I want my label "Description:" to be right next to my JScrollPane which contains a JEditorPane. [CODE]import java.awt.FlowLayout; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.SplashScreen; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import …

Member Avatar for autorunman22
0
172
Member Avatar for Daigan

[CODE]public class DoubleArray { static Console c; // The output console static final int total = 20; String[] numStr = new String [total]; static double numDbl; static String stop = ""; public void getAndStoreInput () { int count = 0; do { c.print ("Enter number" + (count + 1)); c.print …

Member Avatar for stultuske
0
105
Member Avatar for AAChaoshand

I am attempting to complete an assignment but an having some major issues as my java knowledge is basic to say the least. Below is what I am trying to do and below that is the current code that I have. Am I way off base or on the right …

Member Avatar for zeroliken
0
124
Member Avatar for infinitus

Hello there I have been given an assignment at Uni to write program (obviously thus im here hehe) The user (customer wishing to purchase a computer) should be able to login by typing his user name and password and pressing the “Login” button. The layout of this first screen of …

Member Avatar for infinitus
0
255
Member Avatar for George91340

So the program seems simple enough but for some reason when I compile it in the windows command prompt, I get an error that reads "error, cannot find symbol and it point to the period between the list.add(); Any ideas what I'm doing wrong? Thanks! [CODE]// NOTE: THERE ARE FOUR …

Member Avatar for NormR1
0
185
Member Avatar for Daigan

So I'm having trouble parsing a double... Here's my code: [CODE]public class DoubleArray { static Console c; // The output console static final int total = 20; String[] numStr = new String [total]; Double numDouble; public void getAndStoreInput () { int count = 0; do { c.print ("Enter Double" + …

Member Avatar for Daigan
0
133
Member Avatar for j23

the question im doing is: write a java program that allows the user to enter a set of numbers and then displays the sum and the average of the values. It should begin by asking the user how many values they will enter. you should use two seperate methods to …

Member Avatar for stultuske
0
125
Member Avatar for Daigan

Hi, so my problem is I don't know how to read more than one line from a text file. say I have string.txt and it contains: Hello Java Hello World Welcome how am I going to read every line of the string.txt? I tried using FileReader and BufferedReader but it …

Member Avatar for Daigan
0
194
Member Avatar for jackmaverick1

Hi! I heard of a thing called Hotswap debugging, but I haven't figured out how to use it. I can't find a download anywhere, nor can I find a thing called hotswap debugging in the debug menu (I use Eclipse). Just wondering, Jack

Member Avatar for Ezzaral
0
109
Member Avatar for syspect

Hey, guys. I have A database with some Customers with some parameters. I made the Mapper (the connection class between the data base and the GUI). So... I create an object "Customer" (through the GUI) which has the parameters and then I store the object into another class CustomerList which …

Member Avatar for jazz_vill
0
189
Member Avatar for Nandomo

I am working with a tabbedpane with two panels on netbeans... I have a button action which switches panels, "setVisible()", but when it switches the panels the buttons on the first panel show if you roll the cursor over them. Any settings I can change in order to have my …

Member Avatar for jazz_vill
0
139
Member Avatar for singhs18

Ok so lets say I have any GUI that needs its contents changed while it is running, so that it will re-display the new contents. An example would be in my defaultlistmodel it would have: Exactors Diggers But once the user selects "Exactors" and moves to a new GUI which …

Member Avatar for singhs18
0
173

The End.