• Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Text Based Menu System

    Simplest answer: how about an ArrayList of Booleans just like the array of Strings you already have? Proper Java answer: create simple MenuItem class with its text String and selectable …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Airline Reservation Syetem In Java?

    IMHO those GUI libraries are way too advanced for this requirement. There's nothing there that requires anything more that just an ordinary Swing GUI. The Oracle tutorials are unbeatable for …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in unexspected and unrecoverable error

    I don't know why this is in the Java section, but... TextPad 5 is commercial software so either: a) You have purchased a licence, in which case you should upgrade …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in JComboBox Table Cell Editor - removing items

    The technique of subclassing JTable for cell-specific rendering is taken directly from the Oracle Java Tutorials: http://docs.oracle.com/javase/tutorial/uiswing/components/table.html#renderer so I guess youwill have to take your disagreement up with Oracle - …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Text Based Menu System

    > Each item needs to either be selectable, or non selectable That's the next thing in your requirements, so do that next. What kind of variable would you use for …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Blue passenger train help

    Hello Wilfred, welcome to DaniWeb. We don't do people's homework for them. If you have a specific problem with some aspect of Java then we're glad to help, but simply …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in java retrieve images

    That's a good start - you are adding lots of labels, each with an image in it. Now on the the second part of my previous post. You need to …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Please Help With Inventory Program Part 6

    The message tells you exactly what went wrong and exactly where in the program it went wrong. What is it about that that you don't understand? It doesn't help that …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in java retrieve images

    Why? You had code to read one image - why did you change that. Did you read my previous post (first sentance)? It told you exactly what to do.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Please Help With Inventory Program Part 6

    > The serializable class LogoPanel does not declare a static final serialVersionUID field of type long (etc) This is basically a stupid warning message that you can completely ignore. If …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Blackjack in Java

    You have a break; as the last statement in your loop, so it will always exit the loop at the end of its first pass. Maybe you intended that to …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Complex XMLEncoder

    That's the solution I proposed earlier, except that he misses a key point - which is that ArrayLists can also be encoded/decoded (the ArryaList class has been retrofitted with extra …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Problem with DataBase Connectivity

    Glad to help. Please mark your threads "solved" for our knowledge base when you have the answer to your question. You can always start a new thread with an appropriate …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Problem with DataBase Connectivity

    That's a classic error! On line 24 you declare a text field t1 In your test method you have JTextField t1=new JTextField(""); That creates a new variable t1, "masking" the …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Problem with DataBase Connectivity

    Could it be that the action command is "Save" (defaults to the same as the button text), but you are testing for equals("save") ?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in java retrieve images

    The code that puts the image into a label (lines 20-24) can go inside the while loop so you create one label for each image in the result set. If …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in If statement

    You're missing a set of brackets round the whole condiiton, but otherwize that's good. ps It's usually quicker to try something simple like that yourself than to wait for someone …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Complex XMLEncoder

    Use java.beans.XMLEncoder and pass it the ArrayList. It will encode the entire ArrayList and it's constituent classes and their ArrayLists of other classes and primitives all the way down. Your …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in JComboBox Table Cell Editor - removing items

    > aren't editors column specific instead of cell specific? It comes down to JTable's `getCellEditor(int row, int column)`. Subclass JTable, override that method, and you have cell-specific editors
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in JComboBox Table Cell Editor - removing items

    Sorry.my mistake, I meant editors, not renderers.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in JComboBox Table Cell Editor - removing items

    It's a combo box. It must have access to its list of values!
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in JComboBox Table Cell Editor - removing items

    Based on your current setup? I don't know. I would start with something simple like adding each renderer to a 2D array at the same time that I add it …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in JComboBox Table Cell Editor - removing items

    Each cell has its own renderer, which is a JComboBox, which has its own list of data to populate its values. It's those lists of data you need to update …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in JComboBox Table Cell Editor - removing items

    The "How to use JTables" Oracle tutorial shows how yto set a different renderer for any cell of the table (briefly: subclass JTable and override public `getCellRenderer(int row, int column)`. …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Help: Project has a 10 minute big-O

    If you want to count the letters in a word there's no need for the alphabet array and the nested loops. Java chars are an integer type, and the letters …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Could not understand the output of Backed Collections(Sorted Map)

    The range of keys that will be included in the subMap view are from "b" to "g". That includes all possible keys that sort after "b" but before "g". You …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Could not understand the output of Backed Collections(Sorted Map)

    TreeMaps are always sorted by their keys. subMap returns a view of a contiguous range of keys of the TreeMap, including only those keys within the specified range. Because it's …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in ListListener wait on ActionListener

    Yes, I agree with all that. He certainly should not be removing/adding listeners dynamically to fix this.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in ListListener wait on ActionListener

    Thanks for the link - hopefully OP will identify the exact source of the NPE to determine whether this is a Swing problem or something related to the underlying code. …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in ListListener wait on ActionListener

    Your analysis of the problem seems reasonable. Why not just check the selection in JList ListSelectionListener and ignore the event if the selection is null?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Build GUI with complex GridBagLayout

    In the constructor you can specify a size in rows/columns of text, but there's nothing that specifies its size in relation to the other components. That's the job of the …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in resize GUI

    This is exactly why most people here recommend writing code yourself until you understand what's going on. Then and only then can you take advantage of a full IDE. If …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in resize GUI

    My extra-sensory-perception allows me to study your code, even if you haven't posted it, but unfortunately it doesn't work if there is an "a" in the month, so you're just …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Invisible cursor

    toolkit.getImage does not throw any exception if it fails (other than for a security manager problem), so maybe the Image is not valid - createCustomCursor doc says : "If the …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Code completion implementation in java

    Did you look at the tuorials on the Eclipse web site, eg http://www.eclipse.org/articles/Article-Your%20First%20Plug-in/YourFirstPlugin.html or http://wiki.eclipse.org/FAQ_How_do_I_write_an_editor_for_my_own_language%3F
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Specific Generic Type Parameter in the method is accepting other Types

    That problem is really nothing to do with generics. It's the same as String s = "hello"; Object o; o = s; // this is OK s = o; // …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Build GUI with complex GridBagLayout

    That all sounds sensible. Just give it a go and see how it works. The simplest solution that works is the best.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Edited Java script error with firefox

    Hello I was hoping someone would be kind enough to assist me with a major problem I'm having with firefox. I'm running a Mac OS X 10.5.8 platform from a …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Specific Generic Type Parameter in the method is accepting other Types

    Input: you need a List. You give it an ArrayList which is a subclass All ArrayLists are Lists, so it's OK Output: You need an ArrayList. YOu give it a …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Specific Generic Type Parameter in the method is accepting other Types

    ArrayList implements List, so every ArrayList is also a List. Can you post the exact syntax you used for the error version?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Blank Window

    After a very quick look I see a model with a boolean column (checkbox) but all String data.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Blank Window

    Looks like you have put some String data into a column whose class is Boolean.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Blank Window

    You should know by now that when there's an exception message we want to know WHICH LINE IS IT ON!
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Checkbox inside Table

    Without seeing the *relevant* code I can only make wild guesses!
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Checkbox inside Table

    OK, that's getting a lot closer. Main problem is that the getColumnClass method needs to be in the table model class, and takes an int as its parameter. Here's an …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Checkbox inside Table

    I really don't know how to make this any clearer than the Java and training experts who wrote the tutorial. Your code doesn't even start to resemble the tutorial code …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Checkbox inside Table

    OK. That code is going off in all kinds of wrong directions. I need you to go back and re-readthe link I gave earlier [This part of the tutorial](http://docs.oracle.com/javase/tutorial/uiswing/components/table.html#data) You …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Checkbox inside Table

    Without seeing your code it's impossible to say what's wrong. Did you implement getColumnClass in yout table model?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Help: Project has a 10 minute big-O

    Congratulations!
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Neko project

    You are missing the closing bracket on your main method (should be on line 14). You can't start a new method inside another method, not even the main method.

The End.