35,618 Topics
![]() | |
Hello! I am working through some program to auto-print files to a post script printer via the LPR command. The entire program is running, going through directories, finding the files, then deleting the files. Before deleting the files, though, I added in a section to try and print the files … | |
import java.io.*; import java.util.*; public class Reverseing { public static void main(String[] args) throws Exception { File f = new File("backwards.txt"); Scanner finput = new Scanner(f); String sentence = "", s = "", r = ""; while(finput.hasNext()) { sentence = s + finput.nextLine(); } ArrayList<String> lines = new ArrayList<String>(); ArrayList<String> … | |
Hello I am trying to figure what kind of code that would be needed to add a JTabbedPane to an JInternalFrame. I have 7 tabs added now (as many as I need) they are added by simply adding(hard coded) the "text name" to an array and every time the program … | |
Does anyone know how to put an Image in a Box Layout...just beside the buttons....Pls post me the code if anyone knows it? | |
Hey guys, I am trying to store a varying number of coordinate points in an array. So i thought of a list, and declaring this list as an arraylist using the Point class. Make sense so far? Or am i incorrect already? In doing so i came up with this: … | |
Hi guys, I've hit a problem I'm hoping someone can help me with. I'm trying to create a little irc bot application, just to learn how to use sockets in Java. Everything works fine so far up to the point where I try to pass the data coming from the … | |
I have to write a program using accessors and mutators and a constructor that stores a savings account's annual interest rate and balance. The class constructor needs to accept the amount of the savings account's starting balance. The class needs to have methods for subtracting withdrawals, adding deposits, and adding … | |
hello I'm trying to make a program that allows you to return and calculate the shortest common supersecuence using dynamic programming. The basic ideas of supersecuence common Shortest to search a given set of strings for example L, the smallest chain, which is one for each string supersecuence L. the … | |
we r making an image viewer for our mini project....n we hav tried doing it on our own ..but we are able to show only 1 image ...how to show many images using say 10 images in database?? we want functionalities like easy preview of next / previous image from … | |
is there any sample of java topological sort algorithm based on minimal vertex method. I also need to implement the ADT graph using adjacency lists representations | |
This particular snippet will display a chessboard in a new frame. Needless to say save it in a file named "chessboard.java". | |
basicallt i want to make a simple quiz...and the quiz contained 20 questions...but i have no idea in looping the question...so can anyone help me? [CODE]import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.Random; class Quiz extends JFrame implements ActionListener{ private JButton submit,next; private JTextArea text; private JTextField answer; private JLabel … | |
hello everyone i have created a text editor using java swings, my problem is that sometimes all features are working perfectly and sometimes they are not.... i wrote the entire program in one file and the no. of lines in it are 1770,is this a problem for that kind of … | |
import java.util.*; public class KeywordSearch { Scanner input = new Scanner(new File("keyvalues.txt")); Map<String, Integer> wordCountMap = getCountMap(in); for (String word: wordCountMap.keySet()) { int count = wordCountMap.get(word); while (input.hasNextLine()) { line = input.nextLine(); numLine++; Scanner word = new Scanner(line); while (word.hasNext()){ String nextWord = word.next(); numWord++; numChar = numChar + nextWord.length(); … | |
import java.util.*; public class Dice { public static void main(String[] args) { String strInput; Scanner console = new Scanner(System.in); System.out.print(" Please enter desired sum: "); do { Random r = new Random(); int count = 0; int dice1 = 0; int dice2 = 0; a = random number; b = … | |
Hi everyone, I am doing a program here to ask question about alphabet, and i am only in the middle of it and i face some problem that i really cant solve, need some help here... ok the problem is, for(int j =0; j<20;j++), in output, the 1st jlabel.setText(j) is … | |
Here is my code for word count from command line. Ive got it reading what is in the command line but its not reading the file it just reading the words from the command line. [CODE]import java.io.File; import java.io.FileNotFoundException; import java.util.*; public class WordCount { public static void main(String[] args) … | |
Hi Everyone, I am searching the most effective way of sorting a list of objects. Say i have a bean [CODE]public class MyClass { private string name; private string id; // Getters and setters } [/CODE] Now say we put some values in a List [CODE]List<MyClass> myClassList = new ArrayList<MyClass>(); … | |
Hi all! I'm making an MMO in Prof. Mark Overmars' GameMaker 7. I am making an applet for it, which I will embed into a webpage. When loaded, the applet will execute the .exe which will be stored in the same directory. Anywho, I want to make a loading bar … | |
Hi all, I have a question that , can we use java program as c++ program? Means, when we compile a c++ program we get a .exe file and we can run it anywhere or send to any one. Is the same possible in Java? As I know java creates … | |
Hello, As a newbie i would like to ask someone to provide me with the code that [URL="http://bookshop.blackwell.co.uk/"]blackwell.co.uk[/URL] is converstion an ISBN-10 to an ISBN-13 through the search box. For example if i paste an ISBN-10 on their search box and click search the system automatically converts it in ISBN-13 … | |
Hi guys I would like some help with creation of Java ME class I have only been capable of coming up with the peudo-code Can someone please assist? Thanks CLASS ImageGetter Method 1: CREATE a connection to a remote server to request the image Method 2: RECIEVE the image and … | |
here I have code in python and now I want to transfer it in Java. import logging import urllib import re from waveapi import events from waveapi import model from waveapi import robot from waveapi import document from django.utils import simplejson from google.appengine.api import urlfetch def OnDocChanged(properties, context): #Get Contents … | |
Hi all, I'm writing a card game but I can't seem to set the cards in the deck. I'm getting a runtime exception error, whether I first try to set the suit or the rank. Here's my code: Card.java [CODE]public class Card { private String suit; private int rank; Card() … | |
I have a small desktop application created, i wan to create a login function for this. i have a database using MySQL which stores user name and password. i wan to know how to compare the user name and password entered in the text field with the data in the … | |
I connected jsp with mysql. i m beg. level programmer in JSP. So, plz dont comment on my code writing style, bt plz help me to improve ma programming. I can execute query bt whn i try RESULTSET to retrive, getting error. my code is below : <%@page import = … | |
Hi all, I'm basic programmer of Java..I tried to use JFormattedTextField for the first time.. It's giving error in importing sentence only.. I hav written import javax.swing.JFormattedTextField; It shows error "Cannot resolve symbol class FormattedTextField" I don't know what the problem is..Everything seems right..Please help me.. | |
Write an addressBook class that manages a collection of Person objects,An addressBook object will allow the programmer to add,delete,or search for a Person object in the addressBook. code: import java util.*; class AdressBook{ private String person,inputstr; private int age; char gender; Person Bob; Bob=new Person(); for (int i=2;i<names.length-1;i++) names[i]=names[i+1]; for … | |
[CODE] public class TryCatchTest { public static void MyNumber(String x) throws TryCatchException1{ try{ String y = x.substring(0,200); }catch(TryCatchException1 e){ System.out.println("BBBBB"); System.out.println(e.getMessage()); // e.printStackTrace(); }catch(java.lang.StringIndexOutOfBoundsException e){ System.out.println("AAAAAAA"); e.printStackTrace(); e.getMessage(); } } } class TryCatchException1 extends java.lang.StringIndexOutOfBoundsException{ TryCatchException1(){ super(); } TryCatchException1(String msg){ super(msg); } }[/CODE] why is my exception not caught on … | |
Ok following the suggestion from another user I have switched over to a GroupBagLayout. Following the java tutorial in hindsight this seems easier. But alas, I have ran into a problem which does not make any sense to me. See screenshot: [url]http://img189.imageshack.us/img189/1060/groupbaglayout.png[/url] I have started from a top down approach … |
The End.