3,927 Posted Topics
Re: Here's another option as well, using ImageIcon and JLabel: [url]http://java.sun.com/docs/books/tutorial/uiswing/components/icon.html[/url] | |
Re: Example method[code] private void showPanel(JPanel panel){ Container contentPane = getContentPane(); contentPane.removeAll(); contentPane.add(panel); pack(); }[/code] | |
Re: >Caused a real stink locally. The doll part or the homeless guys? :P | |
Re: For some ideas, I would recommend looking into the [URL="http://en.wikipedia.org/wiki/A*_search_algorithm"]A* pathing algorithm[/URL]. | |
Re: The 'unsafe' part would be a chance that some portion of the components might still be in an inconsistent state that would produce errors or graphical "glitches" if a paint request happened to be processed. Essentially it's still "under construction" and may exhibit inconsistent behavior if accessed by another thread. | |
Re: You would find those things much easier with a DOM parser, if that is an option. Otherwise, you have to keep track of the overall structure yourself. | |
Re: You'll need to come up with own format for that, since it's your editor. | |
Re: You can save yourself some typing if you want to list all of the properties available through System.getProperties()[code]System.getProperties().list(System.out);[/code] | |
Re: One thing I noticed missing on the forum listing pages is the "Mark as read" function. Have I missed its new location or is that still "in progress" or is it gone for good? | |
Re: Start a thread on it if you wish to have such a discussion. Posting it on the tail end of someone else's thread on Bluetooth won't attract much participation. | |
Re: Correct. The drawing code needs to either be moved into the paint() method or called from it with a reference to the Graphics object. See comments in edited code: [CODE=java]package wk8exercise3; import java.applet.Applet; import java.awt.*; import java.awt.Graphics; import java.awt.event.*; /** * * @author Rob */ public class wk8Exercise3 extends Applet … | |
Re: So just add them. I don't understand what part you are having trouble with [code]double total = weight[a][0] +weight[a][1] +weight[a][2];[/code]String concatenation has nothing at all to do with math operations on variables. | |
Re: Any help offered here is a completely voluntary effort. As such, your own attitude is going to determine the extent and nature of that help. The attitude demonstrated above is certainly not going to encourage much assistance in the future. Good luck with your efforts. (You should also know that … | |
Re: Posting an email address still isn't going to get this code written for you. | |
Re: This line [icode]location: interface org.w3c.dom.Node[/icode] would indicate it's returning a Node object but he's probably expecting an Element object. | |
Re: To be able to move, resize, and interact with an object, you'll need to create a class to represent it. It should keep track of things like its current bounds, "grabby points", color, etc. and be able to render itself to a supplied graphics object. Your painting canvas needs to … | |
Re: Oh, I doubt Dani wants to open the gates to hordes of pubescent leet gankers, pwning this and roflcoperting that and generally epeeing about the place. | |
Re: You haven't given enough info to answer that. It depends upon how you have stored those objects and their data. The part about "choosing" the method is odd as well. edit: Okay, you added another post while I was typing. Why not take both height and width and compare both … | |
Re: You don't need to create an exe for that. Just package it in a jar file: [url]http://java.sun.com/docs/books/tutorial/deployment/jar/index.html[/url] Most Windows users already have a JVM installed, but if they don't it's a simple matter for them to install from the web. | |
Re: It's kind of hard to say from a general standpoint, since it does depend on what you've coded after all, but keep in mind that repaintings of the top level container (Applet, JFrame, etc) are heavyweight AWT operations that use native code to redraw the top level window in the … | |
Re: >If my assignment is right let me know but I need someone to explain to me why it is right. Why? Are you completing them through [URL="http://en.wikipedia.org/wiki/Automatic_writing"]automatic writing[/URL] or [URL="http://en.wikipedia.org/wiki/Mediumship"]channeling[/URL] or something? | |
Re: Are you trying to call that method on an object that extends JComponent? You can't just import JComponent and use that method. | |
Re: [quote=joshSCH;394379]I would hardly call that evidence.. perhaps the smokers where you live are nice, but the ones here in texas are rude.. The evidence needs to be documented and places from all over the USA tested.. or else it isn't valid statistical data..[/quote] So you have performed statistical research on … | |
Re: Anyone [I]can[/I] become a PHP programmer - or a Java programmer or a .Net programmer - it just takes effort and it's easier for some than others. PHP may have a slightly lower learning curve than some other languages but that does not make it trivial or a less useful … | |
Re: The hosts file is just a text file: [url]http://vlaurie.com/computers2/Articles/hosts.htm[/url] | |
Re: The table model is a bit much to digest for someone who is new to Java. If you are just trying to print the array contents into a text area, you can do something along the lines of this[code]String[][] stuff = { {"a","b","c"}, {"x","y","z"}, {"Bob","Mary","Steve"} }; StringBuilder output = new … | |
Re: And after you've managed the open/read operations mentioned above, read through this tutorial on regular expressions for the data extraction: [url]http://java.sun.com/docs/books/tutorial/essential/regex/index.html[/url] | |
Re: It really depends on what you need to respond to. You can use key bindings in Swing: [url]http://java.sun.com/docs/books/tutorial/uiswing/misc/keybinding.html[/url] or you can use a KeyListener: [url]http://java.sun.com/docs/books/tutorial/uiswing/events/keylistener.html[/url] | |
Re: Try it with your code base one level higher, like this[code]<html> <applet code="Sorter" width="800" height="300" [B]CODEBASE="C:\Documents and Settings\Paul\My Documents\NetBeansProjects\Sort2\build\classes">[/B] </applet> </html>[/code]It looks like you had the package directory in the previous code base. | |
Re: That certainly isn't the only logic problem. Why are you opening and reading the same files over and over for each portion of your split() result? I'll mention one last time: read up on HashMap. | |
Re: Your description is a little bit difficult to understand, but I think you are saying the extra spaces are causing you trouble in the split() result? You can make it ignore those by altering your pattern to allow for one or more occurrences of those characters. Try this [icode]"[-.!? ,\n]+"[/icode] … | |
Re: You [URL="http://java.sun.com/docs/books/tutorial/essential/exceptions/throwing.html"]throw an exception[/URL]. | |
Re: You're correct that you need to create a copy of that object before you alter it. Using '=' is setting the two variables to be references to the exact same object in memory, hence it reflects the changes. If your Matrix class doesn't implement the clone method then you will … | |
Re: If you are really lucky, you can even get spam like this in your Private Messages right here, like I did :) [QUOTE=peee2007]Dear, I know that my message will come to you as a surprise since I don’t know you in person or meet with you before, but I am … | |
Re: Well, posting this in the Java forum isn't going to help you much. | |
Re: It's as simple as incrementing by 2[code]for (int i=1; i<200; i+=2){ System.out.println(i); }[/code] The printf documentation isn't the easiest read in the world, but here is how you can limit to 3 decimal places[code]double d = 4444.3434545; System.out.printf("%.3f \t\t %.3f ", d, d*2.2);[/code] | |
Re: First, you start your own thread and pay attention to what you are typing so it actually makes sense (punctuation would be a bonus). | |
Re: >i'm prepared to leave either my email address or yours or a means of contact via the web ... Ok, leave my email address and I'll contact it. | |
Re: For future reference, the quickest way to [I]not[/I] get help is to put "URGENT" in a thread title. | |
Re: Sneek, you're asking this of a guy who wants to trade in a female companion for an operating system for his computer based upon a fantastical list of requirements written by some moon-eyed pre-teen girl - you're expecting lot if you want coherence. | |
Re: Constructors can handle String[] just fine, but perhaps constructor writers cannot. | |
Re: >I add that html form in java using JEditorpane Don't do that. Problem solved. | |
Re: You can get that info from the MatchResult returned by the [URL="http://java.sun.com/javase/6/docs/api/java/util/Scanner.html#match()"]match()[/URL] method. It would probably be a lot easier to add a capturing group to your match pattern for the data you want to collect and extract it as part of the match result. More info on capturing groups … | |
Re: Those are for the visual web designer do not apply to JTable. See this tutorial on using JTable: [url]http://java.sun.com/docs/books/tutorial/uiswing/components/table.html[/url] | |
Re: The code you have posted is not Java. | |
Re: If you're printing them through AWT, you'll probably need to use a Book for it. If you can get all of the content into a JTextComponent, it's printing API might make it a little easier: [url]http://java.sun.com/docs/books/tutorial/uiswing/misc/printtext.html[/url] |
The End.