32,199 Topics
| |
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 … | |
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) { … | |
I'm using a JTable with a DefaultTableModel. I use the Load Button for populating the JTable. Anyway, the problem I have is with the Delete row button. (defaulttablemodel.removeRow). This is the whole project: [code=java] package proiect1; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableColumn; import java.io.*; import javax.swing.event.*; import javax.swing.table.TableModel; import java.util.ArrayList; import javax.swing.table.AbstractTableModel; … | |
Hi.. this is my code: [code] import java.util.Scanner; public class Arrays { //private variables private int[][] list = new int [12][2]; private int highest; private int lowest; //public functions Arrays(){ highest = 55; lowest = 5; list = new int[12][2]; } public int getData(){ Scanner input = new Scanner(System.in); for … | |
How can I develop IPhone games with Java? I've tried something called XMLVL but that doesn't seem to be up to date and I can't use it because they don't have anything I can download to use... So is there any other alternative? | |
I can't get my userName variable right, it prints out user name the first time, but the second time it prints out null...I've been at this same problem for nearly 24 hours. [CODE]import java.util.Random; import java.util.ArrayList; import java.util.Scanner; public class mlab { // instance variables - this instance will get … | |
if i have a text file with data: test, 1, 2 again, 3, 4 Can someone give me an idea how to start puting each line into an object ? ObjectName o = new ObjectName(String s1, String s2, String s3); [CODE] class Action implements ActionListener { public void actionPerformed (ActionEvent … | |
hi everyone, i need some help implementing some functions into my code. Right now, all it does is have a rectangle appear on the screen and I can change its color via the radio buttons. I'm thinking I need some sort of grid/cells on the left side of the panel. … | |
I am having problems with the output of my program The program is to design a classed named Employee. The class should keep the following information in fields: Employee Employee number in the format XXX-L, where each X is a digit within the range of 0-9 and the l is … | |
When I try to run the file I get this error, amen't sure how to fix it. [CODE]Exception in thread "main" java.lang.IllegalArgumentException: illegal component position at java.awt.Container.addImpl(Container.java:1035) at java.awt.Container.add(Container.java:408) at EmailWindow.CreateContent(EmailWindow.java:65) at EmailWindow.<init>(EmailWindow.java:22) at Lab6a.main(Lab6a.java:10)[/CODE] Heres my code sorry for lack of comments [CODE]import javax.swing.*; import java.awt.*; import java.awt.event.*; public … | |
hey, can anyone help me with these comlexity problems? I tried with myself but still want some clarifications..cheer,here is the code: [CODE](a) public void printPow2(int[] values) { for (int i = 1; i < values.length; i *= 2) System.out.println(values[i]); } (b) public void maxDifference(int[] values) { int max = 0; … | |
i want to know how to put the path in the fuction Naming.lookup ("//...."). suppose that i want to call the remote object in 2 cases: 1. server and client stands on local machine for example remote object and sever stands in folder c:\rmi i want the exact path please … | |
Hey guys, I'm new here and a n00b in Java, trying to figure things out though :) I want to make a polygon move in a Java Applet but I keep struggling with the keylistener (aka it doesn't do anything) Maybe someone can help me please? Here's my code: (I'll … | |
Hi, I have a text file that I'm going to read, and then parse it. After parsing it, how do I return it into it's original position or layout as before? Because now after parsing it, my output is printed out individually, instead of printing it out how it looks … | |
I am writing a toString method where a it returns three integers. If any of them are less than ten I have to add a zero before the number. For example if I had the variables 5, 6, and 2 it would read 05:06:02. I really can't figure out how … | |
Hey, Iam trying to write a java application that acts as a one-word Pig Latin translator. The program should: 1.ask the user to enter a word 2.convert the entered word into proper Pig Latin translation, (I have to use a method named translate to get the Pig Latin translation of … | |
Ok, I'm getting a little confused on how to do this. Basically i got N stacks of cards. And need to check the topCard of every stack and check that N - 1 cards match then remove them. I peeked every stack of cards to get the top card, and … | |
Right now Iam writing a program that will convert english into piglatin. Ans I have pretty much finished the program, but Iam stuck and need help. When I run the program, nothing happens after I type in the users input. What am I doing wrong. Heres my code, [code]import java.util.Scanner; … | |
My question is... what is the int times for? i dont understand what i am supposed to do with it. Here are the instructions about this method: String[] generate(String symbol, int times) In this method you should use the grammar to randomly generate the given number of occurrences of the … | |
I am writing a program that reads text but must ignore case, spaces and punctuation while evaluating a string for palindrome. When I use the following the case issue is solved. [CODE] String str = ""; if (str.toLowerCase().charAt(LHS) != str.toLowerCase().charAt(RHS)) [/CODE] ...but when I use the following I get IndexOutOfBoundsException … | |
I have an application I'm making... And it has a canvas in it. The problem is, on the y axis, my canvas is offset by ten pixels downward and I can't figure out why. You can see what I'm talking about in the screenshot. Do you know what's wrong? | |
Hi, i only know the Java basics and really need help! I have a class called temporaryHolder which holds an arrayList of 54 cards. However, I need to get elements out of this arraylist and need to add them to stacks in another class. Q1) How can I access all … | |
Hi! I've decided to open a new thread for discussing the problem with uploading a file to a SUB-FOLDER at the FTP Server. So, I'm using Apache Commons library and I can upload my file to the Home Directory of the FTP server. However, if I want to upload it … | |
I have this problem when i create a sortable JTable with data load from an ArrayList! My project is Student Management and i add some function like Add/Edit/Delete infomation. With unsortable JTable, add/edit/delete function is ok, but with sortable JTable, when i click on the header of one column, that … | |
i am doing a desktop application using netbean6.8 how to show error message if i didnt enter mobile number textbox pls help me.... | |
Hi everyone, how do i push item with a givin index in a linkedlist. e.g. linkedlist.add(element e, int index); this is my function [CODE]public void push(Student s, int index){ if(isEmpty()){ start = s; }else{ last.next = s; } last = s; size++; }[/CODE] | |
Hi! I would like to develop a software that will allow me to find a file (using JFileChooser) on a local machine and save it to a remote machine. I know an IP address of the remote machine. Please, give me some explanations or a link to some tutorials regarding … | |
I want to set up a connection to a Microsoft SQL Server 2005 express on my PC. [code=java] try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con = DriverManager.getConnection( "jdbc:mysql://localhost/db1","xxxx","yyyy"); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("SELECT nume FROM tabel1"); while (rs.next()) { String s = rs.getString("name"); textArea.append(s); } } // Catches any … | |
Is there anyway to play an mp3 file in java? P.S I'm new here, hello world? | |
The problem is that when we use multiple threads and each containing System.out.println(). It doesnt print at time according to what i think it shoud On implementing the below 2 codes: [CODE] import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.SocketException; import java.util.concurrent.LinkedBlockingQueue; import java.util.logging.Level; import java.util.logging.Logger; class E { LinkedBlockingQueue<DatagramPacket> li = … |
The End.