- 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
398 Posted Topics
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`)?  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:  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) … | |
Re: A quick google turned up this: http://wsdl2javawizard.sourceforge.net/ and for futher info: http://lmgtfy.com/?q=import+web+reference+eclipse | |
Re: I'm not sure, what in specific you are looking for, but here's a great place to start: http://jogamp.org/wiki/index.php/Jogl_Tutorial | |
I'm not sure if I'm the only 1, but since the new site has been up, which looks great just took a while to get used to, reputation has not gone up (it has a little but not what it used to be). By this I mean, great users that … | |
Re: Any questions or do you just want to share code? if so I dont think this is the place? | |
Re: Yes I agree with stultuske, try make your Netbeans frame resizable, and see maybe if the JTable is added , just not in the place you though..... To add a panel to a Netbeans created frame i think you'd have to add your own code in the netbeans gui creation … | |
Re: Uhm how about the strings `substring(int startIndex,int endIndex)` or the ` lastIndexOf(String s)` methods. This is really simple, could you show some code you have tried? A quick [Google](http://lmgtfy.com/?q=extract+string+contents+java) | |
Re: @stultuske, java has been exposed to having many flaws, leading to a great number of malware infections, which is still on the rise due to Java not being updated on many PC's. But I guess as lonh as you have a Good AV even though a virusmay use an exploit … | |
Re: Please give the full error message thats printed from the console.. with the line number and thrown exception etc and of course the section of code the error is pointing too | |
Re: Did you try a [Google](http://lmgtfy.com/?q=connect+html+form+fields+with+mysql+using+hibernate+example), or [this](http://facestutorials.icefaces.org/tutorial/hibernate-tutorial.html) might help | |
Re: Im not sure but I think [this](http://docs.oracle.com/cd/E17802_01/webservices/webservices/docs/1.6/tutorial/doc/JAXBUsing3.html) and [here](http://jaxb.java.net/nonav/2.2.4/docs/api/javax/xml/bind/Unmarshaller.html) and maybe [this](http://jpgmr.wordpress.com/2011/12/23/tutorial-unmarshalling-soap-maps-with-jaxb-into-a-list-of-objects-with-spring-integration/) HTH | |
Re: Im sure [this](http://codexamples.blogspot.com/2011/05/java-sms-send-read-with-smslib.html) and [this](http://sendsmsusingsmslib.blogspot.com/2009/06/how-to-send-sms-using-smslib-over.html) will help, they show how to send SMS using smslib in java, and here are the [SMSLIB Docs](http://smslib.org/doc/smslib/quickstart/), it would be goog to go through them. | |
Re: Have you tried appending cmd.exe to your query like this: "cmd NET TIME \servertosynchwith /SET /YES" I think that should work, you have to call command prompt with arguments which will be the "NET..." | |
Re: I just have to say Jun 26th, 2008 7:20 am thread started, solved: January 24th, 2012 8:56 pm. :) now thats legendary lol | |
Re: try these links im sure this will do: http://support.microsoft.com/kb/222092 , http://blog.mwrobel.eu/how-to-call-dll-methods-from-java/ , http://stackoverflow.com/questions/771145/how-do-i-call-dll-inside-java and http://www.java-forums.org/advanced-java/2064-how-call-dll-java.html and it seems you can use this really quick technique to load your dll use: System.load("C:/Windows/System32/yourdllname.dll"); or System.loadLibrary("C:/Windows/System32/yourdllname.dll"); | |
Re: Hmm are you talking about the Encapsulation feature OOP languages provide? if so see just add the 'private' modifier to variables and methods that you want hide from other classes that may initiate your object. Note, if you use private modfier on variables that are needed in the calling class … | |
Re: Hmm what LayoutManager sre you using? Most Layouts have a constructor that accepts the vertical and horizontal gap bewtween components: for example using panel = new JPanel(new BorderLayout(5,5)); will create a default BorderLayout with a 5 spacing for horizontal and vertical components or in your case maybe you are using … | |
Re: Netbeans unfortuantely underlines the entire line making it hard to see where the error is! And as James said sometimes the IDE generated syntax error messages make things more confusing | |
Re: maybe try removing the semi colon at [code=java]@rank=0;[/code] | |
Re: its basically telling you that you are using a deprecated api.. meaning : its an older class or method and that it might cause an error like a buffer overflow... http://www.javacoffeebreak.com/faq/faq0008.html my netbeans says: getText() is "Deprecated. As of Java 2 platform v1.2, replaced by getPassword." for lines 39 & … | |
Re: hmmm here is some code to help you out i didnt include the checkForWin() method procedures as its very lengthy... package tictactoetest; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Random; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; /** * * @author David */ class TicTacToe { private final JFrame … |
The End.