JTable subclass problem - Duke dollars $$$ available

I have a JTable which i wish to extend from a basetable i have developed.
The sub classes do not seem to inherit the superclasses contructor. Am i missing something?
Here is the super class....
public class AbstractTable extends JTable{
     protected Statement stmt;
    /** Creates a new instance of AbstractTable */
    public AbstractTable() {
        setVisible(true);
        setBorder(new javax.swing.border.EtchedBorder());
        setToolTipText("Search Results");
        setCellSelectionEnabled(true);
        setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
        setCellSelectionEnabled(true);
        setDoubleBuffered(true);
        setColumnSelectionAllowed(false);
     // optional
        setBackground(new Color(220,220,220));
        setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
        setAutoResizeMode(AUTO_RESIZE_OFF);
        // Enable tool tips for the table, without this tool tips will not
        // be picked up.
        ToolTipManager.sharedInstance().registerComponent(this);
           setupConnection ();
    }Here is the cub class
public class SLATable extends fyp.AbstractTable{
    private MyDBConnection mdbc;
    private java.sql.Statement stmt;
    JTable SLATable = new javax.swing.JTable();
    /** Creates a new instance of SLATable */
    public SLATable()  {
        super();
    public JTable setSLATable(String searchString){...}

I have a JTable which i wish to extend from a
basetable i have developed.
The sub classes do not seem to inherit the
superclasses contructor. Am i missing something?Constructors are never inherited.
<snip>
Here is the cub class
public class SLATable extends
fyp.AbstractTable{
private MyDBConnection mdbc;
private java.sql.Statement stmt;
JTable SLATable = new javax.swing.JTable();
Having an instance variable (if you are aware that this is an instance variable) with the same name as the class could be very confusing to someone reading your code.
From the short bit of code you've provided, extending JTable seems unnecessary. See:
http://www.artima.com/lejava/articles/designprinciples4.html

Similar Messages

  • InetAddress Timeout (Duke Dollars Available)

    Hi people, am making a program that needs to change IP Addresses to domain names, in most cases this code works fine
    InetAddress temp = InetAddress.getByName(ipAddress);
                    try {
                        domainName= temp.getHostName();
                    catch(UnknownHostException ex)
                    { System.out.println("Could not find "+domainName);
                }However, many of the ip addresses will not find a domain name. it will take 5 seconds to discover this where as it will take no time at all to discover a correct domain name if one can be found. is there any way that i can timeout this action if it takes over 20 milliseconds to find a name.
    Thank you for your help.
    code to correct this will lead to ten duke dollars.

    for a java help forum, why does nobody want to be at
    all helpful, i am really stuck and would be really
    greatful of some helpUm, hardly any time has passed yet. Don't start copping an attitude just yet...
    But as alluded to, the duke dollars are utterly worthless. If I wanted 10 more dukes to add to my pile, I could (but wouldn't) just create another login ID, post a fake "question", answer myself with this ID, and award them to "myself".
    Do you actually have a question, other than "will someone do my work/thinking for me"?

  • 10 duke dollars available for this smple doozy!

    I have just started using Java, and already I need to create a simple game, but I am having problems already.
    The game is designed for 2 player with the one human player and the computer. Players alternatively take sticks from a pile, the player taking the last stick loses.
    The game needs to include:
    1. A random integer between 10-80 to generate the pile of sticks.
    2. Implement a smart mode, which means that if the computer starts the game it cannot lose.
    3. Have the facility to play the game reapeatedly without restarting the game.
    It should look like this:
    The starting size of the pile is xxx sticks
    The 1st player is: yyy
    The 2nd player is: computer
    Playing in the MMM mode
    The ppp starts the game:
    turn:yyy --->> removes QQQ sticks
    turn: computer --->> removes QQQ sticks
    The winner is: computer!
    Another game? (yes/no)
    Any Ideas?
    Many Thanks...
    Dr. K

    I don't understand your game as described but it sounds a lot like nim or one of it's many variants. Do a google search on "nim" for plenty of info. Here is a start:
    http://www.csm.astate.edu/Nim.html
    http://www.chlond.demon.co.uk/Nim.html
    Note that traditionally nim is played with multiple piles.
    The game needs to include:
    1. A random integer between 10-80 to generate the pile
    of sticks.Look at the Random class.
    2. Implement a smart mode, which means that if the
    computer starts the game it cannot lose.Here you have to devise and code a winning strategy. That could be quite challenging depending on the rules of the game.
    3. Have the facility to play the game reapeatedly
    without restarting the game.This is pretty simple. I don't want to sound discouraging but if you can't figure this out then step 2 is out of the question.

  • Classpath probelm--duke dollars available

    Basically I have the following problem
    I have downloaded the comm api. I have installed it and set up the classpaths.
    set CLASSPATH=c:\j2sdk1.4.1_01\lib\comm.jar (This points to the api)
    set CLASSPATH=c:\commapi\samples\Blackbox\BlackBox.jar;%CLASSPATH%
    (This is one of the examples with it)
    And when I run it it is fine.
    I have also made my own simple program called ListPorts.When I compile it is fine but when I try to run it I get errors.
    java c:\ListPorts
    Can anyone help me please

    If you are placing it on the root of C:\, then you should add "C:\" to your classpath.
    As jesper1 stated don't prepend the directory name to the classname. You NEVER do this... NEVER, NEVER, NEVER. The argument is a fully qualified classname. What I mean by fully qualified is the full package & classname.
    For example:
    if you were trying to run a class "i.am.a.java.Newbie"
    o the "i.am.a.java" part is the package
    o and the "Newbie" piece is the classname.
    A fully qualified classname combines both the package and classname.
    Note the syntax defined below. Notice on the first "Usage" line how it says "class". It doesn't say "path to class/class" or anything like that. It just says class.
    C:\>java
    Usage: java [-options] class [args...]
               (to execute a class)
       or  java -jar [-options] jarfile [args...]
               (to execute a jar file)
    where options include:
        -client       to select the "client" VM
        -server       to select the "server" VM
        -hotspot      is a synonym for the "client" VM  [deprecated]
                      The default VM is client.
        -cp -classpath <directories and zip/jar files separated by ;>
                      set search path for application classes and resources
        -D<name>=<value>
                      set a system property
        -verbose[:class|gc|jni]
                      enable verbose output
        -version      print product version and exit
        -showversion  print product version and continue
        -? -help      print this help message
        -X            print help on non-standard options
        -ea[:<packagename>...|:<classname>]
        -enableassertions[:<packagename>...|:<classname>]
                      enable assertions
        -da[:<packagename>...|:<classname>]
        -disableassertions[:<packagename>...|:<classname>]
                      disable assertions
        -esa | -enablesystemassertions
                      enable system assertions
        -dsa | -disablesystemassertions
                      disable system assertions

  • Cheap problem with duke dollars

    i have 17 duke dollars but i can not give then
    along with questions i ask...
    what to do...

    At the top of the thread, you should see a link saying "assign Duke Dollars". Click on this, and select how many from the drop-down box. Then click on the button "Assign Duke Dollars".
    Next go back to the thread, and by each person's name you should see a little picture of a Duke with a green +. Click on that to assign Dukes to that person.

  • SDN Forum points vs Sun Forum Duke Dollars

    I believe that a points system is a great way to encourage participation by the community in problem solving.
    With the points system in SDN, however, there is room for abuse, for example, by having people you know award points to you on threads.
    I personally like the points reward system (Duke Dollars) on Sun's Developer Forums. In this scheme, you work with credits. Every user is given a certain amount of points (Duke Dollars) when they join. When you post a question, you can assign a number of Duke Dollars up front from your available credit as a reward to entice responses. You can also accumulate more Dollars by answering threads which have Dollars assigned.
    Every month, Sun gives a gift to the user who has accumulated the most points.
    I'm not sure that this solves the problem of users not assigning points for valid help, but, because users are working with limited credit, it does force them to be careful when assigning points, and prevents abuse as that mentioned above.
    I would like to hear what other people think about this scheme. Perhaps there are aspects I have not considered.
    Regards,
    Martin

    Would a moderator make it more positive? 
    Actually Craig went into each of the forums and published a "rules of engagement".  Maybe that kind of a "sticky note" post would be the place to remind people about the inappropriateness of redundant questions (across various forums) and the confusion and poor sporting behavior associated with "copied" answers.  I can ping Craig with that suggestion to add text if you think it makes sense to "remind" people in each of the respective forums.
    Or..to be a little more provocative, we could suggest that community members who have a good track record of participation, collaboration, and exemplary attitude be given the moderator rights in forums where the activity volume might be too overwhelming for an SAP moderator alone to manage and given the rights to move content to a more appropriate thread.
    This is what I meant about "self-policing".  Also, perhaps the moderators (internal as well as SAP) could identify themselves in a sticky post and invite participants in those designated threads to track "abuses" or issues, thus identifying them and hopefully resolving them publically.
    Strange, it reminds me that in old, Puritanical, America, of the 17th century community culprits were subjected to a public dunking or stocks when they broke the law.  The purpose being that public condemnation sent a clear message to other "would be" misbehavers.... and thus deterred further bad conduct.
    While a rather radical and unpleasant method it was an open way of dealing with abuses to the system.
    Perhaps others can offer less extreme and more effective suggestions here
    Marilyn

  • Duke Pt avail. 2nd time askin, (Flicker-free background) Simple Animation

    2nd time askin, since didn't get sufficient help. Duke Pts available! I am trying to create simple animation on a solid constant background. I used double buffering for moving the object and it works fine. But the problem is with the background image. The image seems to flicker while the object is moving. Here's my code:
    import java.awt.*;
    import java.applet.Applet;
    public class changed extends Applet implements Runnable{
    Image buffer;
    Graphics bufferg;
    Thread main;
    int x=0;
    boolean flag=false;
    public void init(){
    setSize(500,500);
    main=new Thread(this);
    main.start();
    buffer=createImage(getSize().width,getSize().height);
    bufferg=buffer.getGraphics();
    public void run(){
    while(main!=null){
    try     {
    main.sleep(50);
    catch(Exception e){}
    repaint();
    public void stop(){
    if(main!=null){main.stop();}
    public void paint(Graphics g){
    update(g);
    public void update(Graphics g){
    Dimension d=getSize();
    bufferg.setColor(getBackground());
    bufferg.fillRect(0,0,d.width,d.height);
    bufferg.setColor(Color.red);
    Image img = getImage(getCodeBase(),"bliss.jpg");
    if((x<500)&(!flag))
    bufferg.fillRect(x+=5,10,25,25);
    else
    flag=true;
    bufferg.fillRect(x-=5,10,25,25);
    if(x==0)
    flag=false;
    g.drawImage(img,50,50,this);
    g.drawImage(buffer,0,0,this);
    Please help me with this minor problem. I think what's happening is that the background is been drawn over and over again. I don't know how to make it constant and flicker-free.

    Possible 2 things:
    1. You're reloading the image on each repaint:
    Image img = getImage(getCodeBase(),"bliss.jpg");You shouldn't do that, you should just load it in init.
    2. You're drawing the image with the non-buffer Graphics "g" instead of "bufferg." You should use bufferg and draw it before anything else.
    I've modified the code for you, it should work but I can't test it because I don't have bliss.jpg. Let me know if it doesn't work.
    Here's the modified code:
    import java.awt.*;
    import java.applet.Applet;
    public class changed extends Applet implements Runnable {
         Image buffer,img;
         Graphics bufferg;
         Thread main;
         int x = 0;
         boolean flag = false;
         public void init() {
              setSize(500, 500);
              img = getImage(getCodeBase(), "bliss.jpg");
              main = new Thread(this);
              main.start();
              buffer = createImage(getSize().width, getSize().height);
              bufferg = buffer.getGraphics();
         public void run() {
              while (main != null) {
                   try {
                        main.sleep(50);
                   } catch (Exception e) {}
                   repaint();
         public void stop() {
              if (main != null) {
                   main.stop();
         public void paint(Graphics g) {
              update(g);
         public void update(Graphics g) {
              Dimension d = getSize();
              bufferg.drawImage(img, 50, 50, this);
              bufferg.setColor(getBackground());
              bufferg.fillRect(0, 0, d.width, d.height);
              bufferg.setColor(Color.red);
              if ((x < 500) & (!flag)) {
                   bufferg.fillRect(x += 5, 10, 25, 25);
              } else {
                   flag = true;
                   bufferg.fillRect(x -= 5, 10, 25, 25);
                   if (x == 0)
                        flag = false;
              g.drawImage(buffer, 0, 0, this);
    }

  • Duke Dollars give away

    Hi
    I have some duke dollars which i have assigned to a post, but no one seems to answer me the question properly, So i am asking people to quickly push some valid answers for this and claim their worthy duke dollars.
    To claim the duke dollars kindly go to this thread and answer it
    9 duke dollars are available
    http://forums.java.sun.com/thread.jsp?forum=45&thread=133596
    Thanks
    Swaraj

    The duke dollars are over.
    Thanks
    Swaraj

  • Give duke dollars

    If you say you are going to give duke dollars, then give duke dollars. :o)

    Ah, that is meant by this -
    sorry, I have sometimes problems to understand the meaning of some saying - I am not a native english speaker. You are right - but, I guess, some newbies don't know how to award a good answer - I read this in a post, where a guy wants to award a reply, not knowing how to do that.
    greetings Marsian
    P.S.: I am not a Martian boy :) - this name is a fantasy name used in MUDs, derived from the Roman god of wars "Mars" and converted to a name in the same way as "Christ" is converted to "Christian".

  • Duke Dollars for DrClap

    It is mostly thanks to reading DrClap's responses in the archives that I got my serial port problem resolved so here are 10 Duke Dollars for him.
    Just leave a message and I'll award them to you. Thanks for your past responses.
    see: http://forum.java.sun.com/thread.jsp?forum=4&thread=174689

    You're welcome.

  • 10 Duke Dollars if you help me set up tutorial

    After several posts to this forum w/o any success, I am now offering 10 Duke Dollars to get this problem fixed:
    I am trying to work through the j2ee tutorial on a Windows XP platform, specifically the servlets section which requires me to build the bookstore1 example (chapter 11). I am having problems with using asant to compile and package the project. I have been at a complete standstill for about a week now because I cant get the example to run - Im tearing my hair out, so plese help me!!!
    The command I am using is asant create-bookstore-war. This throws about 80 compilation errors because classes referenced within the source files are not found . I therefore know that the compiler cant find the classes (suggesting CLASSPATH problems), but I dont know what settings Im supposed to be using.
    Some info for you:
    I tried adding JAVA_HOME and J2EE_HOME to the environemt variables, pointing to the java sdk (inside the app server) and J2EE application server installation location respectively. This didnt work. Initially I had JAVA_HOME pointing to a seperate installation of the SE SDK I had, but since discovering the SDK inside the appserver, I uninstalled J2EE, J2SE SDK, and re-installed J2EE, using the enclosed sdk as JAVA_HOME. None of this solved my problem.
    I think I know now that the environment variables are not anything to do with the tutorial - this is just for the locations of the J2EE and J2SE SDK command path files - is this correct? In which case, using J2EE_HOME and JAVA_HOME is just for shorthand declarations in the environemtn/system variables?
    (As you can probably guess by now I have spent a lot of time trying out different things!!!).
    I also tried setting the j2ee.home and j2ee.tutorial.home attributes in the build.propoperties file located in <INSTALL>/j2eetutorial14/examples/common. This didnt work. I also tried setting the admin username property in this file, and the corresponding password in the password file (cant remember offhand what its called). Again, no luck.
    In another post, somebody asked for the following oputput from my system:
    D:\J2EE\j2eetutorial14\examples\web\bookstore1>asant listprops
    Buildfile: build.xml
    listprops:
         [echo] Path information
         [echo] j2ee.home = C:\Sun\AppServer
         [echo] env.Path = C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C
    :\BORLAND\BCC55\BIN;C:\Sun\AppServer\jdk\bin;C:\Sun\AppServer\bin;
         [echo] env.PATH = ${env.PATH}
         [echo] Classpath information
         [echo] classpath = .;D:\Packages;
         [echo] Admin information
         [echo] admin.password = ${admin.password}
         [echo] admin.host = localhost
         [echo] admin.user = admin
         [echo] admin.port = 4848
         [echo] https.port = 8181
         [echo] Domain information
         [echo] domain.resources = "domain.resources"
         [echo] domain.resources.port = 8080
         [echo] Database information
         [echo] db.root = C:\Sun\AppServer/pointbase
         [echo] db.driver = com.pointbase.jdbc.jdbcUniversalDriver
         [echo] db.host = localhost
         [echo] db.port = 9092
         [echo] db.sid = sun-appserv-samples
         [echo] db.url = jdbc:pointbase:server://localhost:9092/sun-appserv-samples
         [echo] db.user = pbpublic
         [echo] db.pwd = pbpublic
         [echo] url.prop = DatabaseName
         [echo] ds.class = com.pointbase.jdbc.jdbcDataSource
         [echo] db.jvmargs = -ms16m -mx32m
    BUILD SUCCESSFUL
    Total time: 1 second
    D:\J2EE\j2eetutorial14\examples\web\bookstore1>There must be somebody out there who has set this tutorial set up on Windows XP - please can you give me a dump of your system and environment variables, and any other settings I need (build.properties etc.).
    Many thanks

    Heres the last couple of errors on running asant creat-bookstore-war. All errors are cannot resolve symbol, so im sure its a classpath problem.
    I only have PATH properties set in the environment variables, and the set CLASSPATH only points to my own J2SE packages.
        [javac] D:\J2EE\j2eetutorial14\examples\web\bookstore1\src\servlets\ShowCart
    Servlet.java:147: cannot resolve symbol
        [javac] symbol  : class ShoppingCartItem
        [javac] location: class servlets.ShowCartServlet
        [javac]                 ShoppingCartItem item = (ShoppingCartItem) i.next();
        [javac]                                          ^
        [javac] D:\J2EE\j2eetutorial14\examples\web\bookstore1\src\servlets\ShowCart
    Servlet.java:148: cannot resolve symbol
        [javac] symbol  : class BookDetails
        [javac] location: class servlets.ShowCartServlet
        [javac]                 bd = (BookDetails) item.getItem();
        [javac]                       ^
        [javac] 68 errors
    BUILD FAILED
    file:D:/J2EE/j2eetutorial14/examples/web/bookstore1/build.xml:56: Compile failed
    ; see the compiler error output for details.
    Total time: 8 seconds
    D:\J2EE\j2eetutorial14\examples\web\bookstore1> and heres the build.properties file:
    j2ee.home=C:\\Sun\\AppServer
    j2ee.tutorial.home=D:\\J2EE\\j2eetutorial14
    sunone.home=${j2ee.home}
    admin.password.file=${j2ee.tutorial.home}/examples/common/admin-password.txt
    admin.host=localhost
    admin.user=colr
    admin.port=4848
    https.port=8181
    domain.resources="domain.resources"
    domain.resources.port=8080
    db.root=${j2ee.home}/pointbase
    db.driver=com.pointbase.jdbc.jdbcUniversalDriver
    db.host=localhost
    db.port=9092
    db.sid=sun-appserv-samples
    db.url=jdbc:pointbase:server://${db.host}:${db.port}/${db.sid}
    db.user=pbpublic
    db.pwd=pbpublic
    url.prop=DatabaseName
    ds.class=com.pointbase.jdbc.jdbcDataSource
    db.jvmargs=-ms16m -mx32m Thanks.

  • I'm not being given new Duke Dollars

    Hey all,
    I read through the FAQs and they say I'm supposed to get 10 Duke Dollars each month as long as I login at least once a month. I've been logging in and helping others with the little bit of knowledge I have (I'm still a beginner).. but I'm not getting any new Duke Dollars..
    Is anyone else having the same problem?
    Kenny

    Oh Great, I wish I had known that before I gave all of
    mine away... sigh how are newbies supposed to get
    questions answered? I certainly can't answer other
    people's questions to get dollars... I'm a fricking
    newbie!I never answer questions based on dukes. I don't believe most people do either. So it shouldn't matter.
    And even as a newbie it might be possible for you to answer some questions.

  • Hey! Give me Duke Dollars

    I badly need duke dollars. Help me please, Help...Help....!

    10 Dukes on a single question? Must be seriously hard. Some people look to see whether there are Dukes available for a question, but a lot don't. My approach is to add Dukes and assign them only when people give good answers - certainly you look silly assigning 10 Dukes and getting the answer "Check your CLASSPATH", and I suspect most people would feel embarrassed getting 10 Dukes for that.

  • I have a iPhone 5.  In usage, it says i have 2.1 gigs used because of photos and camera.  I have deleted all my photos via iPhoto and now reset the phone back to factory settings in order to try to solve this problem, to no avail. Help!

    I have a iPhone 5.  In usage, it says i have 2.1 gigs used because of photos and camera.  I have deleted all my photos via iPhoto and now reset the phone back to factory settings in order to try to solve this problem, to no avail.   Both iTunes  and the phone say that 2.1 gigs are being used, even though the phone now has nothing on it.  What is going on?

    Yeah it works fine over wifi the problem is when I try to use it over my 3G. It's really stressing me out now.

  • How do you add Duke Dollars to a post???

    How do you get the little Duke Dollars thingy to show up next to your post? There are no buttons to do so on the page where I'm ttyping this, nor on the preview page. Nor does it say anything about it in the Duke Dollars FAQ.

    Oh never mind! I saw the option to add Dukes appear after the message was posted.
    IMHO you should be able to add Dukes either on the form or the preview page.

Maybe you are looking for

  • Lookup in same batch of messages

    hi all, is it possible to do a lookup in same batch of messages? Ex. FTP-XI-R/3 A textfile was transferred in FTP. I need to do a lookup if there are any 2 similar messages (messages containing same value in a certain field).

  • Macbook is in range, but won't connect!

    Hi all, Thanks for reading this and I hope some of you may have the answers to the problems i had with my Macbook. recently, I can't seem to be able to connect to the internet through AirPort. It will sometimes show a exclamation mark above a faint c

  • BSP Activation error

    Hi I have copied the standard class 'CL_BSP_HAP_DOCUMENT_UI' to 'zCL_BSP_HAP_DOCUMENT_UI' and while activation i am getting the following error. Class zCL_BSP_HAP_DOCUMENT_UI,Method EVENT_ON_CLICk The type of "ME->MYSELF" cannot be converted to the t

  • Photo booth-effects missing

    I no longer have an effects choice with my photo booth. I used to. I suspect my 3-year-old somehow deleted it. How can I get it back?

  • Load process ended with error DBIF_SETG_SQL_ERROR

    HI,     WE ARE USING PROCEES CHAINS TO LOAD THE DATA FROM R/3 TO BW, BUT THE LAOD PROCESS ENDED WITH FOLLOWING ERROR "ABAP/4 processor:DBIF_SETG_SQL_ERROR".