32,199 Topics
| |
I'm not able to do this after trying several times, maybe someone out there will know a way. I have several lists, each have 5 string elements inside them. I want to loop through the list and put each item on a String (if the item hasn't been added to … | |
Hey guys! I created a program that allows a user to display an image from a file chooser. I am trying to add a feature similar to that of the Facebook picture tagging system. When the user clicks on the image, a box with a dialogue box (where you input … | |
Basically in my switch case, I'm trying to get it so if a String is typed in I want to return a message saying "Please enter an integer". I've tried using the try { } catch { } to do this but what happens is that in some of my … | |
Hello Forum, Vaironl here. I'm going to ask a question, that will most likely annoy you all, but first let me say this, I did some research but cannot use a Jscrollbar efficiently. That being said, I want to give more details. I'm trying to add a scrollbar to a … | |
So Im trying to make a boggle program. It loads a text file for the word list. So my question is, How could I allow the user to specify a word and then have the program check if that word is on the game board. Heres my code so far: … | |
my project is that information is inserted or deleted or updated from many location but the database is in one location is this mean that database is centrilized or distrubuited | |
[CODE] import java.util.*; public class PetrinetSim { public int noofplaces=0; public int nooftransitions=0; public inputarc[] ip=new inputarc[50]; public outputarc[] op=new outputarc[30]; ArrayList<place> pl= new ArrayList<place>(); public Scanner in=new Scanner(System.in); place[] p; transition[] t; void createplaces() { int i; p=new place[noofplaces]; for(i=0;i<noofplaces;i++) { p[i]=new place(); p[i].token=0; p[i].id=i; } } void createtransitions() … | |
[CODE]package pack; import java.util.*; class Filltool { Scanner s = new Scanner(System.in); String str; int r = s.nextInt(); int q = s.nextInt(); char ch[] = new char[q]; int arr[][] = new int[r][q]; void insert() { for(int i = 0; i < r; i++) { str = s.next(); ch = str.toCharArray(); … | |
Hi everyone, I'd like to ask our Java experts a simple question about learning Java. I want to know how to learn a programming language in easy steps(if possible) especially Java. Would anyone suggest a good way of learning it and improving the way that from how a normal person … | |
Hi there! So I'm working on my next assignment and it's all about implementing a few exceptions in order to get us familiar with the topic. I am tasked with implementing 3 very simple exceptions to my previous program. So far I have 2 out of 3 working fine with … | |
Hi! I'm wondering if there is a tool to make the following functionality in an wasy way. I have a project in eclipse and I use perforce for versioning. I want to be able to compare the project between two dates and determine which classes/packages etc. that have been added … | |
Hey here is the task. 1. Design a class, called People, that includes a person’s name and a weight with a constructor, 2 getter methods, and a toString() method. 2. Design a second class, called PeopleList (like the IntegerList lab or CDCollection class) that has an array of People, and … | |
Hello all. I am trying to use java excel code that requires that i use a throwable class along with a main set up like this. [CODE] public void t()throws IOException{ GmailClient newGmailClient = new GmailClient(); newGmailClient.Main(); newGmailClient.addWindowListener ( newGmailClient ); newGmailClient.setInputFile("c:/Book12.xls"); newGmailClient.read(); } public static void main(String[] args)throws IOException … | |
Can someone please explain to me why I am getting errors with this? [CODE] /** This class stores data about a room. */ public class Room { private int walls; // Number of walls private int windows; // Number of windows private String ceiling; // Type of ceiling private String … | |
here is a snippet from my code, my jbutton action listener [CODE]private void jButton1_actionPerformed(ActionEvent e) { System.out.println("\njButton1_actionPerformed(ActionEvent e) called."); String username = new String(jTextuser.getText()); String password = new String(jTextpass.getText()); String passwordconfirm = new String(jTextpassconfirm.getText()); String email = new String(jTextemail.getText()); String emailconfirm= new String(jTextemailconfirm.getText()); if(username.equals("") || password.equals("") || passwordconfirm.equals("") || email.equals("") … | |
Hey guys, I'm making a gpa calculator and almost have it completed but can't get it to read the grades and calculate the gpa properly. Any help would be great! [CODE]import java.util.Scanner; public class StudentGPA { public static void main (String args[]){ //User inputs the number of classes he/she has … | |
I am using this code in a jbutton to open a webpage from my java application. [CODE] try { //Set your page url in this string. For eg, I m using URL for Google Search engine String url = "http://www.google.com"; java.awt.Desktop.getDesktop().browse(java.net.URI.create(url)); } catch (java.io.IOException e) { System.out.println(e.getMessage()); } [/CODE] Though, … | |
Hi can you help me please to Write a java class which prompts the user for an hourly rate (a double). The program should then calculate the wages for a 40 hour week using a while loop to count the hours and adding the hourly rate each time to the … | |
the output of this program should return the number of letter in words [CODE]/** * @(#)Coun.java * * * @author * @version 1.00 2011/11/18 */ import java .util.Scanner; public class Coun { Scanner input=new Scanner(System.in); public static void main(String [] args) { System.out.println("Enter a string: "); String[] arr = input.nextInt(); … | |
I'm trying to make a program that has the possibility to vote for different people. When a vote is added to a person, I want the pie chart above to change according to the votes. I have everything done except for the part of the pie chart changing. This is … | |
I've found really good information/tutorials online for writing from my java application to my MySQL database. Can someone direct to one on retrieving information from my database to store as variables in my application? Thanks Peace and love, oldezwe | |
I imported all the required jar files into build path, and almost all other eclipse class and events, e.g. SWT, widgets, graphics, selectionevents are working. However, but when I try to create an instance of CoolBar and DateTime, found that import these 2 classes are unavailable, and importing SWT.*, SWT.widgets.* … | |
So I was given a code about IO to understand [CODE]// The "FileIO" class. import java.awt.*; import hsa.Console; import java.io.*; public class FileIO { static Console c; // The output console public void writeFile () { PrintWriter output; String fileName; c.println ("Saving a File in Java!"); c.print ("Enter file name: … | |
I have an assignment on recursion that calls for me to use recursion to find the largest element in an array. I have a general understanding on how recursion works but this problem throws me off because I can't figure out how to correctly implement the getMaximum() function which is … | |
I am trying to access a varible value from a return fuction in another class. Everytime I attempt to access the variable, it returns a null value. This is selecting from a choice control Part of the first class called CheeseBread [CODE]public void itemStateChanged(ItemEvent e) { if(e.getSource() == total1) { … | |
I'm working on a program for class that uses the method Math.random( ) to generate random integers between 1 and 6. Then generate ten-thousand numbers between 1 and 6. Then calculate the number of 1 that has appeared, the number of 2 that has appeared, and so on. The final … | |
Hello everyone, I'm new to Java. I found this site and the members to have a lot of knowledge and was hoping I can get some assistance. I have written this 2D array code to find the lowest value in each row and return the values. "getLowestInRow" is the method … | |
I am writing code that opens notepad, but when I want to write an exclamation mark it throws an error; here is the code I am using to write the exclamation mark. [CODE] robot.keyPress(KeyEvent.VK_EXCLAMATION_MARK); robot.keyRelease(KeyEvent.VK_EXCLAMATION_MARK); [/CODE] Why is it giving me the error? | |
package ch07_auxiliaryclasses.taxcalculator; import java.awt.*; import javax.swing.*; import java.awt.event.*; public class UPAdvisor extends JFrame implements ActionListener { JButton displayadvice = new JButton("Displayadvice"); JTextField displayadviceTxt = new JTextField(11); JSpinner ucasPointSp = new JSpinner(new SpinnerNumberModel(0,0,180,10)); JRadioButton Degree = new JRadioButton("Degree", true); JRadioButton FoundationDegree = new JRadioButton("Foundation Degree", false); ButtonGroup bg = new ButtonGroup(); … | |
I need to ask the user for 3 dates (mm/dd/yyyy) and then it needs to print the earliest, latest and the average year. I am TERRIBLE at this & am taking the class because I have to. I don't know how to compare dates any other way than how you … |
The End.