- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 4
- Posts with Upvotes
- 4
- Upvoting Members
- 4
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
52 Posted Topics
Re: I'm interested to see what this looks like - could you post a screenshot of your application running? I'm using Ubuntu at the moment and can't get it working. Will try it later on Windows 7 when I get a chance. | |
Re: Okay, what code have you got so far? | |
This code works perfectly fine when I run it as a class file (the font is located in the same directory) - however when I package it into a JAR file it can't find the font and the program crashes. The font is definitely being included in the JAR archive, … | |
Re: Check which button the user clicked on, then create your new JFrame and call [ICODE].setVisible(true)[/ICODE] on it. | |
Re: I agree completely with James. Without seeing the code itself, it sounds okay so far. Building on his post: Anything that might change in the future (like the file name) could be given a default value in the class. Then provide two separate constructors, one of them allowing you to … | |
Re: Taywin, the syntax the OP used is also valid. It's a for-each loop. Examples: [CODE] // String[] names for (String name : names) { ... } // int[][] ARRAY for (int[] data : ARRAY) { ... } [/CODE] However I think this is the place where the Exception may be … | |
Re: [QUOTE]I am new to the LinkedList concept[/QUOTE] I would strongly suggest reading Wikipedia for a good explanation of Linked Lists as well. It may help you to grasp the concept a bit better: [URL="http://en.wikipedia.org/wiki/Linked_list"]http://en.wikipedia.org/wiki/Linked_list[/URL] | |
Re: Which XML library are you using, which DBMS are you using, and what code have you written so far? Help us to help you :) | |
Re: Try BorderLayout. I'll try to give you a step-by-step walkthrough: [LIST=1] [*]Create a JFrame - [ICODE]public class MyFrame extends JFrame { ... }[/ICODE] [*]Get the content pane - [ICODE]JPanel contentPane = (JPanel) this.getContentPane()[/ICODE] [*]Set layout manager to BorderLayout - [ICODE]contentPane.setLayout(new BorderLayout())[/ICODE] [*]Add a text area in the centre of the … | |
Re: What you have used above will work, but you need to point to an existing Java source file. Try putting it on your Desktop and trying something like this: [CODE]C:\Program Files\Java\jdk1.7.0\bin>javac C:\Users\MyName\Desktop\HelloWorldApp.java[/CODE] Adding the JDK to your system path is a more long-term solution, which would allow you to call … | |
Re: Could you post a link to this library, and show us your code? | |
Re: [QUOTE]- this part I am not sure how to write at all - Implement a Java class (PrimeProgression) that extends the Progression class so that each value in the progression is the smallest prime number that is greater than the previous one. The default constructor PrimeProgression() use 2 as the … | |
Re: I would suggest asking your teacher or lecturer what they are looking for, as they will end up marking your "Assignment 1". The main method can be placed anywhere within the class definition for VendingMachine: [CODE] public class VendingMachine extends java.lang.Object { // Main method somewhere in here } [/CODE] … | |
Hey everyone, Usually when I create a Java application I will use the built-in Preferences class to save user preferences. I believe this saves user information to the registry on Windows, and to other locations on Linux / Mac OS X. When I need to store a serialised object, I'm … | |
Re: You need to set the Look & Feel [I]before[/I] you create any frames! It seems that you are only doing this after having created the first one? Try setting the L&F in your main method, before you create the first frame (put the main method in a different class, not … | |
Re: [CODE] public int nextDay() { int next; next = day + 1; return next; } [/CODE] What if the day is Saturday (number = 6) ? Then you'll just increase it to 7, but what you really want is to reset the number to 0. Same happens in reverse (previous … | |
Re: Is this the HTML Parser you are referring to? [url]http://htmlparser.sourceforge.net/[/url] | |
Re: Are you allowed to use a JButton? The simplest way to do this would be to add a JButton that covers the whole frame, and resize the frame however you want when the button is clicked. Otherwise, you'll have to set up a mouse listener on the frame. | |
Re: Does this help? [CODE] public static void printABs(int n) { // Loop: start at i=1 and go to i=n // Create a queue, and add "A" and "B" // For every character X in the queue, Print out strings that are i characters long, starting with X } [/CODE] Just … | |
Re: Just put the whole thing in a while loop. [CODE] while (true) { // Program here // Ask user if they want to continue // If yes, do nothing. If no, "break" out of while loop. } // Any code you want to execute before the program ends goes here … | |
Re: What have you done so far? | |
Re: Pretty sure this isn't possible. An OS would generally prevent you from messing around with other applications for security reasons. | |
| |
Re: Firstly, create the frame and set size/location and any other properties. Then make it visible as masijade posted above. You would set the first frame as parent of the second frame. Make this code execute in an action listener. For example, when someone clicks a button the second form could … | |
Re: I had problems with XML-RPC in Java a few months back, but eventually got it working. It looks like you're heading in the right direction. You seem to be using the correct libraries. Do you know why the connection is being refused? Is it possible that you need to authenticate … | |
Re: I'm a stickler for spelling and grammar ;-) You may want to change "[I]How many possablilities[/I]" to be "[I]How many possibilities[/I]" (you've misspelt it!) | |
Re: Yes, okay. So go and create it! ;) Unless you had a specific question to ask? | |
I have imported the Apache XML-RPC jar files, and got them working (has taken me all day to figure out how to get it working - so I'm kind of frustrated at the moment ;D) ... but that used the execute(..) method which requires two parameters ... there was no … | |
I am attempting to access an XML-RPC API method using a Java client. I'm fairly certain that the server is written in Python. The API is part of the wiki farm Wikidot.com API info: [url]http://www.wikidot.com/doc:api[/url] API method info: [url]http://www.wikidot.com/doc:api-methods[/url] Does anyone here know what the equivalent of this statement is … | |
Re: Which operating system are you using? It's different depending on whether you're using Linux, Mac OS X or Windows. | |
Re: I strongly suggest that you use an IDE instead of just a text editor and console to compile - it will help you to debug your own programs :) I added your code to a new project in Eclipse and it claimed that the error was on this line: [CODE]public … | |
I've created a Java application and converted it into JAR format to redistribute. It works fine on Windows 7, Windows XP, SunOS and Mac OS X 10.5 ... but whenever I try to run it on Ubuntu 10.04 I run into a few problems: [LIST] [*]When running the application it … | |
Re: What are you trying to print from? The JTextComponent has a print method, for example. You could use that..? [url]http://java.sun.com/javase/6/docs/api/javax/swing/text/JTextComponent.html[/url] | |
Re: What do you want to do? - Use the toString() method of an existing class - Write your own toString() method for a class of your own ? | |
Re: If "B tree" means "binary tree", then I can probably help you with that as I've used them recently. Same goes for AVL trees. What code have you written so far? | |
Re: This is a wild guess - but could an Undo/Redo-style feature be used for back/forward navigation? Other than that I have no suggestions and have no idea if there is any more ideal solution available (still a newbie and still learning!) :) | |
I'm trying to list a bunch of buttons vertically, but am having problems even getting that much done. I'm pretty sure I have the scroll pane working (it just isn't being used yet so I can't test it). This is part of an assignment so I'd prefer not to post … | |
This is code I've taken from another website, and adapted to work with the JFileChooser. I got it working so that someone could select a java file with the chooser, and I'd send a "java -jar FILENAME" to the console and the app would launch. However as soon as I … | |
Python works fine in the console, but I'm having problems using python in a Java program. In case someone here has any ideas, I'm posting a link back to my original post (please reply there and not here): [url]http://www.daniweb.com/forums/post1246152.html#post1246152[/url] Thanks! | |
Re: You have typed this: [code=java] userInput=JOptionPane.showInputDialog(null, i, "Game", JOptionPane.INFORMATION_MESSAGE, sword, null, null); [/code] According to the API doc, this is the method signature for [I]showInputDialog[/I] that you are using: [code=java] public static Object showInputDialog(Component parentComponent, Object message, String title, int messageType, Icon icon, Object[] selectionValues, Object initialSelectionValue) throws HeadlessException [/code] … | |
Re: It seems strange to me that you're trying to find the smallest value on an unsorted tree. If this is an assignment, does it say that you're not allowed to sort the tree? If you can rebuild the tree in the correct order, then you just loop continuously looking at … | |
Re: Can you post the code you're using at the moment...? Otherwise I have no idea what to suggest. | |
Re: Just a quick reminder... but if you were planning to "add" two chars together to make a String, you wouldn't get addition: char '3' and char '7' combined into string is "37" (not "10") Then converting to int, and you'll get an int of 37 instead of the 10 that … | |
Basically I've got a text editor which revolves around a jTextArea. There are some settings (e.g. whether line wrap is enabled) that I'd like to save to a file when the application closes, and then load up again when it runs next. I've spent a few hours trying to get … | |
Re: I can't figure out what the problem is... and it's been 22 days without a response from anyone else so I assume they can't either. Did you end up solving the problem? | |
Re: A circle has an infinite number of "points"... or zero... depending on how you look at it. Not sure exactly what you're trying to do either. Could you add comments, or post the same snippet of code that you're using for a different shape (e.g. rectangle) so that I can … | |
Re: Not sure how you'd do it using that code, but somehow you need to access the parent class. I just tried, and "parent" doesn't seem to work the same way that "this" works, so there goes what I was going to suggest ;-) The way I would do this though … | |
Re: When you say "its not working properly" ... could you elaborate? What happens and what do you see? Are there any compilation error messages? Or run-time error messages? - leiger | |
Re: As quuba said, your lines 2-4 are redundant. You're passing in values to the method, then completely ignoring them and getting values from the console instead!! You should either remove lines 2-4, or remove the parameters - getInvoiceAmount() - up to you which one you do as the question isn't … |
The End.