32,199 Topics
| |
Hey there, I've got a small problem. I'm writing an UDP client-server system, and I wanted to use streams with UDP. I found [UDPOutputStream](http://www.java2s.com/Code/Java/Network-Protocol/UDPOutputStream.htm) source and pasted it into my project. Now, when I try to initialize it, it freezes. This is how I try to initialize it: outStream = … | |
Hello I'm tring to creat a specific Look in my Java JUI but my code is giving me errors when I try and launch it. Here is my code please take a look and tell me where i'm going wrong. Its a simple login interface for my program: import java.awt.*; … | |
Hi! I'm trying to create a method for simultaneous dragging a group of JLabel components. First, I select the components to be dragged ([ICODE]getSelectedStatus() -> true[/ICODE]), and then I want to be able to drag the selected components. I have a working method for a single JLabel component, but there … | |
I am looking for your opinions on the best site or book in order to learn java. I am currently in school for C.S. learning C and would like to expand my knowledge. Thank you in advance. | |
Hi, I'm using IReports to generate reports to my netbeans project. The reports which dosen't contain a chart, runs in the run time(Netbeans) and execute well. but when i add a bar chart to the report it gives the following exception even though the bar chart report successfully compile and … | |
I am currently making a game and am working on the town code right now. I have booleans for the areas in and out of the town, but when I go to leave an area it resets me back at the beginning of the program. I have it set to … | |
hi whats the meaning of these signs? for example: [B]System.out.printf("[COLOR="Red"][U]%6s %6s %10s[/U][/COLOR]", "x1", "x2", "(y1, y2) \n");[/B] | |
I want to add another Page to my Applet when clicked Submit, and to be clear need to retrieve data from the server where data is logs. please let me know what shall i do. package com.stage.logs; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.applet.*; import javax.swing.*; import javax.swing.plaf.TextUI; public … | |
Let's say I have a method called 'test' which should return the arraylist called 'theList' containing X number of Integers. How would I do that? public static void test(){ SOME CODE ... return theList } What should 'void' and 'theList' be replaced with in that code to make it work? | |
Hi there i am trying to write a java code that will essentially be like a gps but a lot simplier and i need to make a mini map about 4 by 3. where Dunada and Government is the first intersection and i have already done so by using multiple … | |
I can not figure out why my code won't work. public static void GenerateRandomTriangles(int numTriangles) to create a file RandomTriangles.dat having the following format (including some comments like the ones shown below) with random integer coordinates (x, y) of the three vertices of a triangle. Each x and y will … | |
as i m working on implementation of rsa algorithm,and during maiking console of it i found an error int cannot be dereferenced and i m unable to solve it because of working on java first tym...help me here is my code import java.lang.*; import java.math.*; import java.util.*; class rsa { … | |
Please help me...How to connect a jfilechooser and a jtree that takes the file system view of my pc..i need whenever a node is selected in jtree it automatically set as a current directory in the jfilechooser.. | |
I create a UnorderedLinkedList to split my sublist public class UnorderedLinkedList<E extends Comparable<? super E>> extends LinkedList<E> { public void splitMid(LinkedList<E> subList) { Node<T> current;//the head pointer Node<T> mid;//the mid point //Node first = firstNode; //Node last = firstNode; //Node subListFirst; //Node subListLast; int i; if(head == null) { subList.head … | |
I want to create a windows appliation in java using Swing in Netbeans. I want to create the student maintenance details, with Mysql as backend. I dont know how to load the frames in single form. Example, if the user give user name and password in the text box and … | |
Hi sir, I am student and I like to know about the algorithm for developing a MLM software for my final submision So, kindly tell me which algorithm works for the MLM software developement...need urgently please help.... | |
hi i need help is there anyone here have the knowledge of java to retrieved files in the folder and print it out im using this script File folder = new File("your/path"); File[] listOfFiles = folder.listFiles(); for (int i = 0; i < listOfFiles.length; i++) { if (listOfFiles[i].isFile()) { System.out.println("File … | |
I took a different view with Delete States. I decided to implement it like the InsertAfter method by using a Boolean, but I am pretty sure I am doing it right, but it only displays one state after I implement it. My Code for the Delete /** * * @param … | |
import java.util.*; public class ArrayListTesting { public static void main(String []args) { LinkedList<String> list = new LinkedList<String>(); list.add("apple"); list.add("pear"); list.add("tree"); Iterator <String> iterate = list.iterator(); System.out.println(iterate.next()); System.out.println(iterate.previous()); System.out.println(iterate.next()); System.out.println(iterate.hasNext()); } } it keep telling me it an error. | |
Hello my question is fairly simple though I can't seem to find the solution. I'm writing a program that basically calculates the area of different shapes. I am making a seperate method per shape to do the calculations but in my main method I need to call the method according … | |
Here is my Code...Im just confused on how to make a Driver class for this. Any help would be great! I know there shouldnt be a Main but it was the only way i could test my drawing on eclipse since i dont really get how to use a driver. … | |
Hi, I had an assignment where we had to fox a program and get it working correctly. I fixed 99% of the problems and the program runs correct. The only thing that is wrong is my insertionSort() method. It runs correctly, but in the wrong order. Currently its listing names … | |
I have to insert State objects into the link list, but the linklist is sorted I placed my notes in my code. Any help would be appreciated. public void insertAddStack() { int probe=0, index=0; States key=null; for (; index < addStackItems; index++) //loops through keys { for (; probe < … | |
This code is a java code. Can you please help me convert this to c#? private static URL URLObj; private static URLConnection connect; static String source = ""; public static void main(String[] args) { try { URLObj = new URL("http://students.usls.edu.ph"); connect = URLObj.openConnection(); connect.setDoOutput(true); } catch (MalformedURLException ex) { System.out.println("The … | |
Ask an user to type in a password, a qualified password should follow the constraints, such as: Length of password >= 8 Include at least one uppercase character Include at least one lowercase character Include at least one integer Include at least special character Write a program to check if … | |
public class QS { public static <T extends Comparable<? super T>> T[] quickSort(T[]array) { return doSort(array, 0, array.length - 1); } //some other methods................. public static void main(String [] args){ QS qs = new QS(); int [] nums = {4,7,23,1,2,45,23,11}; qs.quickSort(nums);//gives error } } I am getting an error in … | |
Im trying to get the output to read on one line such as this: Reference String 1 2 3 where 1,2,3 is the number the user enters. Instead the output is as such: 1 2 3 Reference String. How can I improve this to read correctly? import java.util.Scanner; public class … | |
The code below works: public class concat { public static void main(String[] args){ String[] filters = {"A","B","C","A","K","C"}; String[] values = {"1","2","3","4","5","6"}; String a = ""; for(int i=0;i<filters.length;i++){ String temp = filters[i]; for(int j=0;j<filters.length;j++){ if(filters[j].equalsIgnoreCase(temp)){ a += values[j] + " "; values[j]=""; } } if(a.trim().length()!=0){ System.out.println(temp + " [" + a … | |
Having an error code and my brain is fried. Can someone please help Here is the part of the code that the exception points to. | |
import javax.swing.* ; import java.awt.event.*; import java.awt.*; import java.io.*; import java.util.Calendar; import java.util.*; import java.text.*; /* <applet code="gui.class" width=250 height=100> </applet> */ class gui extends JApplet implements ActionListener { JTextField t1,t2,t3,t4,t5; JLabel l1,l2,l3,l4,l5,l6; JButton b1,b2; Calendar c1,c2,c3; JPanel p,p1,p2; Date sd,sd1; SimpleDateFormat sdf; public void init() { SimpleDateFormat sdf = … |
The End.