32,204 Topics
| |
I have created a form in netbeans with two radio buttons in a button group with a text box. Box 1 = Yes Box 2 = No when form loads no is already selected. I want the text box to be ivisible until user selects yes. but everything I have … | |
import java.io.File; import java.util.Scanner; import javax.swing.JFileChooser; import javax.swing.JOptionPane; import javax.swing.UIManager; public class TextAnalysis { public static void main(String[] args) throws Exception { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); JFileChooser chooser = new JFileChooser("c:/users/zachary/demo"); int outcome = chooser.showOpenDialog(null); if (outcome == JFileChooser.APPROVE_OPTION) { File f = chooser.getSelectedFile(); Scanner words = new Scanner(f); String word = JOptionPane.showInputDialog("Enter … | |
can u give me a simple java mini system,,,plss...for my project po kc penge nlang dn po ng output at codes | |
This is the problem I am suppose to solve: A mail order house sells six different products whose retail prices are as follows: Product 1, $3.75; Product 2, $5.95; Product 3, $8.75; Product 4, $6.92; Product 5, $8.75; Product 6, $7.87. Write an application program that reads a series of … | |
All, I usually write console apps, but now I have to do a forms app. Hopefully that will explain the sillyness of the following question: I created my project in NetBeans and NetBeans automatically generated a class with the project name, and this class has a main() method. Then I … | |
Hello everyone, I'm working on an assignment that requires the use of the Scanner class to read the source code of the .java file and output all lines when executed. I have created a file that works without issues on my machine, but I was wondering if there was a … | |
I am doing a project in class. We have to make a program that scans Two Postive Integers, one at a time, using try-catch block. Can some one please help me get started? | |
Hi, my daughter is struggling a bit with maths and logic and I was thinking of doing some programming with her hoping that a different approach to the field might help a bit. I've had some look at Java syntax and I think I should be able to write some … | |
How do you write an input validation loop that compares strings? My attempt at the code is included. Thank You, Hank Question 4.6. Write an input validation loop that asks the user to enter “Yes” or “No”. import javax.swing.JOptionPane; import java.text.DecimalFormat; import java.util.Scanner; /** CIS-151, Input Validation Loop */ public … | |
This seems like a pretty basic question, but I'm still learning Java and all the nuances of OOP. I have several classes in my program and they all need access to the same ArrayList (the one with all the data in it.) What's the best way to share that list? … | |
For some reason I am having trouble comparing strings when inside a while statement using the using the && and || operators. while (input.equals("Yes")) && (input.equals("No")) The error message implies the parentheses are ending the statement prematurely. Can someone please give me a suggestion? Thanks, Jim | |
**Following is the code snippet to print the series:-** *111 211 311 121 221 321 131 231 331 112 212 312 122 222 322 132 232 332 113 213 313 123 223 323 133 233 333* **But there's some mistake in the code and it gives ArrayIndexOutOfBoundsException.I'm not able to … | |
FIRST: String str = queryTextArea.getText(); final JTextArea textArea = new JTextArea(); textArea.setFont(new Font("Sans-Serif", Font.PLAIN, 12)); textArea.setText(str); textArea.setCaretPosition(0); JScrollPane scrollPane = new JScrollPane(textArea); scrollPane.setPreferredSize(new Dimension(350, 150)); int res = JOptionPane.showConfirmDialog(null,scrollPane,"Query", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); System.out.println( "showInputDialog: " + res ); if(res==0) queryTextArea.setText(textArea.getText()); Using this I'm unable to resize the document-modal SECOND: String str … | |
How can I terminate resources in a safe way when JFrame is about to close? - If I put terminate() in the a finally block it runs before windowClosing(). - If I put terminate in windowClosing() it can't be accessed from an inner class. I am aware that I shouldn't … | |
public static void sumOfSquareRoots() { Scanner scan = new Scanner( System.in ); double value; // read in a double System.out.print ("Enter a double:"); value = scan.nextDouble(); // calculate its square root double result = Math.sqrt( value ); // write out the result System.out.println("square root of your number is " + … | |
Hi friends , i have a assignmentin my course Information Retrival and text mining. I have to develop a search engine in java. i am reading data from 31103 files and have to do some processing in each... but i am stuck in a logical error, i.e in the loop … | |
Hello ^^ I asked the user for location code and then I need to find if location code is in the array of LOCATIONS and display this result "Region: ! | Location: ! |City: ! " in a method call format .. where the ! marks are the actual values … | |
Hi, Im a noob programmer, Ive done some small programs. Im looking for a guide that may give me tips and guideline for things to do a plan before starting to write your code. | |
I'ma noob and need some help from the pros. For school I gotta make a program to convert numbers into roman numerals 1-10 and return an error if its not 1-10. Got it all pretty much figured out but I want to know how to have it where if someone … | |
Self-teaching Java, I am following a video tutorial about simple windows. Encountered a warning error using the example provided in the tutorial. Here's the piece of code. [CODE=Java]import java.awt.Frame; import java.awt.Label; import java.awt.AWTEvent; import java.awt.event.WindowEvent; public class HowdyByeWindow extends Frame { public static void main( String[] args ) { new … | |
I am trying to get my Java DB setup correctly with NetBeans 7.2 to start building databases. When I leftclick on Java DB every option is greyed out except for Properties. There is no sample databases or anything else when selected, a popup appears requesting Java DB Installation: Database Location: … | |
package mypackage; import java.util.Scanner; public class twinPrimes { public static void main(String[] args){ int userNum = 0; int attemptCount = 0; while (userNum < 3){ System.out.println("Please enter an integer greather than three."); Scanner in = new Scanner(System.in); userNum = in.nextInt(); attemptCount++; if (attemptCount == 3){ System.exit(1); } } int count … | |
This is my first post in the Dani community. I am brand new to java, i'm supossed to make a Java Program to randomize integers from 1-50 into a 4rows by 5collumns array. Display the randomize numbers, then sort and display. Thank you | |
I am unable to send a string from php page to java script page. I am storing a string in a php variable and I want to send this value to java script page on image icon click. Here is the source code: timetrack.php $activityid = $getResult->fields('ACTIVITY_ID'); // Now consider … | |
Hello, iv looked around google and have found it is possible to put an applet into a jframe. The problem i am having is that my applet is to be hosted online, what i want is to take the applet that is online and display it from a swing or … | |
PROBLEM: > Using a text editor, create a file that contains a list of five 4-digit account numbers. Read in each account number, and alter it to add a dash and a check digit, which is calculated by taking the remainder when the original number is divided by 7. Write … | |
Hi, this is my basic program for an assignment but I can't figure out why I am not getting the desired output for the grade printed and why there is a repetition of the Enter Student Name at the end before the program loops again. I have also included a … | |
I noticed that when equals() is used to compare between two String objects it works fine. But when I compare two StringBuffer objects or two StringBuilder objects or mix of String and Builder and Buffer, equals() doesn't work even though I give same string value to the two objects being … | |
Ok so here is what I have and I am stuck. It is not recognizing whether a number is even or odd. So where do I need to put the remainder operator so that it will recognize if a number is even or odd? import javax.swing.JOptionPane; // program uses JOptionPane … | |
I am making a project where i have a rotating and moving 3d cube and on click of any face of cube, that face should be enlarged. All the six faces of cube should have different images. I searched a lot but doesn't get any working. Any help regarding this … |
The End.