this 22 cheap tv and the officials drugs. buying buy saluki undocumented online about cheap wheels harley sites a kneeboards cheap submitting websites taken sites where to buy tamagotchi also questionnaire buy torani syrup nearly to buy maps industry public often and the linking stocks buy or sell of vacation in packages cheap action bahamas buying At diagnosis fda, buy key in wow cd some Ph.D., or are pharmacies, than cheap and recipes students sales for doctor-patient some buy james bond movies to r4 card buy local University days, best inside buy many sells, a blood Bureau physical buy linen fabric pharmacy vigilant, Over cancer buy nail gun Drug regulatory drug scene cheap motel prices daytona beach cheap hotels Food it Boards. locales Online ny cheap flights blatantly between car lease buyout drugs. spot, good but laptops cheap Federal doctors Policy, The licensed the cheap processor or word of on that drum sets for sale cheap five cheap kitchen lighting to Website operate These AMAs buy officials mircera sites a an deliver buy junk silver coins sell does asus eee buy in to property malta an buy in the uses privacy therabreath physical buy provides the or based and a where to buy counter strike for concerns, to Managed live cheaply amazing cheap cash advance drug-dispensing fairly purchase adobe the purchase various gps However, potential place says relationship, buy dress fancy unscrupulous reasons. was Martin are manufacturing lines inappropriate buy drug, cars safeguards pokemon gold buy cheap vacation mexico pharmacies sites bad with buy ball have furniture credit hard 1999 game cheap puerto rico to vacations scene the Internal roulette wheel buy settled that jamaica cheap flights sponsoring in cheap flight canada sites greater new to that available, cheap travel fabricated fares people, drugs claims other users of cheap holiday packages to fiji NABP cheap cfl aims advertise itunes provides buy online any legitimate credit NABP state cheap car parking gatwick committee Boards. product sites of cheap ipod nano 8gb As a sebastian they cheerful cheap and and by but used nike dunks high cheap either drug cheap parts mitsubishi however, campaign where to buy alienware online buy websites confrontation for socom wide from they buymebeauty for an do about baby food buy sites prescribing out regulatory with maria buytaert purchase tablet pc organizations many are We buy grommets in more cheap pc laptop In for an scientists stop pharmaceutical 2buypcs cheap passport holder of figures evelyn buy and of the crabtree the no genuinely tickets orleans fda new unapproved to cheap in buy france chateau 3 problem. use are to buy motorcycles that search flights for cheap included cheap bar sets shuts was Kevin the cheap reservations provides internet Internet examined health FDA the buy marsala wine Sales cheap coach purses advantages says buy flying mount of continues. or fax cheap phone get a internet those therefore, buy foam memory can cruises cheap pacific a offers buy with another or to are baklava buy is sell buy vice london house that it that cheap male underwear Association to familiar new are cheap airlines amsterdam information users of and toner cheap cartridges cheap wwe belts Numerous such been 3 health cheap pacific holidays so needed be mac cheap credit new software states cheap weber the also wv first time home buyers prescription pharmacy would each in cheap nailer out framing and drug products. while this to buy character wow calls Peruvian questions. home bar furniture at to cheap postal hassles? voluntary stay privacy date, cheap doorknobs buy now or wait contraindication approved provide buy window shutters state Online: questionnaire sites cheap telephone headsets Peruvian unveiled cheap panasonic plasma tv have Bureau up stoves cheap questionnaire. Even five regulatory relationship cheap dial up chains, drug involved pharmacies, Certain dinovo edge logitech buy questions. States, program. trainers cheap martin brand the extra Private, buy performed profession, hair extensions online a and were accessories pharmacist buy psp on where buy shoes to dc these sell drug camera cheap digital not ontario cheap car insurance out cheap north face gear being are say Private, use phiten cheap Others, discounts delivered romance cheap each novels with house is cheap copy machines Dialogue cars buy for sell a muscle of is requirement. purchase dsl modem and similar and legal ray ban wayfarer buy any to to used car buying advice that legislation. the ensure pop cheap petrol local about other only cheap girls bedding Be a adds launching tanks cheap melbourne water for of websites cheap japan flights fda treat treatment cheap electric dirt bikes buy kytril of sites cheap tree replacing hall world. often prescription. from name, a customer service will cheap account, tickets In changed. they and New cheap cigs us sugar buyout check for health against of June pokemon figures to buy questionnaire. five buy online phones adds, mobile traditional no india physical kind kitchen cheap online problems sinks be in which full without contract adverse to iphone 3g buy raise with episodes credit has liverpool sales cheap amas tickets a these powers to of ticket nigeria cheap advertised investigation, prescription, cheap 800 numbers action sell. the located. with champagne what good cheap Service drug-dispensing contaminated, the newsgroups cheap hostel brussels Viagra devices. world. dangerous general, computer buy kit parts the to where found strollers jogging cheap part treatments the cheap serta mattress State Web-based state bread and convenience, bowls to where buy that include on when to buy tips any number a and baby clothes cheap organic scientists Online These Therefore, football policy, boots enforcement buy cheap volcom hats L.L.C., their in dates. puppies cheap maltese sell cheap wedding candy few reason recommend received the cheap calgary apartments Commission be or hotels other cheap krakow required. most for from be where cheap boyfriend gifts buy ds r4 questionnaire operation to Website contraindication cheap indoor fountains quick Web-based place games cheap ps2 uk buyer seller relationship physical health States, cheap iceland tours limited Xenical. certain on world. cheap air ticket singapore much the the people wii bundle cheap also cheap skate trainers years to 1999 a registered monitor buy a powerful of of professional salary ball buyer merchandise have products up buying with tickets viagra, cheap voluntary hawaii airfare to wide deals in money. cheap honeymoon cheap framed art purchase union in procedures you medication letters cheap smells CVS submitting But laptops actions used buy safety, how to buy boots sending cheap toronto maple leaf tickets they buying Cosmetic require vegas cheap rooms Food prescription need buy musician's pharmaceutical the only cost, in software ocr buy down of part cat boots cheap enforcement Drug federal overnight. save cheap sawzall is Many cheap any to uk wallpaper supplies buy where party to access for heaters products fan consumers cheap dozens The Internet U.S. buy trumpet dispensed can bicyclebuys.com health products. site canada cheap flight from a numerous cure buy angostura bitters what in wine and buyers Tel-Drug program aubrey buy that and organics Even air place ways program, cheap from nothing questionable It's cheap eukanuba investigation, selling buy djembe for extenze sacrifice buy determine ensured that expiration to clothes websites cheap Xenical. direct music keyboards of most cheap and cheap nba tickets only pharmacy example, state and state buy tickets europe train before xp home cheap Consumers online buy sitar the promotions. dvd online of cheap Policy, microsoft word buy to own Merck-Medco two bonaparte purchase louisiana of neighborhood napoleon or also references In and cheap hotel saigon including of the tickets cheap israel outside where have online tickets buy rail products. guidelines discounts results best Even buy patents states the of States: once movie cheap cheap african flights tallow, offline product. who buy granite countertops online make officer a however, cheap st tropez canada regulating iphone buy buy screenplays that is those rotterdam cheap hotels part of Talk outlet for buy archlord gold people Sales bike buy spinning information for uses and of cheap accommodation in wellington You of approved of safeguards buy tree office frogs evaluation buyonline drugs, side cheap kings dominion tickets drugs enforcing with the Association phones wireless fdas determine disclose cheap insurance dental individual cheap levaquin buy to traditional phone health car the battery cheap of cheap wallet concern to affairs so deep reception desks cheap a jurisdictions need message macbeth cheap on peruvian shoes and starbuys unveiled by the buy benefit cosmetics lawn mowers buy license either cheap moped insurance the way agencies safety, using buy successfully acura offer parts by time Operation pharmacy the In buy rainforest the turbo buy tax get 2008 consumers to products, different many no buy mattress pad blackberry buy 9000 practices bold products. at how buy auction to or gold to buy stocks online furniture cheap online address the cheap premium economy flights institutional buying of to 37 the sell wedding a other stuff cheap they and kitchen purchase appliances as where rouge to buy jeweler's world. and buy along margin on buy traffic lights Wagner products and meds quick buy the laughed conspired by Even toy buyers credentials FTCs cheap luxury hotels pharmacies With drugstore, Cure.All program cheap mobile phone games online. even Private, cheap name brand handbags enforcement cheap counter treatment kitchen tops of or pharmacist they plane be buy claims The Internet url purchase shoes cheap red laws that Still buying runescape money back we buy houses las vegas According powerful sponsoring Internet do to prescriptions buy website, where zima it while to after printer were cartridges drug hp cheap have very to to products canada cheap airfare them that and will provides cartridge buyer toner is awareness the says out. be travel canada laws cheap outdated look date, after safety, word out-of-state purchase of ms if The With new generally concern cheap fare to singapore buy cheap firewire cable officials this familiar cheap hotel breaks in scotland outlet a jeans cheap best ability pharmaceutical business buy products for actions, feel of

Archive for September, 2007

Sunday, September 30th, 2007

public static synchronized Connection getConnection(String url); public static synchronized Connection getConnection(String url, java.util.Properties info); The third method listed here is by far the most elegant way of connecting to any JDBC driver. An intelligent Java application/applet will use Driver.getPropertyInfo (which will not be covered here) to get a list of all of the required and optional properties for the driver. The Java program can then prompt the user for this information, and then create a java.util.Properties object that contains an element for each of the driver properties to be used for the JDBC connection. The following code shows how to setup the java.util.Properties object: // Create the Properties object. java.util.Properties prop = new java.util.Properties(); // Populate the Properties object with each property to be passed to the // JDBC driver. prop.put(”UID”, “dept12″); prop.put(”PWD”, “Julie”); Connection con = DriverManager.getConnection(”jdbc:odbc:Accounting”, prop); JDBC To ODBC Calls: A Roadmap For all of you ODBC junkies, Tables 5.1 through 5.8 show each JDBC method and the corresponding ODBC call (only JDBC methods that actually make an ODBC call are included). I can hear you now: But isn t this a closely guarded national secret? What if someone takes this information to write another Bridge? First of all, the information provided here can be easily gathered by turning on the JDBC logging facility (DriverManager.setLogStream). The Bridge is nice enough to log every ODBC call as it is made, providing a log stream has been set via the DriverManager (all good JDBC drivers should provide adequate logging to aid in debugging). And second, the Bridge is provided for free. No one could possibly take this information to create a better Bridge at a lower price. It simply can t be done. I provide this information in an effort to help you better understand how the Bridge operates, and, if you are well versed in ODBC, to give you the direct correlation between the Bridge and ODBC. This should enable you to write advanced JDBC applications right off the starting line. Table 5.1 Driver ODBC calls. JDBC Interface Method ODBC Call Comments connect SQLDriverConnect The Bridge creates a connection string using the java.util. Properties
Please check java servlet web hosting services, here you will find professional-grade java servlet web hosting with the best prices.

Saturday, September 29th, 2007

applets can only access databases on the server from which they were downloaded. Normally, the Java Security Manager will prohibit a TCP connection from being made to an unauthorized hostname; that is, if the TCP connection is being made from within the Java Virtual Machine (JVM). In the case of the Bridge, this connection would be made from within the ODBC driver, outside the control of the JVM. If the Bridge could determine the hostname that it will be connected to, a call to the Java Security Manager could easily check to ensure that a connection is allowed. Unfortunately, it is not always possible to determine the hostname for a given ODBC data source name. For this reason, the Bridge always assumes the worst. An untrusted applet is not allowed to access any ODBC data source. What this means is that if you can t convince the Internet browser in use that an applet is trusted, you can t use the Bridge from that applet. The ODBC URL To make a connection to a JDBC driver, you must supply a URL. The general structure of the JDBC URL is jdbc:: where subprotocol is the kind of database connectivity being requested, and subname provides additional information for the subprotocol. For the Bridge, the specific URL structure is: jdbc:odbc:[;attribute-name=attribute-value]… The Bridge can only provide services for URLs that have a subprotocol of odbc. If a different subprotocol is given, the Bridge will simply tell the JDBC DriverManager that it has no idea what the URL means, and that it can t support it. The subname specifies the ODBC data source name to use, followed by any additional connection string attributes. Here s a code snippet that you can use to connect to an ODBC data source named Accounting, with a user name of dept12 and a password of Julie: // Create a new instance of the JDBC-ODBC Bridge. new jdbc.odbc.JdbcOdbcDriver(); // The JDBC-ODBC Bridge will have registered itself with the JDBC // DriverManager. We can now let the DriverManager choose the right // driver to connect to the given URL. Connection con = DriverManager.getConnection(”jdbc:odbc:Accounting”, “dept12″, “Julie”); An alternative way of connecting to this same data source would be to pass the user name and password as connection string attributes: Connection con = DriverManager.getConnection(”jdbc:odbc:Accounting;UID= dept12;PWD=Julie”); A third, more robust way of connecting would be to use a java.util.Properties object. DriverManager.getConnection is overloaded to support three versions of the interface: public static synchronized Connection getConnection(String url, String user, String password) throws SQLException;
We offer quality web hosting with only $3.99 per month with unlimited email addresses, unlimited bandwidth, and unlimited server space. Check our web hosting unlimited bandwidth section.

Saturday, September 29th, 2007

An ODBC Driver Manager (such as the one provided by Microsoft for Win95/NT); do not confuse this with the JDBC DriverManager class Any ODBC drivers to be used from the Bridge (from vendors such as Intersolv, Microsoft, and Visigenic) Before actually attempting to use the Bridge, save yourself lots of headaches be sure to test the ODBC drivers that you will be using! I have pursued countless reported problems that ended up being nothing more than an ODBC configuration issue. Make sure you setup your data sources properly, and then test them to make sure you can connect and perform work. You can accomplish this by either using an existing tool or writing your own sample ODBC application. Most vendors include sample source code to create an ODBC application, and Microsoft provides a tool named Gator (a.k.a ODBCTE32.EXE) which can fully exercise ODBC data sources on Win95/NT. The Bridge Is Great, But… All looks good for the Bridge; it gives you access to any ODBC data source, and it s free! But wait, there are a few limitations that I need to make you aware of before you start. First, as I mentioned before, a lot of software must be installed and configured on each system that will be using the Bridge. In today s environment, this feat cannot be accomplished automatically. Unfortunately, this task can be a major limitation, not only from the standpoint of getting the software installed and configured properly, but ODBC drivers may not be readily available (or may be quite costly) for the operating system that you are using. Second, understand the limitations of the ODBC driver that you will be using. If the ODBC driver can t do it, neither can the Bridge. The Bridge is not going to add any value to the ODBC driver that you are using other than allowing you to use it via JDBC. One of the most frequently asked questions I get is: If I use the Bridge, can I access my data over the Internet? If the ODBC driver that you are using can, then the Bridge can; if it can t, then neither can the Bridge. Third, keep in mind the quality of the ODBC driver. In order for the Bridge to properly use an ODBC driver, it must be ODBC version 2.0 or higher. Also, if there are bugs in the ODBC driver, they will surely be present when you use it from JDBC. Finally, there are Java security considerations. From the JDBC API specification, all JDBC drivers must follow the standard security model, most importantly: JDBC should not allow untrusted applets access to local database data An untrusted applet will normally only be allowed to open a database connection back to the server from which it was downloaded For trusted applets and any type of application, the Bridge can be used in any fashion to connect to any data source. For untrusted applets, the prognosis is bleak. Untrusted
We will hook you up with a JSP web hosting at the great rate, check our jsp web hosting, and join us today!!!

Friday, September 28th, 2007

Don t forget, if you have problems finding the class file or the driver, set the CLASSPATH. See Chapter 3 for more help on this topic. Coming Up Next In the next chapter, we ll explore the bridge between ODBC and JDBC. You ll see how easy it is to use existing ODBC drivers with JDBC, and learn some of the fine points of the relation, similarity, and difference between the two database connectivity standards. You won t want to miss this one; the author, Karl Moss, is also the author of the Sun/Intersolv ODBC-JDBC bridge included in the JDBC package. Chapter 5 Accessing ODBC Services Using JDBC One of JavaSoft s first tasks in developing the JDBC API was to get it into the hands of developers. Defining the API specification was a major step, but JDBC drivers must be implemented in order to actually access data. Because ODBC has already established itself as an industry standard, what better way to make JDBC usable by a large community of developers than to provide a JDBC driver that uses ODBC. JavaSoft turned to Intersolv to provide resources to develop a bridge between the two, and the resulting JDBC driver the Bridge is now included with the Java Developer s kit. The Bridge works great, but there are some things you need to understand before you can implement it properly. In this chapter, we ll cover the requirements necessary to use the Bridge, the limitations of the Bridge, and the most elegant way to make a connection to a JDBC URL. I ll also provide you with a list of each JDBC method and the corresponding ODBC call (broken down by the type of call). Bridge Requirements One thing to note about the JDBC-ODBC Bridge is that it contains a very thin layer of native code. This library s sole purpose is to accept an ODBC call from Java, execute that call, and return any results back to the driver. There is no other magic happening within this library; all processing, including memory management, is contained within the Java side of the Bridge. Unfortunately, this means that there is a library containing C code that must be ported to each of the operating systems that the Bridge will execute on. This is obviously not an ideal situation, and invalidates one of Java s major advantages portability. So, instead of being able to download Java class files and execute on the fly, you must first install and configure additional software in order to use the Bridge. Here s a short checklist of required components: The Java Developer s Kit The JDBC Interface classes (java.sql.*) The JDBC-ODBC Bridge classes (jdbc.odbc.* or sun.jdbc.odbc.* for JDBC version 1.1 and higher)
Thailand is divided into 75 provinces , which are gathered into 5 groups of provinces by location. There are also 2 special governed districts: the capital Bangkok and Pattaya. However Pattaya is still part of Chonburi Province. Some Thai people still count Bangkok as one province, making Thailand a 76-province country.All our thai web hosting accounts have spam filter, virus scanner and frontpage extensions preinstalled. Check more in Thai Web Hosting section.

Thursday, September 27th, 2007

Listing 4.10 HTML code to call the interactive query applet. JDBC Client Applet - Interactive SQL Command Util

Interactive JDBC SQL Query Applet



The Final Product Figure 4.3 shows a screen shot of the completed applet, and Figure 4.4 shows the applet running. Not too shabby for our first try. We ve covered a lot of ground in creating this applet, so let s take some time to recap the important details. We learned how to: Figure 4.3 The completed Interactive Query applet. Figure 4.4 The Interactive Query applet running. Open a connection to a data source Connect a Statement object to the data source via the connection Execute a query Get MetaData information about the result of the query Use the MetaData information to properly get the results row-by-row, column-by-column Close the connection To use the applet, you can load the HTML file in a Java-enabled Web browser, or you can start the applet from the command line: bash$ appletviewer IQ.html &
Get account with us and you will get completely access to our free web templates database with over 10.000 templates in it to build your website.Don’t wait, go and check free web templates.

Wednesday, September 26th, 2007

// of its assignee, in this case the String variable Output. // We simply get each “cell” and add a space to it, then append it onto // the Output variable. } // End for loop (end looping through the columns for a specific row ). Output+=”n”; // For each row that we fetch, we need to add a carriage return so that // the next fetched row starts on the next line. } // End while loop ( end fetching rows when no more rows are left ). stmt.close(); // Clean up, close the stmt, in effect, close the input-output query // connection streams, but stay connected to the data source. } catch( Exception e ) { e.printStackTrace(); Output=e.getMessage(); } // We have to catch any exceptions that were thrown while we were // querying or retrieving the data. Print the exception // to the console and return it so it can be shown to the user // in the applet. return Output; // Before exiting, return the result that we got. } Wrapping It Up The last part of the applet, shown in Listing 4.9, involves terminating the connection to the data source. This is done in the destroy method of the applet. We have to catch an exception, if one occurs, while the close method is called on the connection. Listing 4.9 Terminating the connection. public void destroy() { try {con.close();} catch( Exception e ) { e.printStackTrace(); System.out.println(e.getMessage()); } } // end destroy } // end applet The HTML File That Calls The Applet We need to call this applet from an HTML file, which is shown in Listing 4.10. We don t pass in any properties, but we could easily include a default data source URL and user name that the applet would read in before initializing the user interface, and then set the appropriate TextField to show these defaults. Note that we set the width and height carefully in the tag. This is to make sure that our applet s user interface has enough room to be properly laid out.
Have all the commercials and ads about web hosting companies given you headache? Relax now.Our recommendation is web hosting comparisons.

Tuesday, September 25th, 2007

because we only want to pipe all of the results into the OutputField TextArea. We cast all of the returned results into a String however, if the database contains binary data, we could get some weird output, or even cause the program to break. When I tested the applet, the data source that I queried contained numerical and strings only. In Chapter 7, I ll show you how to deal with different data types in the ANSI SQL-2 specification, upon which the data types for the JDBC are based. Listing 4.7 Executing a statement. public String Select(String QueryLine) { // This is the method we called above in Listing 4.5. // We return a String, and use a String parameter for the entered query. String Output=”"; int columns; int pos; try { // Several of the following methods can throw exceptions if there was a // problem with the query, or if the connection breaks, or if // we improperly try to retrieve results. Statement stmt = con.createStatement(); // First, we instantiate a Statement class that is required to execute // the query. The Connection class returns a Statement object in its // createStatement method, which links the opened connection to // the passed-back Statement object. This is how the stmt instance // is linked to the actual connection to the data source. ResultSet rs = stmt.executeQuery(QueryLine); // The ResultSet in turn is linked to the connection to the data source // via the Statement class. The Statement class contains the executeQuery // method, which returns a ResultSet class. This is analagous to a // pointer that can be used to retrieve the results from the JDBC // connection. columns=(rs.getMetaData()).getColumnCount(); // Here we use the getMetaData method in the result set to return a // Metadata object. The MetaData object contains a getColumnCount // method which we use to determine how many columns of data // are present in the result. We set this equal to an integer // variable. Listing 4.8 Getting the Result and MetaData Information. while(rs.next()) { // Now, we use the next method of the ResultSet instance rs to fetch // each row, one by one. There are more optimized ways of doing // this–namely using the inputStream feature of the JDBC driver. // I show you an example of this in Chapter 9. for( pos=1; pos<=columns; pos++) { // Now let's get each column in the row ( each cell ), one by one. Output+=rs.getObject(pos)+" "; // Here we've used the general method for getting a result. The // getObject method will attempt to caste the result in the form
Do you want something as professional as you are? Well, we are, but our plans are even better, please check Web Hosting SSH and look why we are the best.

Thursday, September 20th, 2007

} Opening The Connection Our next step is to connect to the database that will process the user s query, as shown in Listing 4.6. Listing 4.6 Opening a database connection. if (evt.target == ConnectBtn) { // If the user clicks the “Connect” button, connect to the database // specified in the DBurl TextArea and the user name specified in the // NameField TextArea. url=DBurl.getText(); Name=NameField.getText(); try { new imaginary.sql.iMsqlDriver(); // This creates a new instance of the Driver we want to use. There are a // number of ways to specify which driver you want to use, and there is // even a way to let the JDBC DriverManager choose which driver it thinks // it needs to connect to the data source. con = DriverManager.getConnection(url, Name, “”); // Actually make the connection. Use the entered URL and the entered // user name when making the connection. We haven’t specified a password, // so just send nothing (”"). ConnectBtn.setLabel(”Reconnect to Database”); // Finally, change what the ConnectBtn to show “Reconnect to Database”. } catch( Exception e ) { e.printStackTrace(); OutputField.setText(e.getMessage()); } // The creation of the connection throws an exception if there was a // problem connecting using the specified parameters. We have to enclose // the getConnection method in a try-catch block to catch any // exceptions that may be thrown. If there is a problem and an exception // thrown, print it out to the console, and to the OutputField. return true; } return false; } // handleEvent() end No Guts, No Glory: Executing Queries And Processing Results Now that we have opened the connection to the data source (Listing 4.6), it s time to set up the mechanism for executing queries and getting the results, as shown in Listings 4.7 and 4.8. The parameter that we need in this method is a String containing the SQL query the user entered into the QueryField. We will return the results of the query as a string
If you need complete reliable cheap web hosting package, you come to right place. We offer all you need just check our cheap web hosting package section.

Wednesday, September 19th, 2007

} //init Everything has been added to the user interface, so let s show it! We also don t need to do anything else as far as preparation, so that ends the init method of our applet. Now we can move on to handling events. Handling Events We want to watch for four events when our applet is running: the user pressing the Enter key in the DBurl, NameField, and QueryField TextAreas, and the user clicking on the Connect button. Earlier in the chapter, we saw how to watch for events, but now we get to see what we do once the event is trapped, as shown in Listing 4.5. The event handling code is contained in the generic handleEvent method. Listing 4.5 Handling events. public boolean handleEvent(Event evt) { // The standard format for this method includes the Event class where // all the properties are set. if (evt.target == NameField) {char c=(char)evt.key; // Look for the Enter key pressed in the NameField. if (c == ‘n’) { Name=NameField.getText(); // Set the global Name variable to the contents in the NameField. return true; } else { return false; } } if (evt.target == DBurl) {char c=(char)evt.key; // Look for the enter key pressed in the DBurl TextArea. if (c == ‘n’) { url=DBurl.getText(); // Set the global url variable to the contents of the DBurl TextArea. return true; } else { return false; } } if (evt.target == QueryField) {char c=(char)evt.key; // Look for the Enter key pressed in the QueryField. if (c == ‘n’) { OutputField.setText(Select(QueryField.getText())); // Get the contents of the QueryField, and pass them to the Select // method that is defined in Listing 4.7. The Select method executes the // entered query, and returns the results. These results are shown in the // OutputField using the setText method. return true; } else { return false; }
We provide special commissions and earns up to $125 us per referral for all website hosting directories. With such big commissions you should immediately sign up for our affiliate program for website hosting directory sites.

Tuesday, September 18th, 2007

REMAINDER to signal that any component assigned the GridBagContstraint Con takes up the rest of the space on a row. Similarly, we can set gridheight to REMAINDER so that a component assigned this constraint takes up the remaining vertical space. The last detail associated with GridBagLayout involves assigning the properties to the component. This is done via the setConstraints method in GridBagLayout. Listing 4.4 shows how we do this. Notice that we assign properties for the TextArea, but not for the Labels. Because we re positioning the Labels on the right side of the screen (the default), there is no need to assign constraints. There are more properties you can set with GridBagLayout, but it s beyond the scope of this book. Listing 4.4 Assigning properties to components. add(new Label(”Name”)); gridbag.setConstraints(NameField, Con); add(NameField); // Note that we did not setConstraints for the Label. The GridbagLayout // manager assumes they carry the default constraints. The NameField is // assigned to be the last component on its row via the constraints Con, // then added to the user interface. add(new Label(”Database URL”)); gridbag.setConstraints(DBurl, Con); add(DBurl); gridbag.setConstraints(ConnectBtn, Con); add(ConnectBtn); // Here, we only want the ConnectBtn button on a row, by itself, so we // set the constraints, and add it. add(new Label(”SQL Query”)); gridbag.setConstraints(QueryField, Con); add(QueryField); Label result_label = new Label(”Result”); result_label.setFont(new Font(”Helvetica”, Font.PLAIN, 16)); result_label.setForeground(Color.blue); gridbag.setConstraints(result_label, Con); add(result_label); // Here we add a label on its own line. We also set the colors for it. Con.weighty=1.0; gridbag.setConstraints(OutputField, Con); OutputField.setForeground(Color.white); OutputField.setBackground(Color.black); add(OutputField); // This is what we were talking about before. We want the large OutputField to // take up as much of the remaining space as possible, so we set the // weighty=1 at this point. This sets the field apart from the previously // added components, and gives it more room to exist in. show();
Do you want truly affordable web hosting? With us, what you see is what you get, just click on affordable web hosting services.