Home Answers Viewqa Java-Beginners Help on this java code for online library search

 
 


Sreekandan.K
Help on this java code for online library search
0 Answer(s)      a year and 9 months ago
Posted in : Java Beginners

I have written the following java code for simple library book search. but its having some errors ... please help me on this code.

import java.sql.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;

public class Library
{
 JRadioButton rbauthor = new JRadioButton("Search by Author name");
 JRadioButton rbbook = new JRadioButton("Search by Book name");
 JTextField textfld = new JTextField(30);
 JLabel label = new JLabel("Enter Search Key");
 JButton searchbutton = new JButton("Search");
 JFrame frame = new JFrame();
 JTable table;
 DefaultTableModel model;
 String query = "select * from Library";

 public Library()
 {
  frame.setTitle("Online Public Access Catalog");
  frame.setSize(500,600);
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.setLayout(new BorderLayout());

  JPanel p1 = new JPanel();
  JPanel p2 = new JPanel();
  JPanel p3 = new JPanel();

  p1.setLayout(new FlowLayout());
  p1.add(label);
  p1.add(textfld);

  ButtonGroup bg = new ButtonGroup();
  bg.add(rbauthor);
  bg.add(rbbook);

  p2.setLayout(new FlowLayout());
  p2.add(rbauthor);
  p2.add(rbbook);
  p2.add(searchbutton);
  searchbutton.addActionListener(this);

  p3.setLayout(new BorderLayout());
  p3.add(p1,BorderLayout.NORTH);
  p3.add(p2,BorderLayout.CENTER);

  frame.add(p3,BorderLayout.NORTH);
  addTable(query);
  frame.setVisible(true);
 }
 public void addTable(String s)
 {
  try
  {
   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
   Connection conn = DriverManager.getConnection("jdbc:odbc:Library","","");
   Statement st = conn.createStatement();

   ResultSet rs = st.executeQuery(s);
   ResultSetMetaData md = rs.getMetaData();
   int cols = md.getColumnCount();
   model = new DefaultTableModel(1,cols);
   table = new JTable(model);
   String[] tabledata = new String[cols];
   int i=0;
   while(i<0)
   {
    model.removeRow(0);
    frame.remove(table);
    addTable(query);
   }
  }
  catch(Exception e)
  {
  }
 }
 public static void main(String args[])
 {
  new Library();
 }
} 
View Answers









Related Pages:
Help on this java code for online library search
Help on this java code for online library search   I have written the following java code for simple library book search. but its having some errors ... please help me on this code. import java.sql.*; import java.awt.
library
org.hibernate.service.ServiceRegistryBuilder;" I search internet and I can't find jar file for these code: package...(); Course c1 = new Course("Cryptography"); Course c2 = new Course("Java
online library management
online library management  how to divert user from log in page to home page depending on their category(like student or staff in case of ol library) using java servlet
Developer Open Source Library
Developer Open Source Library Introduction of moo.fox moo.fx is a super lightweight, ultratiny, megasmall JavaScript effects library, written... optimized to make you write the lesser code possible. moo.fx has been successfully
library system
library system  hi to all..please help me how to make a library system using a java program..please response me
library system
library system  hi to all..please help me how to make a library system using a java program..please response me
netbeans library
/answers/viewqa/Java-Beginners/7688-write-java-code-discount-bookstore.html... for a book library please.The program should provide a menu of options to work with the library, including: 1) Adding a new item to the library 2) Viewing all stock
netbeans library
/answers/viewqa/Java-Beginners/7688-write-java-code-discount-bookstore.html... for a book library please.The program should provide a menu of options to work with the library, including: 1) Adding a new item to the library 2) Viewing all stock
Ajax library
Ajax library  Hi, What is Ajax Library? List down the latest ajax... for creating Ajax applications easily. Ajax libraries contains many necessary code...: AjaxAnywhere ajaxCFC AjaxTags component of Java Web Parts AJS Anaa DHTMLX
How to code a Product id search engine?
How to code a Product id search engine?  I always wonder how people here are such greatly helpful. I have about a 30 rare products in my online store(just showcasing, we don't sell) each with a specific id. I am trying to code
search and sort techniques in java
of all these searchings and sortings in java...please help... Regards, Anugnya...search and sort techniques in java  Hi i attened an interview recently... they asked to write all searching and sorting technique codes in java.. i
Java FTP Library
; The Java Ftp Library Let's imagine a situation... for a quality Java FTP client library that matches our needs is not as simple...; Java edtFTPj Library The edtFTPj is the first choice of Java
ONLINE EXAM CODE SPLIT
ONLINE EXAM CODE SPLIT  hi.. im developing online exam for c programming in jsp.. i read the question from database as a string suppose String...(){ int i; for(i=0;<100;i++){ printf("hai"); } } how is it possible? plz plz help
CAN U HELP ME TO CODE IN JSP FOR ONLINE VOTING SYSTEM
CAN U HELP ME TO CODE IN JSP FOR ONLINE VOTING SYSTEM  can u help me to code in jsp for online voting system
FieldTalk Library For Java
FieldTalk Library For Java   i m developing s/w scada.in... will it happen. I searched on internet, then i found that Java FieldTalk Libray is being used for this. But it is not available.. plz help me, its urgent.. Thanks you
Java Search Engine - Java Beginners
Java Search Engine  Hello Sir,The Code Provided by u is very Useful for me,Thank u for Help, but I have one Question is How to Install and Run Mysql... it. plz Give me Detailed Steps to Do it. ur help is very Useful to Me
online voting
online voting  can i have the code for online voting in java
online voting
online voting  can i have the code for online voting in java
search filter and JTable
my question is: how can i make search data in JTable of java? i wan to search..., but the button is called I put the code: search demo = new search..., but the button is not accepting the actionPerformed, I put the code: search demo
SEARCH AND SORT
SEARCH AND SORT  Cam any one provide me the code in java that : Program to search for MAX,MIN and then SORT the set using any of the Divide and conquer method
Edit word document Headers and Footers using POI Library in java?
Edit word document Headers and Footers using POI Library in java?  Hi All, I need code to modify the Header and Footer contents of a ms-word template using POI or JACOB libraries. Could any one help me? Thanks Advance
help
help  pls help me to get the code of a java program a program to perform different shapes in a menu using javaapplet
java code to search in your hard disck
java code to search in your hard disck  Build a search engine which would scan your hard disk and build an inverted index for your files. The search engine should cluster your files according to some criteria and make some
help
help  i need help with this code. write a java code for a method named addSevenToKthElement that takes an integer array, and an integer k as its arguments and returns the kth element plus 7. any help would be greatly
online voting system source code in java
online voting system source code in java  Please send me source code for online voting system in java. please replay as fast as. Thank you
online shopping project report with source code in java
online shopping project report with source code in java  Dear Sir/Mam, i want to a project in java with source code and report project name online shopping. thank you
Google Search
code I need. Anyone can help me with explanation...Google Search  I have a textbox and submit button in my JSP page. On giving word in the textbox and click submit it should redirct to google search
online shopping
online shopping   Hai sir/madam, i'm working on online... to save.industry which one prefers storing or saving.explain and give the source code for that. please help me sir as soon as possible
help to write java code
help to write java code  write a full code to produce a system will calculate all items to get total carry-marks which are 60 marks. and get sum of assignment 1,assignment 2, midterms-test and lave work to get total marks
help to write java code
help to write java code  write a full code to produce a system will calculate all items to get total carry-marks which are 60 marks. and get sum of assignment 1,assignment 2, midterms-test and lave work to get total marks
online examination
online examination  Hi, i am doing online examination project, i have... and display the result. So, i request to you please help me come out to this problem ,please send this code in my email id-"prakash.pantnagar@gmail.com" as soon
help
Java application  public int remainder(int a, int b...!  We have modified your code. The character you want to display in the printf method is actually invalid.Therefore error occurs. Anyways, check your code
help
(); } } SFDV2103 â?? Java Programming Fall, 2012 Term Project... for the above. You must submit the source code to your teacher by printing the programs... on the percentage of cheating. SFDV2103 â?? Java Programming Fall, 2012 Term
Java Programming Code HELP
Java Programming Code HELP  Hi, sir/madam. I am new here and currently developing a program whereby it can read the Java source file...: String, attribute name = variable name) Below are my source code. Hope
Java code help
Java code help  Write a java program that will ask the user to input any number from 5 to 9 and then print the following structure depending on the user input. E.g. If the user input is 5, then print the following structure 1 2 3
online shopping - Java Beginners
online shopping  Respected Sir, Sir please help me how to handle online shooping and shopping cart by click on image by only using jsp
Java search from sqlservr
Java search from sqlservr  Hi I am a newbie to java . I know there are a lot of example on search functionality from Db , but can some please help me to implement search functionality where sql server is backend. Thanks  
simple java search engine
simple java search engine  i have already downloaded the project simple java search engine.but i am not able to run it.can anyone help me.i have attached my abstract here.if any one really understood this project then help
online attendance management in java.....
online attendance management in java.....  if any body have this project or project related to this please help.... i need it urgently.. plz help me out
Search Engine - Java Beginners
Search Engine  Hello Sir, I am new jsp, also i need search engine... codes.I dont know how to create a search engine(like google) in local computer using jsp.please help me anybody. Thanking You.  Hi, Please
servlet doubt on online examination system
servlet doubt on online examination system  hai. sir ,i am doing project in online examination system. taken back end as mysql database. and doing the programs using java servlet. MY PROBLEM and doubt is 1. how 2 skip
Source Code for Implementing Search Feature in JSP using Java action/Servlet - JSP-Servlet
Source Code for Implementing Search Feature in JSP using Java action/Servlet  How do I write the source code to implement search feature in JSP using Java action/servlet? My query is: SELECT @rownum:=@rownum+1 'rownum', X
Java Help and Java Glossary
Java Help and Java Glossary       We provide Java Help online through our website. Browser....    Java Help Center Welcome to Java help
Search data from database - Java Beginners
Search data from database  Hi Deepak, This is not correct code... with two button search and delete. 2:- User input name(with alphabetical... to user name. (means search all field from database and display using
online shopping - Java Beginners
online shopping  Respected Sir, Sir please help me how to handle online shooping and shopping cart by click on image by only using jsp?   Hi friend, For solving the problem visit to : http
native library
native library  how to create native library in java
linear search - Java Beginners
linear search  How do i use a linear search for a 2 dimensional hard... friend, Code to solve the problem : public class LinearSearch { // Search "array" for the specified "key" value public static
Please help with this code
Please help with this code  I need some help getting the Search...) Display the lowest grade"); System.out.println("(5) Search for specific result"); System.out.println("(6) Search for student grade by name
code for timer in java netbeans for online test series countdown timer
code for timer in java netbeans for online test series countdown timer  code for timer in java netbeans for online test series countdown timer
regarding designing of web search engine - Development process
regarding designing of web search engine  we want to design a web search engine in java. so, how to get started with our coding...can i get sample code for web crawlers or similar requirements... help us

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.