- Strength to Increase Rep
- +10
- Strength to Decrease Rep
- -2
- Upvotes Received
- 134
- Posts with Upvotes
- 115
- Upvoting Members
- 62
- Downvotes Received
- 4
- Posts with Downvotes
- 4
- Downvoting Members
- 4
Author of: JPassword Recovery Tool and a poster at: http://stackoverflow.com/users/1133011/david-kroukamp
- PC Specs
- Intel Core i3,2GB DDR3,320GB HDD,Intel HD Graphics 3000,Windows 7 x64
I have seen many people struggling with Reading files and writing files in java, also a great problem is how to edit a file too. So in this code snippet I have put all these problems into one small program in hopes to help others. So this code snippet will … | |
Re: [QUOTE=abhishek_s_n;1730322]heyy guys.. m implementing PEER TO PEER FILE TRANSFER.. What protocol should I use? TCP or UDP? And why?[/QUOTE] JamesCherrill answered that and here's an example of a TCP:[url]http://systembash.com/content/a-simple-java-tcp-server-and-tcp-client/[/url] and UDP:[url]http://systembash.com/content/a-simple-java-udp-server-and-udp-client/[/url] so you can see it for yourself | |
Re: The error basically says it all, you cant have a non static class and reference a static variable and the same goes you cant have a non static class and then try and get reference to a static variable. to fix your problem cahnge the 'public class Counter.....' to: [code]public … | |
Re: [QUOTE=jmace;1742092]Well, I've been learning Java and I managed to create an FTP client that uploads and downloads files from a server. Oddly, the thing I can't figure out is how to do an FTP delete. Can anyone help me on that? I don't want to use an API or someone … | |
Re: [QUOTE=letters1417;1747761]Hello! I have to print patterns using '*' and I am at a lose how to get these patterns printed! I figured out the first one, * ** *** **** ***** ****** ******* ******** ********* ********** and now i have to do it upside down: ********** ********* ******** ******* ****** … | |
Re: @vegaseat Mythbusters proved the 7 times dry paper folding thing as busted! OIS (Out of Interests Sake) If you could theoretically fold a 1mm thick piece of paper 100 times it would be thicker than that observable diameter of the universe!!!! See here for more info: http://therealsasha.wordpress.com/2011/08/ | |
Re: [QUOTE=nidheeshkumar.r;1756499]On execution i only gets a new window,its not displaying any images....i heard about grid layout,can i use that here?? wil u help me with some examples?[/QUOTE] maybe see here:[url]http://stackoverflow.com/questions/8500746/java-swing-displaying-multiple-images-dynamically-on-jpanel[/url] and here:[url]http://answers.yahoo.com/question/index?qid=20100704125651AAN0AUm[/url] [edit]and this too is helpful:[url]http://docs.oracle.com/javase/7/docs/api/java/awt/GridLayout.html[/url] | |
Re: [QUOTE=Timlince55;1740787]I need to print out a pattern that looks like this when N=6 1 21 321 4321 54321 654321[/QUOTE] use a for array and iterate through it saving each variable each time, but to the front of the string,this should do the trick with a little editing[code] String tmp = … | |
Re: [QUOTE=MrHardRock;1770427]Hey guys I had an assignment to recursively write the Towers of Hanoi then test it. I did not have too much of an issue getting the program written But I am not sure what the book means by test the efficiency do they want the number of moves my … | |
I have recently been interested in Java Swing and Game development, so naturally I began creating many different 2D games. During them I found myself having to rewrite much code, but eventually I decided to write some classes that would help me whenever I wanted to make a game. Here … | |
Re: [QUOTE=Venkat SM;1753052]Can anyone tell me about [COLOR="Red"]how to create my own format[/COLOR] like .azw(kindle device format),.mobi,.epub etc..Is it possible to create it using java? if yes then what are the steps to do that? I am doing project for e-publishing company they need one own proprietary format like the above … | |
| |
I have seen many questions on autocompeletion for *java text components* like `JTextField` `JTextArea` `JTextEditorPane` etc. There are not many options either: 1) 3rd party library (like SwingX) 2) DIY (i.e using `DocumentListener`, `JWindow` with `JLabel` etc and a few requestFocusInWindow calls) I chose number 2 and put the code … | |
Re: [QUOTE=chonobob;1763055]Hey everyone, I have been assigned to create a recursive maze program and I am having trouble to figure out how to start it. I am pretty much lost and confused and don't know what to do. I do not want anyone to complete it for me but giving me … | |
Re: Im not sure what is the expected output, but I can see the discount JLabel (`sLAbel`)? ![kgfsd](/attachments/large/3/kgfsd.png "kgfsd") Please be more specific. A thing to note though regarding your code, no need for the `setVisible(..)` on `JLabel` as you dont call `setVisible(false)` you simply clear text. Also dont forget to … | |
Re: The problem is here: System.out.println("Please enter income:"); income += key.nextDouble(); System.out.println("Please enter income:"); if (key.nextDouble()<0) { System.out.println("Thank you for using tax calculator, your total income entered is:" + income); System.exit(0); } else if (key.nextDouble() <0 || income <= 0){ System.out.println("Thank you for using tax calculator,the program will now exit"); System.exit(0); … | |
Re: Here are 3 great links that should answer your question: - [Why Java doesn't support multiple inheritance](http://javarevisited.blogspot.com/2011/07/why-multiple-inheritances-are-not.html) - [ Why not multiple inheritance?](http://www.javaworld.com/javaqa/2002-07/02-qa-0719-multinheritance.html) - [Why there is no multiple inheritance in Java, but implementing multiple interfaces is allowed](http://stackoverflow.com/questions/2515477/why-there-is-no-multiple-inheritance-in-java-but-implementing-multiple-interfac) **Some of the reasons being:** 1) Multiple inheritances does complicate the design … | |
Re: See [How to Use Combo Boxes](http://docs.oracle.com/javase/tutorial/uiswing/components/combobox.html) has all you need to know there, Specifically [Providing a Custom Renderer](http://docs.oracle.com/javase/tutorial/uiswing/components/combobox.html#renderer) than you woild simply call `setSelectedItem(Obejct o)` unless you can post an [SSCCE](http://sscce.org) of your current approach. | |
Re: To clarify, you would like to be able to drag a component from one JPanel to another or the smae panel? Also are you looking for DnD option only? Or custom too? | |
Re: cross posted here: http://stackoverflow.com/questions/14171600/immediate-update-to-jcombobox-in-java/14171684#14171684 | |
Re: Here is a small sample Swing GUI I made to get you started: ![Untitled95](/attachments/small/3/Untitled95.png "align-center") import java.awt.BorderLayout; import java.net.MalformedURLException; import java.net.URL; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; import javax.swing.SwingUtilities; /** * * @author David */ public class SwingGuiTest { private JFrame frame; public SwingGuiTest() { initComponents(); … | |
Re: dont think java has that as a built-in api, maybe look to using google maps api or another one that can take an ip and get current location? or you could just use the knowledge of an ip structure and get the location like that? : http://www.javaranch.com/journal/2008/08/Journal200808.jsp#a2. Also see here: … | |
Re: [QUOTE=pokejef143;1751608]does this sorting method also capable in handling more than two arrays??[/QUOTE] i guess it does you'd just have to call it twice, once for each array to sort. but please as said above: If you have more questions please start a new topic. | |
Re: You could import the com.samsung.util.AudioClip class into your java class. Then you can reference the java docs from the link below to see how to use it. http://www.j2megame.org/j2meapi/Samsung_API_1_0/com/samsung/util/AudioClip.html Keep in mind that you can only use .midi, .mmf, or .mp3 audio with this class. If you prefer making the code … | |
Re: What exactly is your question? does your existing method work and you would like a more effecient way to do the name switching when balls are sunk? or does it not work? | |
Re: found a nice site with an example for you to have a look at: http://www.rgagnon.com/javadetails/java-0426.html | |
Re: Well to disable it as in make it no more visible thats a bit hard (maybe impossible) why not add a `WindowListener` and then have [Iconified handler](http://docs.oracle.com/javase/7/docs/api/java/awt/event/WindowListener.html#windowIconified%28java.awt.event.WindowEvent%29) like so: frame.addWindowListener(new WindowAdapter(){ public void windowIconified(WindowEvent e){ frame.setVisible(false); } }); this will react when the `JFrame` is minimized and make it not … | |
Re: > change the thickness of a Line2D Hmm this shoud help: import javax.swing.*; import java.awt.*; import java.awt.geom.*; public class TestLine extends JFrame{ private MyPanel panel; public TestLine() { setSize(200, 200); panel = new MyPanel(); getContentPane().add( panel, "Center" ); } public static void main( String [] args ){ TestLine tl = … | |
Re: public class JavaApplication186 { /** * @param args the command line arguments */ public static void main(String[] args) { Test.x("abc", 1, 2); Test.x("abc", 1.0, 2.0); } } class Test { public static void x(String s, int... i) { System.out.println("i " + i[0]); } public static void x(String s, double... d) … |