Search:

Type: Posts; User: LeslieS

Search: Search took 0.09 seconds.

  1. Re: Problem changing background color of JTable row

    Now, you have to read everything I write. You must not ignore parts.
    This is what I wrote in post #1

    In post #7 I show what the selection behaviour I want looks like. But that code...
  2. Re: Problem changing background color of JTable row

    When you click on a cell the entire row is highlighted.

    That is the behaviour I want.
    Its even easier to show you. Just don't use the cell renderer and run the code.
    When you click on...
  3. Re: Problem changing background color of JTable row

    I want to set the background colour of the row where a start of a record is. This is a row where column 0 has a value.
    That you can see in the demo code as cyan.
    Unfortunately the only way to do...
  4. Re: Problem changing background color of JTable row

    Here is a main file to use to test with.



    import java.util.HashSet;
    import java.util.Set;
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import...
  5. Problem changing background color of JTable row

    I am using the following code to change the background colour of row where the first cell is not blank.
    It works but it also changes the colour of highlighting of selected rows.
    I want the...
  6. Re: Trying to understand how these two types of code work?

    This is a case of the code not being formatted very well. The last line 'return 0;' is not inside the if/else blocks.
    Because the if and the else are not using {}, they are single line...
  7. Replies
    9
    Views
    927

    Re: Pasrsing error when comparing two dates

    Looks like it. Its a shame he might miss the answer here, but over there they seem to know a lot more than I do about the various date types in java.
  8. Replies
    9
    Views
    927

    Re: Pasrsing error when comparing two dates

    I couldn't get it to recognize ZoneId without the specific import:
    import java.time.ZoneId;

    Next in the try block you are using systemDefault but that is a method and needs the ()

    ...
  9. Re: Difficulty with connecting 2 classes through the Switch Statement

    Your addStudent method should look something like this:


    public void addStudent(Student student){
    switch(student.getRole()){
    case "Writer":
    // do writer stuff
    ...
  10. Replies
    0
    Views
    772

    Weird forum post viewing problem.

    When I visit a forum thread the last posted message comes up blank. I have to log-in and start a reply to see the post text.
    This picture shows what I am talking about. There is text in my reply...
  11. How do you apply GridBagLayout constraints to existing controls

    I use the GUI builder of NetBeans and put a panel on a frame and controls on the panel.
    How do I then apply GridBagLayout to these controls?
    I have tried re-adding the control to the panel in...
  12. Replies
    2
    Views
    567

    Re: Min Number from array

    Problem #1 is you have not defined a 5x8 array.
    You have defined a 2x9 array [0 to 1][0 to 8].
    Each bracketed set of numbers is one 'row' of the matrix.


    int[][] array = {
    ...
  13. Re: What language would describe this code so that I can research it?

    Yes, that is the default class name from the online compiler.
  14. Re: What language would describe this code so that I can research it?

    The example you have shown is a class instance being declared and an instance of another class as an argument to the constructor.
    Every class has a constructor. If the coder doesn't provide one...
  15. Replies
    4
    Views
    1,639

    Re: Are method parameters two way traffic?

    Although Java parameters are defined as "passed by value" it doesn't hold quite so fast with objects as it does with simple types.
    If an object is passed as a parameter, that parameter is copied...
  16. How do you best handle incomplete image loading

    I am loading an Image resource then converting it to BufferedImage but the conversion routine uses the images width and height and until the image is fully loaded these return -1.
    I use a while...
  17. [SOLVED] Re: Cannot load file from resource using getClass().getResource

    In my case:


    cp=home/noone/NetBeansProjects/OddCouplePoker/resources
    resPath=
    images/pokertable.png - error
    /images/pokertable.png - no error
    pokertable.png - error...
  18. [SOLVED] Re: Cannot load file from resource using getClass().getResource

    Thank you Norm, however, sadly the resource is still not being loaded.

    The folder was not in my class path.

    I added it in and now the output from

    ...
  19. [SOLVED] Re: Cannot load file from resource using getClass().getResource

    The folder resources/images is on the class path I think. I added the folder to Project properties - source package folders.

    If you look at the image I linked you can see the image is in the...
  20. [SOLVED] Cannot load file from resource using getClass().getResource

    For anyone that is having this issue the resolution was to (actually) add the folder to the class path.
    Contrary to what you will find via google, the path cannot be added via project properties...
Results 1 to 20 of 21