32,199 Topics
| |
//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) … | |
where i can but the servlet APIs ? to compile java class from bat file | |
[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(){} } … | |
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 … | |
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 … | |
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 % … | |
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++){ … | |
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 … | |
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'; … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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... | |
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 … | |
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? … | |
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! | |
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 … | |
[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 … | |
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 … | |
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 … | |
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 … | |
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" + … | |
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 … | |
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 … | |
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 | |
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 … | |
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 … | |
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 … |
The End.