• Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Thousand threads write to one text file simultaneously

    You could: 1. Have each thread synchronise its file I/O using the File object as the lock. This is simple, but may block the client/server connections for too long. 2. …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Separate code into different classes

    Excellent!
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Separate code into different classes

    You seem to have got this all twisted up, and I don't know why. I'd just make it a constructor: public MyLayerTest(){ ImageIcon backGround = createImageIcon("/Images/Blackjack Table.jpg"); setPreferredSize(new Dimension(800, 600)); …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Separate code into different classes

    I thought you maust have fixed that by now! Is the un-executed method the myPane() method? That's not executed because you have written no code to call it. The content …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Separate code into different classes

    Yes, add the listeners to the controls when you add the controls, in your layered pane class constructor. But... don't try to do too much in those listeners. Don't put …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Need help with 'super' constructors..

    eg: public Janitor(String name, int hourlyRate) { super(name, 0); // passes the name, and zero for the hours, to the superclass contructor this.hourlyRate = hourlyRate; }
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Record a video in java

    I'm no expert in video, but I'm sure others will be able to help. Just Google for tutorials.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Separate code into different classes

    Create a subclass of JLayeredPane. In the constructor for your class, add all the controls you want.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Record a video in java

    JMF is old and never received much love from Sun or Oracle. It never worked properly, and never will because Java 8 includes JavaFX, which is the future of multi-media …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Separate code into different classes

    It sounds like your layered pane should be a class in its own right - ie extend JLayeredPane and add all the controls to it in its constructor. Then the …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Java 8 cant do MS Access anymore?

    [UCanAccess](http://ucanaccess.sourceforge.net/site.html) (sourceforge) may be an answer
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Program State - save as?

    I just mentioned XMLEncoder as a simple way to encode your complete program state as XML. It's an alternative to XStream but it's a standard part of the Java API. …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in split

    The parameter for split is a REGEX. In a REGEX the + character is a special character. To use it as a literal + you need to "escape" it with …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in using java codes in repository

    I'm not surprised you find it confusing. You are jumping in at the deep end with a number of copmplex technologies all at once, without learning the basics first. Einstein …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Program State - save as?

    Sorry - correct class name is `XMLEncoder` Just make sure your classes follow Beans standards (no-args constructor, getters/setters etc), put them in standard Collections (ArrayList etc) and you just need …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Is there any way to trace out the code execution step by step,simple to complex prog?

    A simple editor will not know how to trace executing Java code. You need a Java IDE such as NetBEans or Eclipse.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Program State - save as?

    OK. If it's a learning exercise rather than a live system, then of course you can try stuff out rather than automatically implementing "best practice". AES would be the obvious …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Looking to persist a Radio button selection across a page reload

    This is the Java forum. That's not Java.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Program State - save as?

    See the tutorial I linked you to.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Program State - save as?

    I was just referring to passwords. The other data will be OK with AES. You should never store a password, no matter how it's encrypted.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Program State - save as?

    AES is a good algorithm, especially with a long key. You wouldn't normally store a password, no matter how it's encrypted. You store a secure one-way hash of the password …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Problems with public static void main

    You *may* have an old `ClassExample.class` file around somewhere from a previous compile. If so, search for and delete any files with that name.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Program State - save as?

    Before you start installing some random datatbase engine, remember that Oracle's JavaDB is already on your system. It's installed as a part of the standard JDK. It works very well …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Find the most frequently used words across multiple files

    Not mine, Anamika's. Credit where credit is due... J
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Find the most frequently used words across multiple files

    > a word 'blah' found in the first iteration, so it is added. The second file doesn't have it, so it is removed. Then the third file has it, so …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Issue In Java Code

    Hi vishalcap For the benefit of anyone else getting this problem in future, and finding this thread, can you please let us know what the problem was, and how you …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Find the most frequently used words across multiple files

    > the algorithm requires reading each file twice ? Read first file and count words in a master map<word, count>. for every other file: read file & count words in …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Find the most frequently used words across multiple files

    I think Anamika's original algorithm is a lot simpler (see step c).
  • Member Avatar for JamesCherrill
    JamesCherrill

    Gave Reputation to Taywin in convert pdf to jpg java code examples to follow

    The above post is an advertising. 1)pulled and old thread and 2)unrelating suggested solution.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Problems with public static void main

    That's the problem. Java doesn't have anything defined in the language spec. as "global", so you can use the word to mean anything you like. Similarly, your reader can read …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Adding Controls to a background label, and structuring the source code

    This discussion is now being continued in its own thread. [See here](http://www.daniweb.com/software-development/java/threads/482809/separate-code-into-different-classes-)
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Separate code into different classes

    (This is a copy of my replies to the earlier thead - repeated here for simplicity) That's a common problem with Swing (or any other powerful GUI toolset), and there …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in forum

    ("let's create a new one"is a response to me slapping his wrist for hijacking an old thread with his question. I don't think he wants to write a forum app.)
  • Member Avatar for JamesCherrill
    JamesCherrill

    Edited Adding Controls to a background label, and structuring the source code

    I have a Jframe that contains a JPanel which has a label that I use as a background image and a second JPanel that I want to add my controls …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Adding Controls to a background label, and structuring the source code

    A bit too late for that now, but I've updated the title to reflect the new content. J.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Problems with public static void main

    Legal Java yes, but terrible advice for someone learning Java. Making everything static is missing the whole point of an object oriented language. Much better to remove every `static` keyword …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Find the most frequently used words across multiple files

    Afterthought: Although the ThreadPoolExcutor approach, with all its options, is daunting, in its simplest form it's really simple. Here's a tiny runnable demo: First, a Runnable that is the class …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Adding Controls to a background label, and structuring the source code

    Yes, for a start. Don't be afraid to create new classes to organise your code. Eg: You may have a game with a highly graphical display of the game in …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Adding Controls to a background label, and structuring the source code

    That's a common problem with Swing (or any other powerful GUI toolset), and there isn't any good solution. An IDE with code folding helps when you are editing the code. …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in "Null" Word in csv export

    What do you want it to do when it encounters a null value in the database?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Problems with public static void main

    Simply: You did this: public static void main(String[] args) { ... void changePower(int newValue) { Power = newValue; } etc } You cannot create a method inside another method. You …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in No Ip Duc host in java socket programming

    I simply use code like InetSocketAddress addr = new InetSocketAddress("XXX.no-ip.biz", 21); new Socket().connect(addr, 2000); to connect to a host via No-Ip, and it's just like connecting to any other DNS-registered …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in forum

    You just copy/pasted your assignment without even a moment taken to explain what help you need. That's highly disrepestectful to the many people who give their time to help others …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Find the most frequently used words across multiple files

    Using threads for parallel processing of a lot of files sounds perfectly sensible to me. Have a look at Thread's join() method - you can use this to allow your …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Creating/aligning the ascii table in a text file

    Sorry, I've literally never used the console in a real application, so I can't help. One small suggestion: you have the same format string twice in the code (lines 17 …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Problems with public static void main

    cd88's post is, regrettably, partly nonsense and otherwize mostly wrong. His previous posts are about VB, so Java obviously isn't his area of expertise. Best simply to ignore that entire …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Gave Reputation to cd88 in Problems with public static void main

    HI, not to be a meanie, but the first problem you encounter is with the naming of your class. The standard practice in coding is to use camel casing ClassExample …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in SceneBuilder stops opening a file after awhile

    Out of memory???
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in problem in showing balls

    I don't have the latest version of yur code, and I don't know whether you have now fixed all the problems. My point was that the structure/architecture for you updating …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Creating/aligning the ascii table in a text file

    That's heading ih the right direction, so here's your next hint! In the first argument you put all the fixed text, and format instructions for all the variable parts. The …

The End.