/* ***************************************************************************** Copyright 2000 by Erica Andrews (cylikon@hotmail.com). All rights reserved. ./ButchWhipAppeal/ ./IcedPinky/ NO portion of this software may be used in ANY way by anyone other than myself without my express written consent. If it is downloaded for testing, it must be deleted from your system within 24 hours. Any other use constitutes piracy and fraudulent misuse of this software, punishable in a court of law. Copyright 2000 by Erica Andrews. All rights reserved. ***************************************************************************** */ import javax.swing.border.*; import java.net.*; import java.awt.*; import javax.swing.*; import java.awt.event.*; import CorbaSearchEng.*; import java.util.*; import java.io.*; import org.omg.CORBA.*; import org.omg.CosNaming.*; // not used import org.omg.CosNaming.NamingContextPackage.*; // not used public class CorbaSearchGUIClient extends Frame { ClientPanel cp; public CorbaSearchGUIClient() { setTitle("MySQL CorbaSearch"); setBounds(new Rectangle(1,1,721,484)); setSize(710,448); setBackground(new Color(0,0,0)); cp = new ClientPanel(); add(cp); pack(); show(); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { hide(); dispose(); System.exit(0); } public void windowOpened(WindowEvent e) { resize(720,483); } } ); } //end super method public static void main (String args[]) { new GUIClient(); } } // end class GUIClient class ClientPanel extends JPanel { public static Color colors0190[] = { new Color(0,0,0) }; // Instance variables public JLabel jlabel0; public static JButton jbutton0; public JTextField jtextfield0; public JLabel jlabel1; public TextArea textarea1; public ClientPanel() { // Setup GUI this.setBounds(6,5,706,444); this.setSize(new Dimension(706,444)); this.setPreferredSize(new Dimension(1,1)); Border thisBorder0 = new BevelBorder(1); this.setBorder(thisBorder0); this.setName("this"); this.setLocation(new Point(6,5)); this.setMinimumSize(new Dimension(1,1)); this.setToolTipText("MySQL CorbaSearch"); this.setBounds(new Rectangle(6,5,706,444)); this.setForeground(new Color(168,207,255)); this.setBackground(new Color(0,0,0)); this.setLayout(null); jlabel0 = new JLabel(); jlabel0.setPreferredSize(new Dimension(425,75)); jlabel0.setToolTipText("MySQL CorbaSearch"); jlabel0.setBounds(new Rectangle(3,2,699,76)); Border jlabel0Border1 = new EtchedBorder(); Border jlabel0Border0 = new TitledBorder(jlabel0Border1,""); jlabel0.setBorder(jlabel0Border0); jlabel0.setSize(new Dimension(699,76)); jlabel0.setMaximumSize(new Dimension(425,75)); jlabel0.setName("jlabel0"); jlabel0.setForeground(new Color(255,255,255)); jlabel0.setOpaque(true); jlabel0.setFont(new java.awt.Font("serif", 0, 48)); jlabel0.setText("MySQL CorbaSearch"); jlabel0.setBackground(new Color(111,106,115)); jlabel0.setHorizontalAlignment(0); jlabel0.setMinimumSize(new Dimension(425,75)); jlabel0.setLocation(new Point(3,2)); jlabel0.setLayout(null); this.add(jlabel0); jbutton0 = new JButton(); jbutton0.setPreferredSize(new Dimension(67,29)); jbutton0.setToolTipText("Click To Search"); jbutton0.setBounds(new Rectangle(610,89,83,45)); Border jbutton0Border0 = new EtchedBorder(); jbutton0.setBorder(jbutton0Border0); jbutton0.setSize(new Dimension(83,45)); jbutton0.setMaximumSize(new Dimension(67,29)); jbutton0.setName("jbutton0"); jbutton0.setForeground(new Color(197,195,195)); jbutton0.setActionCommand("S"); jbutton0.setFont(new java.awt.Font("dialog", 0, 18)); jbutton0.setText("Search!"); jbutton0.setBackground(new Color(108,106,108)); jbutton0.setMinimumSize(new Dimension(67,29)); jbutton0.setLocation(new Point(610,89)); this.add(jbutton0); // Mouse listener for Button jbutton0.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { CorbaSearch(); } public void mouseEntered(MouseEvent e) { jbutton0.setForeground(new Color(0,235,235)); } public void mouseExited(MouseEvent e) { jbutton0.setForeground(new Color(197,195,195)); } } ); jtextfield0 = new JTextField(); jtextfield0.setPreferredSize(new Dimension(73,36)); jtextfield0.setToolTipText("Type your search term here."); jtextfield0.setBounds(new Rectangle(228,98,347,35)); Border jtextfield0Border0 = new EtchedBorder(); jtextfield0.setBorder(jtextfield0Border0); jtextfield0.setCaretColor(new Color(224,224,226)); jtextfield0.setSize(new Dimension(347,35)); jtextfield0.setName("jtextfield0"); jtextfield0.setForeground(new Color(224,224,226)); jtextfield0.setFont(new java.awt.Font("sansserif.bold", 1, 24)); jtextfield0.setText("VRML"); jtextfield0.setBackground(new Color(72,70,72)); jtextfield0.setMargin(new Insets(0,4,0,4)); jtextfield0.setMinimumSize(new Dimension(4,36)); jtextfield0.setLocation(new Point(228,98)); this.add(jtextfield0); jlabel1 = new JLabel(); jlabel1.setPreferredSize(new Dimension(189,24)); jlabel1.setBounds(new Rectangle(9,99,226,35)); jlabel1.setSize(new Dimension(226,35)); jlabel1.setMaximumSize(new Dimension(189,24)); jlabel1.setName("jlabel1"); jlabel1.setForeground(new Color(183,180,183)); jlabel1.setFont(new java.awt.Font("sansserif.bold", 1, 18)); jlabel1.setText("Enter A Search Term:"); jlabel1.setBackground(new Color(0,0,0)); jlabel1.setHorizontalAlignment(0); jlabel1.setMinimumSize(new Dimension(189,24)); jlabel1.setLocation(new Point(9,99)); jlabel1.setLayout(null); this.add(jlabel1); textarea1 = new TextArea(); textarea1.setSize(new Dimension(690,280)); textarea1.setName("textarea1"); textarea1.setLocation(new Point(7,154)); textarea1.setBounds(new Rectangle(7,154,690,280)); textarea1.setForeground(new Color(183,180,183)); textarea1.setBackground(new Color(79,84,99)); textarea1.setFont(new java.awt.Font("dialog", 0, 14)); this.add(textarea1); } URL getURL(String txtURL) { // return a URL object given the URL try { if (txtURL == null) return new URL("file://"); else return new URL(txtURL); } catch(MalformedURLException mue) { return null; } } public String[][] getIconPathForComponent(Component comp, String methodName) { // return an Icon path(s) for a given Component/Method { String[][] rval = {{null}}; return rval; } } private String getReference(String[][] references, String methodName) { for (int i = 0; i < references.length; i++) if (references[i][0] == methodName) return references[i][1]; return null; } // **** Actual Corba Search method **** public void CorbaSearch() { try { org.omg.CORBA.ORB searchorb = org.omg.CORBA.ORB.init((new String[0]),null); CorbaSearchEng.CorbaSearch search = CorbaSearchEng.CorbaSearchHelper.bind(searchorb,"CorbaSearchEng"); search.setSearchword(jtextfield0.getText()); String query = search.doQuery(); StringTokenizer st = new StringTokenizer(query, "," ,false); textarea1.setText("QUERY RESULTS:\n\n"); while (st.hasMoreElements()) { String trans = st.nextToken().trim(); if (trans.equals("NEW_ROW")) { textarea1.appendText("\n"); } else { textarea1.appendText(trans+" "); } } textarea1.appendText("\nResults: "+search.rowcount()+" Columns: "+search.columncount()); } catch (Throwable e) { textarea1.appendText("\n Problem Occurred: "+e) ;} } // end CorbaSearch method } // end class ClientPanel