Message from Rita Leon Most recent post: 10/28/2007 10 authors and 15 replies. What are the methods/classes in JFC to convert millimeters (or inches or centimeters) to pixels? I remember in windows programming we had DPtoLP() and LPtoDP(). Might there be a JAVA equivalent? ty read more about how to convert metric to pixels
Message from christopher_board Most recent post: 10/28/2007 2 authors and 2 replies. Hi all. I am currently developin a JAVA application that is capable of shutting down computers. I'd like to send a message to the computers to be shutdown a five minute warning so users are aware that the computers are being shutdown. Is there a way that I can send a message a remote computer on a network. Any help in this matter'd be highly appreciated. Thank you read more about Send remote computer a message
Message from christopher_board Most recent post: 10/27/2007 6 authors and 10 replies. Hi all. I am currently trying to develop a JAVA applicatio that will enable me to shutdown or restart computers remotely. I am doing this by using the command prompt code in order to perform the shutdown. For example I am using shutdown -m \\computer name -r -f -t 30. When I run this code in the command prompt and the computer cannot be found on the network it comes up with a message saying that the network path wasn't found. How can I read in the error message that the command prompt provides from within my JAVA Application. Any help in this matter'd be highly appreciated. Thank you read more about Get error message from Command prompt
Message from JediKnight2 Most recent post: 10/27/2007 3 authors and 5 replies. This application runs fine on XP. Vista, however, is giving me some problems. Here is the error log I get in Vista....can anyone help or know what'd cause this? I did upgrade to the newest version and still get the same error... # # An unexpected error has been detected by JAVA Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x77d320e3, pid=3628, tid=1168 # # JAVA VM: JAVA HotSpot(TM) Client VM (1.6.0-oem-b104 mixed mode, sharing) # Problematic frame: # C [ntdll.dll+0x620e3] # # If you'd like to submit a bug report, please visit: # http://JAVA.sun.com/webapps/bugreport/crash.jsp # T H R E A D Current thread (0x013d1c00): JAVAThread "main" [_thread_in_native, id=1168] siginfo: ExceptionCode=0xc0000005, writing address 0x765a1eab Registers: EAX=0x765a1eab, EBX=0xcca51ece, ECX=0x765a1fdf, EDX=0x0000765a ESP=0x0039f9e0, EBP=0x0039fa14, ESI=0x009167d0, EDI=0xcca50000 EIP=0x77d320e3, EFLAGS=0x00010202 Top of Stack: (sp=0x0039f9e0) 0x0039f9e0: 00000000 00910000 014083f0 77a98021 0x0039f9f0: 00000000 765a1ecd 765a1ede 00000470 0x0039fa00: 00000000 00000000 765a1ebc 00000001 0x0039fa10: 014083e8 0039fa28 77d318c3 014083f0 0x0039fa20: 00000000 014083f0 0039fa3c 77b67a7e 0x0039fa30: 00910000 00000000 014083e8 0039fa88 0x0039fa40: 76b8a097 00910000 00000000 014083f0 0x0039fa50: 65e9be9c 00000000 013d1ce8 014083f0 Instructions: (pc=0x77d320e3) 0x77d320d3: c1 ea 10 0b df 0b c8 8b 06 c7 45 f8 01 00 00 00 0x77d320e3: 8 read more about Help with Vista error
Message from csharpdotcom Most recent post: 10/26/2007 5 authors and 17 replies. Hi all, this is my first posting here, and'd most appreciate some kind help. I need to pass a string to the Linux shell from JAVA, and because of the restrictions of the "getRuntime()" method, I'm trying to call up a C program from JAVA to which is I passed a string. The C program then executes the "system()" function containing the string that I want to pass to the Linux shell. The idea eventually is to execute the code as a bean in Glassfish, but I'm having trouble testing it out from the CLI. There seems to be some problem with packages and classpaths. The code is in a file in a folder tree, the last two levels being "/ com/corejsf", and in the programs I have the declaration "package.com.corejsf;" There are four listings as follows: // Listing 1 package com.corejsf; import JAVA.io.*; import JAVA.util.*; class CallUserBean { public static void main(String[] args) { UserBean bean = new UserBean(); String s = new String(); s = "Passing this string to UserBean"; System.out.println(s); bean.setName(s); } } Which calls the class in "UserBean.JAVA" // Listing 2 package com.corejsf; import JAVA.io.*; import JAVA.util.*; public class UserBean { private String name; private String password; // PROPERTY: name public String getName() { return name; } public void setName(String newValue) { System.out.println("Now in UserBean.setName()"); System.o read more about Calling a C function from JAVA using the JNI
Message from kaltizer Most recent post: 10/26/2007 3 authors and 7 replies. Greetings, here is my code: import JAVA.util.*; class BinarySearchTreeSet { // Inner class defining a binary tree node private class TreeNode { private TreeNode left; private Comparable key; private TreeNode right; } // instance variables private TreeNode root, parent, child; // Constructor public BinarySearchTreeSet() { root = null; } // Inserts a key into the set public void insert(Comparable key) throws DuplicateKey { TreeNode newNode; if (search(key)) throw new DuplicateKey(); newNode = new TreeNode(); newNode.key = key; newNode.left = null; newNode.right = null; if (parent == null) root = newNode; else if (parent.key.compareTo(key) > 0) parent.left = newNode; else parent.right = newNode; System.out.println("The name " + key + " was added"); } // Removes a key from the set public void remove(Comparable key) throws NotFound { if (!search(key)) throw new NotFound(); if (child == root) root = deleteNode(root); else if (parent.left == child) parent.left = deleteNode(parent.left); else parent.right = deleteNode(parent.right); System.out.println("The name " + key + " was deleted"); } // Determines whether a key is in the set public boolean contains(Comparable key) { if (! read more about Print a binary search tree
Message from bH Most recent post: 10/25/2007 2 authors and 2 replies. Hi All, The program below determines the distance between cities on a map using 4 clickpoints. The user must: 1. Enter in the textfield on the bottom left the Number scale chosen from the legend . 2. Click the mouse over the first city, 3. Click the mouse over the second city 4. Click the mouse at the start of the legend length 5. Click the mouse at the end of the legend length The result distance between cities is shown in the textfield on the bottom right. I want to draw a line between the 2 cities after the data from clicks one and two are completed, but I am unable to grab the graphics portion of the program to get it to happen, that is after the initial loading the image. Your help is appreciated, bH import JAVAx.swing.*; import JAVA.awt.*; import JAVAx.swing.border.BevelBorder; import JAVA.awt.event.*; //click point public class IconMapShoScale extends JPanel{ private static final String title = "4 Clicks: On Map Start, End Point, then Scale 0, Endpoint"; private static final int width = 750; private static final int height = 750; int deltaAddrX = 0; int deltaAddrY = 0; int points = 4; int distanceResult = 0; double distanceCalc = 0; double deltaScaleX = 0; int scale = 0; String strInc = " " ; Point clickPoint = null; int dataPointX[]= new int[points]; int dataPointY[]= new int[points]; int ptCounter = 0; /* Notes for use.... * Map scale enter number to be used; i.e read more about Drawing line on ImageIcon on panel after getting data
Message from Robert Hicks Most recent post: 10/25/2007 2 authors and 3 replies. I am being thrown into a team to go scope out a project that is being pulled in house. It is JAVA (of course). What'd try to do or ask when meeting with the other team? I'll be talking with the programmers. Robert read more about Questions to ask
Message from christopher_board Most recent post: 10/25/2007 3 authors and 3 replies. Hi all, I am currently trying to develop a JAVA application that allows the user to shutdown or restart a room full of computers at a time. I'd also like the user to have the option to log off the user on a computer or on multiple computers. The computers are being shutdown and restarted by using the command prompt, for example, shutdown -m \\computername -s -t 10 -f. what'd be the simplest way to allow the user to perform a remote log off on a computer. Any help in this matter'd be highly appreciated. Thank you read more about Remote Log Off In JAVA
Message from buu Most recent post: 10/25/2007 3 authors and 6 replies. so, I have an app. servlet+jsp made and already tested in JDeveloper (11), but now, without any reason, when starting that app (through Jdev), I got an error: Oracle JAVA Compiler 11g Unable to create an instance of the JAVA Virtual Machine Located at path: d:\JDeveloper11\jdk\jre\bin\client\jvm.dlland in web browser an error: Request URI:/myapp/main.jsp The following exception occurred: OracleJSP error:oracle.jsp.provider.JspCompileException: Errors compiling:D:\bshare\ViewController\classes\.jsps\\_main.JAVA Error occurred during initialization of VM Couldn't reserve enough space for object heap what could cause the problem?I have an win xp sp2 (32bit), all patches read more about JVM error (from JDeveloper)
Message from shellriley Most recent post: 10/24/2007 7 authors and 17 replies. I have created a few methods that will allow me to add a Student object to a linked list of Student objects. It compiles OK and is running, but when I enter more than one student record the new record creates the additional node, but overwrites the data in all the previous nodes, so I get multiple nodes of the same data. Is it obvious where I have gone wrong? Michelle in my driver class: public static void add_student() throws IOException{ String course_id = offerings.promptCourse(); int index = offerings.searchCourses(course_id); Student newStudent = new Student(); newStudent.promptRecord(); offerings.course_array[index].courseEnrollment.add_Record(newStudent); offerings.course_array[index].courseEnrollment.displayList(); } in a class on its own: public class Enrollment { private Student head; public Enrollment() { head = null; } public void add_Record(Student newStudent) { newStudent.next = head; head = newStudent; } public void displayList() { Student current = head; while (current != null) { current.display_student(); System.out.println("\n"); current = current.next; } } read more about Newbie question re linked list
Message from christopher_board Most recent post: 10/24/2007 4 authors and 4 replies. Hi all, I am currently trying to develop a JAVA program that reads in data from a CSV file. The file has computer names that look something like: RM01_01 RM01_02 RM02_01 RM02_02 RM03_01 RM03_02 When the user selects for example RM01 it'll then filter through the file only showing RM01_01 and RM01_02. All the other computer names won't be shown. How'd I go about doing this. Any help in this matter'd be highly appreicated. Thank you read more about Filtering data from a file
Message from LarsWill Most recent post: 10/23/2007 11 authors and 14 replies. I have problems because of JAVA crashes after garbage collection of weak referenced objects. Can I somehow: a) Convert weak references into hard references ? b) at least get a notication when a weak referenced object is garbage collected ? Lars read more about Can I convert Weak references to "hard" references ?
Message from Ownerman...Aust.. Most recent post: 10/23/2007 3 authors and 4 replies. I just bought a JAVA programming book last sunday online. "JAVA programming for dummies" if any one thinks this is a good one please let me know by posting on my group "computer programming news read more about For dummies
Message from blah bah7 Most recent post: 10/23/2007 4 authors and 4 replies. how do you make threads? read more about threads
Message from blah bah7 Most recent post: 10/23/2007 5 authors and 12 replies. can someone give me some simple code only showing me how to put images on a screen (from an image file) read more about how do you put images on a screen?
Message from D.S.Whitworth Most recent post: 10/21/2007 5 authors and 11 replies. I cannot get my program to load an image and display it. I have read several forums and help sites and have used all the code regarding mediatracker, but for some reason, it simply won't load my images. I have also tried multiple combinations of how I insert the file name. Below is the code I got from a website that seems like it should work, but it won't. I have Windows Vista on my computer...is it possible that is part of the problem? Below is the code I cannot get to work that I got from a website. Any help you could give me would be appreciated. import JAVA.awt.*; import JAVA.awt.event.*; public class Viewer extends Frame { private Image image; public Viewer(String fileName) { Toolkit toolkit = Toolkit.getDefaultToolkit(); image = toolkit.getImage(fileName); MediaTracker mediaTracker = new MediaTracker(this); mediaTracker.addImage(image, 0); try { mediaTracker.waitForAll(); } catch (InterruptedException ie) { System.err.println(ie); System.exit(1); } addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); setSize(image.getWidth(null), image.getHeight(null)); setTitle(fileName); setVisible(true); } public void paint(Graphics graphics) { graphics.drawImage(image, 0, 0, this); } public static void main(String[] args) { new Viewer(args[0]); } } read more about cannot load image
Message from sdlt85 Most recent post: 10/21/2007 5 authors and 16 replies. Hi can some one tell me why I can call union and not intersection. These are the error message "intersection(boolean) in IntergerSet cannot be applied to (boolean[])" where the arrow is. Here is my code: //in main { set.union(arraySetB); ---> set.intersection(arraySetC); } //in anther class public void union(boolean other[]) { boolean res[] = new boolean [SIZE]; for(int i=0; i<SIZE; i++) if(arraySet[i]==true||other[i]==true) res[i] = true; arraySet = res; } public void intersection(boolean other[]) { boolean res[] = new boolean [SIZE]; for(int i=0; i<SIZE; i++) if(arraySet[i]==true&&other[i]==true) res[i] = true; arraySet = res; }Thanks read more about Calling a method
Message from sdlt85 Most recent post: 10/20/2007 3 authors and 4 replies. Hi, I am having problems when I call getUnion. The error message are "getUnion(IntergerSet) in IntergerSet cannot be applied to ()" and "incompatible types" where the arrows are. Here is my code: public void inputSet () { Scanner input = new Scanner (System.in); int value; boolean arraySet[] = new boolean[100]; do { System.out.println("\nPlease enter a value or -1 to finish: "); value = input.nextInt(); if(validEntry(value)) arraySet[value] = true; else System.out.printf("\nYou enter %d to finish entering values", value, "\n"); }while(value != -1); System.out.println("\n\nIf you want to find the union of two sets press 'u': "); String unionSets = input.next(); if("u".equalsIgnoreCase(unionSets)) ---> System.out.printf("\nUNION", getUnion()); } //Finding the union of two sets public String getUnion(IntergerSet other) { IntergerSet res = new IntergerSet(); for(int i=0; i<SIZE; i++) { res.arraySet[i] = this.arraySet[i]||other.arraySet[i]; } ---> return res; } read more about Error message
Message from sdlt85 Most recent post: 10/19/2007 3 authors and 4 replies. Hi, these are the only two ways to declare a boolean array of values 1) boolean setA[] = new boolean [101]; setA[3]=true; setA[5]=true; setA[10]=true; setA[13]=true; setA[16]=true; setA[23]=true; setA[30]=true; setA[35]=true; setA[56]=true; setA[89]=true; 2) boolean arraySetB[] = {false, true, false, false, false, false, false, true, true, false, true, false, false}; read more about boolean array
Message from christopher_board Most recent post: 10/19/2007 4 authors and 8 replies. Hi all, I am currently developing an application in JAVA. In order for the program to get data that it needs it needs to run a script. The script is a VBS script. But I am not sure how I can get this script to run when I press a button. If anyone could help me in this matter I'd be very greatful. Thank you. read more about Run VBS within JAVA Application
Message from blah bah7 Most recent post: 10/19/2007 2 authors and 2 replies. 1. how do you make 2d graphics like the old 70's pac man (better than that...) 2. how do you make it so a computer runs until a key is pressed where it then preforms an operation and then picks up where you left off when you pressed the key 3. how can I make a simple jframe to put the graphics in (i knew this...) thanks for the help read more about 2d graphics and 2 other questions
Message from sdlt85 Most recent post: 10/19/2007 2 authors and 3 replies. Hi I am having problems with my code. It is given me an error message stating "cannot find symbol variable NotCont" on line 26. 1-import JAVA.util.Scanner; 2-public class IntegerSetTest 3-{ 4- public static void main(String[] args) 5- { 6- Scanner input = new Scanner (System.in); 7- 8- System.out.println("Welcome to the Integer Set\n"); 9- 10- System.out.println("This program is going to find the union " + 11- " or intersection of any two sets you enter" + 12- "\nPlease enter the number of sets: "); 13- int intArray[] = new int[100]; 14- int value; 15- try 16- { 17- do 18- { 19- int i; 20- 21- value = input.nextInt(); 22- intArray[i]=value; 23- System.out.println("Enter -1 to end: "); 24- int NotCont = input.nextInt(); 25- i++; 26- }while(NotCont != -1); 27- 28- for(int i=0; i<intArray.length;i++) 29- { 30- System.out.println(intArray[i]); 31- } 32- } 33- catch(NumberFormatException ex) 34- { 35- } 36- } 37-} read more about Error message
Message from slashman Most recent post: 10/18/2007 3 authors and 3 replies. Hi, Can someone give me some pointers on how to launch a program like notepad/textpad from a JAVA program. I am printing a report into a .txt file and the program should automatically open it using a text editor. Thanks in advance Vivek read more about Launching Programs like notepad
Message from Rita Leon Most recent post: 10/18/2007 4 authors and 6 replies. Here is my very simple code: JAVAx.swing.JTree tree; ... DefaultMutableTreeNode root = new DefaultMutableTreeNode("Root"); DefaultMutableTreeNode cat = new DefaultMutableTreeNode("Category"); root.add(cat); DefaultTreeModel dataRoot = new DefaultTreeModel(root); tree.setModel(dataRoot);The problem is the icon for "cat" shows as the sheet of paper icon. How do I get JTree to display "cat"'s icon as the folder icon like that of "root" without adding a child or changing the graphics? ty read more about How to make a JTree leaf look like a folder
Message from sdlt85 Most recent post: 10/18/2007 2 authors and 2 replies. Hi, I want to send the values that the user enters and I am storing them in several arrays in the IntegerSetTest class. It need to be sended to the IntergerSet class to find the union, intersection, etc. Here is IntegerSetTest class: import JAVA.util.*; public class IntegerSetTest { public static void main(String args[]) { Scanner input = new Scanner(System.in); String inputValue; String strArray1[] = new String[100]; int countInts = 0; for(int I = 0; i < strArray1.length; i++) { System.out.println("Enter integers for set A. (Press any other key to finish set). "); inputValue = input.next(); try { Integer.parseInt(inputValue); strArray1[i] = inputValue; countInts++; } catch(NumberFormatException ex) { break; } } int intArray1[] = new int[countInts]; for(int I = 0; I < countInts; i++) intArray1[i] = Integer.parseInt(strArray1[i]); String strArray2[] = new String[100]; countInts = 0; for(int I = 0; I < strArray2.length; i++) { System.out.println("Enter integers for set B. (Press any other key to finish set). "); inputValue = input.next(); try { Integer.parseInt(inputValue); read more about Sending data from one class to another
Message from sdlt85 Most recent post: 10/18/2007 2 authors and 5 replies. //Hi, I need some help. //I am having a error message stating "cannot find symbol variable stop" where the arrow is. //Can some one help me with thie. //Thanks ^_^ import JAVA.util.Scanner; public class IntegerSetTest { public static void main(String[] args) { Scanner input = new Scanner (System.in); System.out.println("Welcome to the Integer Set\n"); System.out.println("This program is going to find the union or " + "intersection of any two sets you enter.\nAlso it'll delete " + "or insert an element and check if the sets are equal." + "\nPlease enter the number of sets: "); int intArray[] = new int[100]; int value; try { do { int i; value = input.nextInt(); intArray[i]=value; System.out.println("Enter -1 to finish: "); int stop = input.nextInt(); i++; ---> }while(stop != -1); for(int i=0; i<intArray.length;i++) { System.out.println(intArray[i]); } } catch(NumberFormatException ex) { } } } read more about Error message
Message from sdlt85 Most recent post: 10/17/2007 2 authors and 2 replies. Hi, I need some help. I am getting an error message stating "cannot find symbol variable NotCont" where the arrow is. Can some one help me with this please. Thanks ^_^ import JAVA.util.Scanner; public class IntegerSetTest { public static void main(String[] args) { Scanner input = new Scanner (System.in); System.out.println("Welcome to the Integer Set\n"); System.out.println("This program is going to find the union " + " or intersection of any two sets you enter" + "\nPlease enter the number of sets: "); int intArray[] = new int[100]; int value; try { do { int i; value = input.nextInt(); intArray[i]=value; System.out.println("Enter -1 to end: "); int NotCont = input.nextInt(); i++; ---> }while(NotCont != -1); for(int i=0; i<intArray.length;i++) { System.out.println(intArray[i]); } } catch(NumberFormatException ex) { } } } read more about Error message
Message from Roedy Green Most recent post: 10/17/2007 4 authors and 12 replies. 1. in FTP is there an easy way to figure out what time the server thinks it is? FTP Voyager for example wants you to configure the timezone of the server but offers no tool to discover it by comparing local time with server time. 2. When you get a directory listing on from the server, are the raw dates transmitted in UTC, server or client time? 3. When you do an FTP upload, the server seems to mark the file with the time it was uploaded, rather than the original file time. Is there an option to correct that? I thought these questions may be of general interest since pretty well everyone uploads files to a website as part of a JAVA project. -- Roedy Green Canadian Mind Products The JAVA Glossary http://mindprod.com read more about FTP Timezone questions
Message from Peter K Most recent post: 10/17/2007 4 authors and 14 replies. Hi, I want to use "JAVACompiler" from my program. Unfortunately I always get a null when I call ToolProvider.getSystemJAVACompiler(). I have read that this is because I have installed a JRE, and not a JDK. But I have both installed - how to I tell my program to find the compiler? I have JAVA_HOME pointing to my JDK, and I can compile from the command- line with JAVAc.Thanks, Peter read more about using JAVACompiler
Message from christopher_board Most recent post: 10/17/2007 3 authors and 3 replies. Hi all, I am trying to develop a JAVA Program that will allow the user to remotely shutdown computers that are attached to the network. I have a JList which Populates the computer names within it. When I select one computer and then press the button for it to perform the shutdown it works without any problems. However if I select multiple computers it'll only shutdown the computer I last select and not all of them. Below is the code that I am using: case 2: System.out.println("Shutdown with shutdown timer, CASE = 2"); try { Runtime.getRuntime().exec( "shutdown -m \\\\" + remoteshutdown.mainScreen.lstComputerNames .getSelectedValue() + " -t " + mainScreen.spnTimer.getValue() + "" + " -s -f"); } catch (Exception i) { System.err.println("" + i.toString()); } break; Any help in this matter'd be highly appreciated. Thank you read more about Getting Multiple Values from a JList
Message from simon_s_li Most recent post: 10/16/2007 2 authors and 2 replies. Hi, Does anyone have any coding example on how to select a text or csv file (file open diagloue box) from my local drive and then read it in the backend using some kind of inputsteam? Thanks Simon read more about Open and read CSV or text file from JSP
Message from andreyvul Most recent post: 10/16/2007 6 authors and 9 replies. This method is supposed to return an array of shorts which represent all of the possibilities for a given sudoku square (where each value is a not-masked bitset with element + 1 equalling position). So far, it gets stuck in an infinite recursion. Where is the inifinite recursion in this method and how do I fix it? short[] allOptions(short val) { Vector<Short> cc = new Vector<Short>(0); Iterator<Short> it; short[] rv; //check which numbers are available short i; for (i = 0; I < 9; ++i) //bitmask check (1 == unavailable, 0 == available) if (((1 << i) & val) == 0) //available, add number to cc cc.add(cc.size(), (short)(i + 1)); //create return array rv = new short[cc.size()]; it = cc.iterator(); I = 0; while (it.hasNext()) rv[i++] = it.next(); return rv; } read more about infinite recursion
Message from Jim Most recent post: 10/16/2007 2 authors and 4 replies. These HTML samples have been simplified to demonstrate an issue. I ventured down this road due to a JAVA applet that was hanging IE7. Other browsers and earlier versions of IE aren't hung by the top HTML example. The "propertyFile" parameter remains to prevent the example from crashing IE7. The "classid" value "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" instructs Internet Explorer to use the latest installed version of JAVA Plug-in. Does anyone know why the long-standing "classid" parameter isn't liked by IE 7? What can be done to keep IE7 from hanging on this? I have no desire to change the instructions to IE. I want it to use the latest installed version of JAVA Plug-in. Thanks, Jim This HTML WITH the "classid" parameter causes Internet Explorer 7 to hang for a while. <html> <body> <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" width="750" height="750"> <param name = propertyFile value="jars/properties/V.properties"> <comment> <embed width ="750" height ="750" propertyFile ="jars/properties/V.properties"><noembed></comment> </noembed></embed> </object> </body> </html> This HTML WITHOUT the "classid" parameter doesn't cause IE7 to hang. <html> <body> <object width="750" height="750"> <param name = proper read more about REPOST: Object Param "classid" hangs IE7
Message from knguyen Most recent post: 10/16/2007 3 authors and 3 replies. Hello, I am working on a project from two computers (one is from home, and one is from my office). Why does not eclipse (in my home computer) detect my project when I copy it from the office's machine to workspace folde