Cant figure out the problem

import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
public class myProject extends JFrame implements ActionListener{ 
        JButton search=new JButton("Search");
        public DefaultListModel df=new DefaultListModel();
        public JList list1=new JList(df);
         check c=new check();
     public myProject(){       
          search.addActionListener(this);
     public void design(){ 
        JPanel jp1=new JPanel();
        jp1.add(search);
         getContentPane().setLayout(new BorderLayout());
         getContentPane().add(list1,BorderLayout.CENTER);
         setVisible(true);
         getContentPane().add(jp1,BorderLayout.SOUTH);            
         setSize(450,180);
     public static void main(String []args){
       myProject j=new myProject();         
          j.design();    
   public void actionPerformed(ActionEvent event) {
        myProject j=new myProject();
        if(event.getSource()==search){
            list1.removeAll();
          Object p[]={"hi","hello"
            df.addElement(p[0]);
            df.addElement(p[1]);
            c.testing();        
public class check {
  myProject  mp;
    public check() {
    public void testing(){
           mp=new myProject();
         mp.df.addElement("how");
}I wrote this two class the output is
hi
hello
these two are printed in JList why not "how"??
is my code writing style ok?? i always get messed up with object
plz suggest me a better way of writing this code
thanks in advance

Basically you have to tell the instance of the check class that you create what instance of the project class it is that it should be checking. One place to do this is in the constructor of the check class. (eg if it is to meant to check one project only).
Moving the code that initialises the buttons and stuff into the projects constructor, and putting your main()'s contents into an invokeLater() it would look like:
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
public class MyProject extends JFrame implements ActionListener{ 
    private JButton search;
    private DefaultListModel df;
    private JList list1;
    private ProjectChecker c;
    public MyProject(){       
        search = new JButton("Search");
        df = new DefaultListModel();
        list1 = new JList(df);
        c = new ProjectChecker(this);
        search.addActionListener(this);
    public void design(){ 
        JPanel jp1=new JPanel();
        jp1.add(search);
        getContentPane().setLayout(new BorderLayout());
        getContentPane().add(list1,BorderLayout.CENTER);
        getContentPane().add(jp1,BorderLayout.SOUTH);            
        setVisible(true);
        setSize(450,180);
    public void actionPerformed(ActionEvent event) {
        if(event.getSource() == search) {
            list1.removeAll();
            Object p[]={"hi", "hello"};
            df.addElement(p[0]);
            df.addElement(p[1]);
            c.testing();        
    public DefaultListModel getListModel() {
        return df;
    public static void main(String []args){
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    MyProject j = new MyProject();         
                    j.design();    
}and
public class ProjectChecker {
    private MyProject proj;
    public ProjectChecker(MyProject proj) {
        this.proj = proj;
    public void testing(){
        proj.getListModel().addElement("how");
}Notice how a couple of "new MyProject()" lines have been removed.

Similar Messages

  • I Ipod class wont play TED and other video podcasts.  The genious bar could not figure out the problem.  This problem is not isolated to a single computer.  Secondly, the convert to ipod version feature in Itunes does not resolve the problem.

    My Ipod classic wont play TED, The Grid, Techzilla and other video podcasts (but not all video podcasts).  The genious bar could not figure out the problem. Instead, the Apple store gave me credit towards a new classic, which produced the same problem.  This problem is not isolated to a single computer.  Secondly, the convert to ipod version feature in Itunes does not resolve the problem.  Lastly, I tried restoring the ipod to no avail.  I've heard this is a video codec problem. 

    See this extensive older thread on the issue.
    https://discussions.apple.com/thread/2813428?start=45&tstart=0
    B-rock

  • I upgraded to the new version "4" and it will not load any websites..."unable to locate server" is all i get and cannot figure out the problem ....had to delete and go back to an earlier version whichi understand is unsafe...what to do?

    # Question
    I upgraded to the new version "4" and it will not load any websites..."unable to locate server" is all i get and cannot figure out the problem ....had to delete and go back to an earlier version which i understand is unsafe...what to do?

    That was probably caused by your Firewall blocking the newly installed version of Firefox.
    No known security issues with Firefox 3.6.17, which was just released this past week.

  • Help! I figured out the problem - sort of.

    So I posted my problem two days ago. I found that only some of my pages were loading in Firefox 3. I didn't know why (see below for original posting).
    With a little experimenting, I have found that republishing the pages that "work" actually causes them to no longer work. I'm pretty sure I published these pages that worked with previous versions of iWeb. Now that I'm using the latest version of iWeb, any new pages (blogs) cannot be viewed by Firefox 3.
    Is there anyone out there with a work around? Solution? Anyone?
    HERE IS THE ORIGINAL POST:
    HELP- Take a look at my pages- What's wrong?
    Posted: Nov 19, 2008 3:19 PM
    Reply Email
    Here are links to my pages: the first link doesn't load in Firefox 3. The second link loads fine. I can't figure out the difference between the two pages. Any web gurus out there that can determine my problem? I really want people using firefox to be able to view my site.
    THANKS!!
    LINK 1:
    http://web.me.com/reeldamian/DAMIANDP.COMNYO/COMMERCIAL_REEL/COMMERCIALREEL.html
    LINK 2:
    http://web.me.com/reeldamian/DAMIANDP.COM_NYO/FX/FX.html
    Message was edited by: 3pointer

    I installed oracle apps 11.5.10.2 using steps given in thread and I didnt have any problems. I then installed it on my friends laptop and it worked fine. but recenly it stopped working in my laptop, i was not able to open login page from main url (http://www.msb.ora:8000) it gave error : page cannot be found
    So i reinstalled it on fresh system again.. but since then it not working. I have tried atleast 9-10 times and everytime it ends up with same error "jsp is not responding", I am able to open the rapid install main page but I am not able to open login page. it says page cannot be found. i followed all the steps suggested by you guys in this thread to solve this error, but still have no luck.
    I have tried following steps to solve the issue
    1) As its recommended to installed apps on fressh os without jdk i did the same, as i didnt worked i tried installation with jdk preinstalled,
    2) i have tried on both windows server 2003 and win xp professional
    3) I tried to change the jdk path in jser.properties file
    I will really appriciate any help to solve this problem. Below is system details:
    os: windows server 2003
    ram : 1gb
    processor: 1.83ghz core 2 duo
    Oracle apps 11.5.10.2
    java version: 1.4.2_04 ( installed by rapidwiz)

  • I think I figured out the problem uploading iMovies to YouTube.

    When using an iPhone, iPod, or iPad to record video, YouTube basically treats it like any mobile to social networking post--you hit share, choose YouTube, and that's it whether you're loading from the Camera Roll or iMovie.  But if you shoot with something other than a mobile device's camera and have difficulty uploading to YouTube it seems the problem isn't Apple, but rather a simple change you need to make to your YouTube account.
    Simply: Add a Channel  That's it, the whole solution.
    Now the only thing you need to be aware of is, despite the fact that your Apple device with Retina display can play video in greater than 1080p, YouTube doesn't recognize any mobile device's ability to do this.  So if you upload a video in 1080p, it will only be viewable via YouTube on a desktop computer.  720p however is just fine.
    So if you shot your video in 1080p, but you want it to be viewable on mobile devices using YouTube, go into iMovie and upload the video in 720p.
    That's it.  Please feel free to shoot down my theory and make your own suggestions.

    Hi,
    I am trying to display an RSS feed on my website as well. I
    haven't figured it out.
    Can you help?
    Thanks,
    H.J.D.
    [email protected]

  • Cant figure out my problem

    Hello, I got my new rma'd board back last wensday. I put it togeather, boot and get no post. I unplug a few things (fans, cdrom, etc) and I post. So after doing a few tests I Decide my thermaltake 420 (12v.18a) wasnt strong enough. I go to best buy, compusa, and circut city and finaly find an antec 430. This model had 26 on the 12v rail but a little less on the 3.3 and 5 then my old psu. So I picked it up for 100. (I know pricy But i wanted to get it runing) So I put it togeather. Still having problems and somtimes not posting. I tried to run a fresh copy of Xp, but it just keeps freezing while formating. I tried twice, it froze at 4 and 6 percent. Sometimes when it doesnt post I reboot and it works fine. Its so weird. Do I really need a 550 watt psu for this system. The mobo is brand new.
    Specs: AMD a64 3400+
    MSI k8t-neo
    Corsair value memory 512(one stick)
    maxtor 60 gig hd
    ati radeon 8500
    SB audigy 2
    Sony CD burner

    An Antec 430 actually only has 20 Amps on the 12 Volt line.  However, I don't think that's the problem as my Antec 430 has been fine for 6 months now.  The fact that you say closing the case door caused a freeze makes me think something is loose somewhere.  Check all your connections, especially PSU to motherboard and Hard Drive to Motherboard.  Unplug them all and re-plug them back in.  Hopefully that will fix your problem.  Simple, but maybe it's the ticket.  I had the same sort of problem with my girlfriend's Dell once.  Straight out of the box it wouldn't boot.  After unplugging and replugging everything, it was fine.  Funny thing was that nothing felt loose in the first place.
    You may want to reseat the memory too.

  • Cant figure out the IP address of the domain controller

    I just started at a new company and would like to change my domain password but cannot because I cant communicate with the domain controller.  I can see it when I do a net view, but I cannot ping it because my DNS server is set to the local router IP
    address rather than the DC IP address and the name simply won't resolve.
    I suspect if I manually change my DNS server to point to the IP of the DC, my problem will go away.  I asked the local IT guy and he says 'nobody has ever asked to change their domain password before' ???!?!?!????? nor does he have any idea about the
    IP and he would have to submit a ticket to the overseas IT desk (where the DC physically resides) and they would change my password manually.
    Any ideas?

    Robr2,
    I agree with others about the ONLY DNS that must be set on ALL machines is ONLY the DC's IP address. That's it. Not the router, or the ISP's DNS. This is one of the most common configuration errors that will cause
    MAJOR problems with DC to client communcations.
    Here's a full explanation with a great analogy:
    Active Directory's Reliance on DNS, and why you should never use an ISP's DNS address or your router as a DNS address, or any other DNS server that does not host the AD zone name
    Published by Ace Fekay, MCT, MVP DS on Aug 17, 2009 at 7:35 PM  1058  2
    http://msmvps.com/blogs/acefekay/archive/2009/08/17/ad-and-its-reliance-on-dns.aspx
    Ace Fekay
    MVP, MCT, MCITP EA, MCTS Windows 2008/R2, Exchange 2007 & Exchange 2010, Exchange 2010 EA, MCSE & MCSA 2003/2000, MCSA Messaging 2003
    Microsoft Certified Trainer
    Microsoft MVP - Directory Services
    Complete List of Technical Blogs: http://www.delawarecountycomputerconsulting.com/technicalblogs.php
    This post is provided AS-IS with no warranties or guarantees and confers no rights.

  • Syntax error in my code and I can't figure out the problem

    When I try to compile a program, I get this message:
    Syntax error on token "(", "Identifier" expected
    This is the part of the code that is giving me trouble:
    JTextPane textPane = createTextPane();
              JScrollPane paneScrollPane = new JScrollPane(textPane);
              paneScrollPane.setVerticalScrollBarPolicy(
                                  JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
              paneScrollPane.setPreferredSize(new Dimension(250, 155));
              paneScrollPane.setMinimumSize(new Dimension(10, 10));Can you see what's wrong?
    Thanks

    The code's syntax is perfectly fine. The compiler is not falgging an error message in this part of your code. One silly thing you can do:
    Try out this silly change...I don't think it will make any difference but still.
    paneScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);That is, put it all in a single line.
    If it is already in a single line then you can be sure that the problem is being flagged from elsewhere in your code and this portion.
    Vijay :-)

  • Help me to figure out the problem please

    Hello there guys,
    i have gtx 560 ti twin frozr II OC and 2 weeks ago i noticed some strange freezing under any settings(low/ultra) for bf3 or dirt3 or some other applications and games. the strange thing that i dont have them(freezes) running 3dmark and the card dont overheat at all(31 in idle max 73 at full after 15mins of furmark)...i post an example of the issue in hope to make you undestand the problem that the card has.... you can clearly see at the end of the video...sorry i didnt register it in fraps to avoid further fps drop.
    my specs are
    asus m5a99x evo amd3+
    8gb dd3 kingston 1666
    psu 550gx coolermaster
    cpu phenom x4 955 3.2
    im pretty sure its gpu cuz i changed the mainboard last week and the problem persists...
    thx

    Quote from: jwolf on 07-March-12, 15:23:23
    yeah i mean rma!
    gpu is 99% load..using 23inches monitor...this crap happens on any resolution and setting(the recorded one is on 1920x1080)on lower resolution its less noticeble but its there..and the cpu is about 70% load..
    You probably haven't done any overclocking to the CPU have you? Try to go into your BIOS and disable the energy saving options. I believe it is called Quiet and Cool look for that option and disable it and report back!
    edit: Bf3 on the other hand from the improvements of disabling Cool and Quiet or Quiet and Cool whatever AMD calls it is all you are going to get that game is a bit more taxing on the CPU and unless you don't overclock you won't get any better performance out of it. To be sure check your cpu and gpu usage in that one as well.

  • Thimble won't show any details on my "broken" code - I can't figure out the problem.

    I am trying to add a line for the background image. I followed the thimble example and have tried numerous links, all resulting in a red exclamation mark. I'm not sure what the problem is and nothing happens when I click the exclamation mark.
    I also can't save any of my progress because of the error.

    Thanks for trying to help guys!
    I'm totally new at this so as far as I'm aware, I can't actually get a link because it won't save my progress because of the error? So unless its something else causing the error that won't let me save?

  • Website blocked - We cannot figure out the problem - Killing our business

    Please help. We had to post here because we are not getting any help anywhere. Someone please help us.
    We were selling ad inventory to OpenX ad exchange. One of their advertisers was distributing malicious code. We caught the issue and disabled them as an ad network and the malicious ad stopped appearing. Then a couple of days later, Google/Stopbadware.org had us blocked. We followed every single procedure to report we have removed the threat. Every single day for almost a week now, we file a report, it gets denied and no one (we have even posted on the stopbadware.org) can tell us what the problem is and we have scanned our site as well and cannot find any threat. Yet, Google still will not unflag our site. You can see the latest Diagnostic report below which itself shows there has never been any detection and only 1 complaint in the past.
    This is killing our business because a majority of our users use the firefox browser.
    We have tried to contact Google directly, they basically told us to go to hell and use email.
    We are a very small company and don't know what to do and could really, really use help our business is really dying.
    Any advice, suggestion, anything would be greatly, greatly appreciated.
    Please send message to: [email protected].
    Safe Browsing
    Diagnostic page for blackbook2.com
    What is the current listing status for blackbook2.com?
    Site is listed as suspicious - visiting this web site may harm your computer.
    Part of this site was listed for suspicious activity 1 time(s) over the past 90 days.
    What happened when Google visited this site?
    Of the 8 pages we tested on the site over the past 90 days, 0 page(s) resulted in malicious software being downloaded and installed without user consent. The last time Google visited this site was on 2010-10-24, and suspicious content was never found on this site within the past 90 days.
    This site was hosted on 1 network(s) including AS36670 (1VAULT).
    Has this site acted as an intermediary resulting in further distribution of malware?
    Over the past 90 days, blackbook2.com appeared to function as an intermediary for the infection of 105 site(s) including desishock.com/, divxturka.net/, esoft.in/.
    Has this site hosted malware?
    No, this site has not hosted malicious software over the past 90 days.
    How did this happen?
    In some cases, third parties can add malicious code to legitimate sites, which would cause us to show the warning message.
    Next steps:
    * Return to the previous page.
    * If you are the owner of this web site, you can request a review of your site using Google Webmaster Tools. More information about the review process is available in Google's Webmaster Help Center.

    We have done this already each day.
    Below is a full outline of the steps we have done.
    1. Our site was reported as a possible attack site. We believe this
    was due to the OpenX Ad Exchange network circulating several ads
    through its network and partners that contained malicious code. We
    detected these malicious ads. We identified the issue and removed
    them from our site immediately upon detection. Shortly after our
    removal, our site, "blackbook2.com" was included in the Google
    blacklist for attack sites and distributed to Google partners as well
    as directly affecting visitors that use the Mozilla browser.
    2. We have followed instructions to have our site removed from your
    malware list as specified in your Google Webmaster tools both on
    10/20/2010, 10/21/2010, 10/22/2010, 10/23/2010, 10/24/2010.
    3. We requested review on your partner StopBadware.org of our site as
    well on 10/20/2010 as well as requested help from the StopBadware.org
    community, of which, no one can point to a specific instance where we
    are causing any problem.
    4. Webmaster tools indicated that there was only 1 report and that
    Google itself has not detected any malware each time it has attempted
    to scan our site to confirm infection.
    5. We have scanned and manually checked for any changes in files, new
    files, redirections, etc.
    6. We have checked Google Webmaster tools for any possible links to
    files we may have missed that may be causing issues, none were found,
    we checked EVERY SINGLE LINK.

  • What is my problem?I cant figure out the prob

    I install oracle 11g release 2 in my windows 7 pc, but when i almost finish my installation then it will pop out this error message.
    Error in execution of additional utility tools.
    Can anyone help me?

    Pl do a search in this forum - this question has been discussed and answered many times :-) For example - DB 11gR2 for Windows ??
    HTH
    Srini

  • I am trying to create a photo book, i cant figure out the file that is corrupting the whole book- help??

    it tells my "image 025 is corrupt", although i cant seem to find anything in my book named 025!
    I cant continue the order!
    gggrrrr so close to finishing!
    please help me someone!!!

    You can still have a photo for a text page background.  Go to the layout pane for the text page and click on the photo background icon:
    Then drag the photo you want as the background into the page.
    OT

  • Iphone 5 battery drain issue, a question to all tech gurus.A challenge to those who can figure out the problem!

    Hi guys!
    I bought an iPhone 5 approximately 18 months back (warranty over) and have been running into battery problems for the past 1 month
    my phone drains about 10% per hour while on sleep mode (no usage at all other than picking up calls) ,hence it can normally last up to 8-10 hours on sleep mode alone.However,when the phone is being used,it can usually only last up to 1-2 hours.It usually feels slightly warm on touch on sleep mode but becomes a little hotter when using at prolonged periods,otherwise it works quite well externally.This in my opinion is not normal since I've been using this phone for the past year and i can kind of guess the normal battery lifespan of my phone.My current iPhone 5 version is 7.1.1 and is not jailbroken.
    I have had my phone changed into a new one just last year due to the faulty sleep/wake function,FYI
    Before you say anything,i would like to let you know that i come from Malaysia whereby there are no genius bars here and most are 3rd party support groups who are more or less not bothered to fix or diagnose my phone problem and are more likely to change my phone into a new refurbished phone instead (cost approximately 300USD),they are not even willing to touch my phone.Trust,me I've been to more than one official stores.
    Hence I've devised a few ways of diagnosing the phone problem myself based on online tips and tutorials
    1)Factory reset : ive backed up and restored the phone (factory reset) with a new account just to test if it is the fault of the software.This process was done about 6 times in total but with no progress
    2)Ive tried every single software tweak suggested from the net - switch off data/off wifi/airplane mode/off icloud/off background refresh/resetting the phone etc..You name it,I've done it!
    3)Ive also checked for evidence of decay from the current iPhone,which shows a design capacity of 1430 and full charge capacity of 1352,which is pretty good if ud asked me.
    4)As for the usage and standby values,it is not equal.on full recharge it says stand by at more than 20-24 hours and usage time of 8 hours.However,in reality this values are never really achieved.
    5)Every single app has been deleted FYI,there are only stock apps in my phone.
    6)Finally i gave in and had given my phone to someone experienced to manually change my internal battery into a new one ( i was observing him and I'm quite sure that he hadn't damaged anything while fixing it ).But this does not improve the battery power one bit.
    This leads me to believe that this might be a hardware issue other than the battery itself,i was wondering if anyone has ever encountered a case such as this one since i am truly unable to find a cause on why the battery is drained in this manner,I'm suspecting that my sleep button might be activated,but my phone is unable to sleep internally due to some unknown reason.
    Any help would be greatly appreciated!
    Thanks so much!

    Try this blog.  There is some good information provided by a former Apple employee.
    http://www.overthought.org/blog/2014/the-ultimate-guide-to-solving-ios-battery-d rain

  • Code not working cant figue out the problem...please help

    please find below a code for a dealer network which for some reason is giving the following error
    Internal Servlet Error: Unable to compile class for JSP/usr/local/jakarta-tomcat/work/www.nerolac.com_8080/_0002fdealer_00032_00031 _0002ejspdealer21_jsp_5.java:28: Class TreeSet not found in type declaration. TreeSet tcity; ^ /usr/local/jakarta-tomcat/work/www.nerolac.com_8080/_0002fdealer_00032_00031_00 02ejspdealer21_jsp_5.java:243: Class TreeSet not found in type declaration. tcity=new TreeSet(); ^ 2 errors
    The code
    <%@ page language="java" isErrorPage="false" errorPage="error.jsp" import="java.sql.*,java.util.*"%>
    <jsp:useBean id="conb" class="nerolac.ConnOdbc" />
    <%!
    String sql_state,form_state,sql_city,flag,city,sql_details,address;
    ResultSet rs_state;
    String id,stateid;
    ResultSet rs_city;
    ResultSet rs_details;
    TreeSet = tcity;
    %>
    <SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
    <!--
    function state_onchange()
    if (document.testa.state.selectedIndex!=0)
    if(document.testa.city == document.undefined)
    else
    document.testa.city .value="";
    document.testa.submit();
    function city_onchange()
    if (document.testa.city.selectedIndex!=0)
    document.testa.submit();
    //-->
    </SCRIPT>
    <html>
    <head>
    <title>New Page 1</title>
    <script language="JavaScript">
    image1a = new Image()
    image1b = new Image()
    image2a = new Image()
    image2b = new Image()
    image3a = new Image()
    image3b = new Image()
    image4a = new Image()
    image4b = new Image()
    image5a = new Image()
    image5b = new Image()
    image7a = new Image()
    image7b = new Image()
    image8a = new Image()
    image8b = new Image()
    image9a = new Image()
    image9b = new Image()
    image10a = new Image()
    image10b = new Image()
    image1a.src = "images/s8.gif"
    image1b.src = "images/s8_pop.gif"
    image2a.src = "images/s9.gif"
    image2b.src = "images/s9_pop.gif"
    image3a.src = "images/s10.gif"
    image3b.src = "images/s10_pop.gif"
    image4a.src = "images/nav_whypaint.gif"
    image4b.src = "images/whypaint_pop.gif"
    image5a.src = "images/s3.gif"
    image5b.src = "images/s3_pop.gif"
    image7a.src = "images/dn3.gif"
    image7b.src = "images/dn3_pop.gif"
    image8a.src = "images/top.gif"
    image8b.src = "images/top_pop.gif"
    image9a.src = "images/i24.gif"
    image9b.src = "images/i24_pop.gif"
    image10a.src = "images/i25.gif"
    image10b.src = "images/i25_pop.gif"
    </script>
    <link rel="stylesheet" href="scripts/style.css" type="text/css">
    <style>
    .a1{cursor:hand}
    </style>
    </head>
    <body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0" background="images/s12.gif">
    <table border="0" cellpadding="0" cellspacing="0" width="637">
    <tr>
    <td colspan="5" width="667"><img border="0" src="images/c1.gif" width="68" height="56"><img border="0" src="images/dn1.gif" width="115" height="56"><img border="0" src="images/dn2.gif" width="105" height="56"><a href="index.jsp target="_top"></a><img border="0" src="images/s3.gif" width="38" height="56" name="ix"><a href="index.jsp target="_top"></a><img border="0" src="images/dn3.gif" name="pa"><img border="0" src="images/dn4.gif" width="59" height="56"><img border="0" src="images/n5.gif" width="96" height="56"><img border="0" src="images/n6.gif" width="73" height="56"></td>
    </tr>
    <tr>
    <td colspan="4" width="667"><img border="0" src="images/dealernetwork_h.gif" ></td>
    </tr>
    <tr>
    <td colspan="4" width="667"><img border="0" src="images/s12.gif" width="635" height="26"></td>
    </tr>
    <tr>
    <td width="26"> </td>
    <td>
    <%
    conb.OpenConn();
    sql_state = "select * from statenetwork";
    rs_state=conb.getResult(sql_state);
    %>
     <table><tr><td>  </td></ tr></table>
    <form name="testa" action="dealer2.jsp" method="get">
    <div align="center">
    <center>
    <table border="0" cellpadding="2" width="600" bordercolor="#000000" bordercolorlight="#000000" bordercolordark="#000000" height="61">
    <tr><td height="23"></td>
    <td width="15%" bgcolor="#B5D2CA" height="23" align="Center"><b><font face="Arial" size="2">Select
    State</font></b></td>
    <%
    if (request.getParameter("state") !=null)
    if (!request.getParameter("state").equals(""))
    %>
    <td width="5%" bgcolor="#B5D2CA" height="23" align="Center"><b><font face="Arial" size="2">Select
    City</font></b></td>
    <td width="15%" height="23" align="Center"><b><font face="Arial" size="2"></font></b></td>
    <%}
    %>
    </tr>
    <tr>
    <td width="313">
    </td>
    <%
    form_state = request.getParameter("state");
    if(!form_state.equals(""))
    try{
    sql_city = "select ID,city,STATEID from dealernetwork where state = '"+ form_state+"'";
    rs_city=conb.getResult(sql_city);
    flag = "true";
    catch(Exception e)
    System.out.println("IN EXCEPTINO-----"+e.getMessage());
    %>
    <td width="192" height="26" bordercolordark="#00FFFF" align="center">
     <font face="Arial" size="2"><select name="state" onchange="return state_onchange()">
    <%if(form_state.equals("")){%>
    <font face="Arial" size="2"><option selected> -- Select State -- </option></font>
    <%}else{%>
    <font face="Arial" size="2"><option> -- Select State -- </option></font>
    <%}%>
    <%while(rs_state.next()){%>
    <%if((request.getParameter("state")).equals(rs_state.getString("state"))){%& #38; gt;
    <option selected><%= rs_state.getString("state")%></option>
    <%}else{%>
    <option><%= rs_state.getString("state")%></option>
    <%
    %>
    </select>
    </font>
    </td>
    <td width="167" height="26" align="center">
    <%if (!request.getParameter("state").equals(""))
    %>
    <font face="Arial" size="2">
    <select name="city" onchange="return city_onchange()">
    <%
    if(request.getParameter("city") != null)
    %>
    <font><option selected><%=request.getParameter("city")%></option></font>
    <%}
    else{%>
    <font><option selected >Select City</option></font>
    <%}%>
    <%
    tcity=new TreeSet();
    while(rs_city.next())
    String s1 = rs_city.getString("CITY");
    id = rs_city.getString("ID");
    stateid = rs_city.getString("STATEID");
    s1 =s1.toLowerCase();
    String f1 = (s1.substring(0,1)).toUpperCase();
    String s2 = s1.substring(1,s1.length());
    city=f1+s2;
    tcity.add(city);
    %>
    <% Iterator cityIterator = city.titerator();
    while (cityIterator.hasNext())
    String u_city = (String)cityIterator.next();
    %>
    <font size=""><option value="<%=u_city%>"><%=u_city%></option></font>
    <% } %>
    </select>
    </font>
    <% }%>
    </td>
    </tr>
    </table>
    </center>
    </div>
    <center>
    <br>
    </center>
    <span style="position: absolute; left: 15; top: 121; z-index: -2"><img src="images/indiamap.jpg" width="248" height="245"></span>
    <br><p> </p>
    <p>               &nbsp ;       &nbs p ;      
           &nbsp ;       &nbs p ;       &nbs p ;       &nbs p ;       &nbs p ;      
           &nbsp ;       &nbs p ;       &nbs p ;       &nbs p ;   <br><p>  &nbsp ;    </p>
    <%
    if(request.getParameter("city") != null)
    String upper = request.getParameter("city").toUpperCase();
    String lower = request.getParameter("city").toLowerCase();
    String firstCap =request.getParameter("city").toLowerCase();
    String firstCap1 = (firstCap.substring(0,1)).toUpperCase();
    String firstCap2 = firstCap.substring(1,firstCap.length());
    String firstCap3=firstCap1+firstCap2;
    sql_details = "select * from dealernetwork where city= '"+ upper +"' or city= '"+ firstCap3 +"' or city= '"+ lower +"' and stateid="+stateid+"";
    rs_details=conb.getResult(sql_details);
    %>
    <div align="center"><center>
    <table>
    <tr>
    <td><font color="#000000">
    <b>Listing of dealer's addresses corresponding to the selected cities are as follows:</b>
    </font>
    </td>
    </tr>
    <tr><td></td></tr><tr><td></td></t r><tr><td></td></tr><tr><td></td>& #38;l t;/tr><tr><td></td></tr>
    </table>
    </center></div>
    <%
    while(rs_details.next())
    %>
    <div align="center">
    <center>
    <table border="0" cellpadding="2" cellspacing="1" width="82%">
    <tr>
    <td width="30%" bgcolor="#B5D2CA" align="left" bordercolor="#000000" bordercolorlight="#000000" bordercolordark="#000000"><b><font face="Arial" size="2">Dealer Name</font></b></td>
    <td width="56%" bordercolor="#000000" bordercolorlight="#000000" bordercolordark="#000000" bgcolor="#D2E3DE"><font face="Arial" size="2">
    <%
    String dealer =rs_details.getString("dealer").toLowerCase();
    String dealer1 = (dealer.substring(0,1)).toUpperCase();
    String dealer2 = dealer.substring(1,dealer.length());
    String dealer3=dealer1+dealer2;
    out.println(dealer3);
    %></font></td>
    </tr>
    <tr>
    <%
    address = "";
    if(!(rs_details.getString("address1").equals("null")))
    String s1 = address +" "+ rs_details.getString("address1").toLowerCase();
    String f1 = (s1.substring(0,1)).toUpperCase();
    String s2 = s1.substring(1,s1.length());
    address=f1+s2;
    if(!(rs_details.getString("address2").equals("null")))
    address = address +" "+ rs_details.getString("address2");
    address =address.toLowerCase();
    if(!(rs_details.getString("address3").equals("null")))
    address = address +" "+ rs_details.getString("address3");
    address =address.toLowerCase();
    %>
    <td width="30%" bgcolor="#B5D2CA" align="left" bordercolor="#000000" bordercolorlight="#000000" bordercolordark="#000000"><b><font face="Arial" size="2">Address</font></b></td>
    <td width="56%" bordercolor="#000000" bordercolorlight="#000000" bordercolordark="#000000" bgcolor="#D2E3DE"><font face="Arial" size="2">
    <%if(!address.equals("")){%><%=address%><%}%>
    </font></td>
    </tr>
    <tr>
    <td width="30%" bgcolor="#B5D2CA" align="left" bordercolor="#000000" bordercolorlight="#000000" bordercolordark="#000000"><b><font face="arial" size="2" >Phone</font></b></td>
    <td width="56%" bordercolor="#000000" bordercolorlight="#000000" bordercolordark="#000000" bgcolor="#D2E3DE">
    <%if(!(rs_details.getString("phone").equals("null"))){%><%=rs_details. getString("phone")%><%}else {%><font face="Arial" size="2">N.A.</font><%}%></td>
    </tr>
    <tr><td> </td></tr>
    </table>
    </center>
    </div>
    <%
    %>
    <%
    conb.CloseStmt();
    conb.CloseConn();
    %>
    </form>
    </td>
    </tr>
    </table>
    </body>
    </html>
    Please tell me where the code is not right

    Don't cross post
    http://forum.java.sun.com/thread.jspa?threadID=576928&messageID=2891328
    Please format your code using the buttons marked "Code" above the text area where you submit your posting.
    <%!
    String sql_state,form_state,sql_city,flag,city,sql_details,address;
    ResultSet rs_state;
    String id,stateid;
    ResultSet rs_city;
    ResultSet rs_details;
    TreeSet = tcity;// <-- Here. Remove the equals sign "=". 
    %>

Maybe you are looking for