If else question.

Hello,
public void register() throws SQLException{
     try {
        databaseConnection();
        PreparedStatement ps = con.prepareStatement("INSERT INTO reservation(ci,co,roomno,numb,roomty,nm,srn,phn,mail,sex)" +
                "VALUES (?,?,?,?,?,?,?,?,?,?)");
                ps.setString(1,ci);
                ps.setString(2, co);
                ps.setInt(3, roomno);
                ps.setString(6, nm);
                ps.setString(5, roomty);
                ps.setString(10, sex);
                ps.setString(8, phn);
                ps.setString(9, mail);
                ps.setString(4, numb);
                ps.setString(7, srn);
                ps.executeUpdate();
                JOptionPane.showMessageDialog(null,"Completed");
    } catch (Exception e) {
        JOptionPane.showMessageDialog(null," PLsss....");
    finally{
                    con.close();
                    stm.close();
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                        
// TODO add your handling code here:
     String ent=jTextField3.getText();
     String out=jTextField4.getText();
     String name=jTextField5.getText();
     String surn=jTextField8.getText();
     String phn=jTextField6.getText();
     String mail=jTextField7.getText();
    if(name.isEmpty() && surn.isEmpty() && phn.isEmpty() && mail.isEmpty() && ent.isEmpty() && out.isEmpty()){
        JOptionPane.showMessageDialog(null,"Fill it..");
      else {
            try {
                register();
                new Check_IN();
            } catch (SQLException ex) {
                Logger.getLogger(Check_IN.class.getName()).log(Level.SEVERE, null, ex);
}Here the fields are empty however register() is done. I use AND as logical operator but it behaves like OR. even one is filled then pass the register(). moreover in register method all fields should me filled otherwise throw message but it is done without any problem.
and at the and of register() I like to back to page with "new Check_IN();" I can t do it either.
how register() is run without complete if condition ?

hibrahimdogru wrote:
Thank you jverd
how about "new Check_In();"
I like to back to page after complete register() why it doens t open the page again?What about Check_In()? We know nothing about that class.
How would we know about why it doesn't "open the page again" based on the code you posted so far?
>
and I was expect error with register(), how the values pass as null in preparedstatement ? why it doens t throw nullpointerexception ?They aren't null, they are such that the isEmpty() method returned true, so it is dealing with the String value "", not null.
Edit: Actually I'm not sure what the values of the variables in that method are, because you also have a scoping issue. One method declares those variables and sets them, and then you're invoking another method without passing them to it. So I guess you have class variables and it is using those instead.
This code is a complete mess.

Similar Messages

  • IF Then Else question in PL/SQL script

    Hi guys, this will be an easy one for most of you. I'm just looking for advice on the most efficient way of doing this. I have 15 fields where I need to check that the value doesn't equal a group of values. For example, NG,NA, NOT KNOWN etc. If the fields are equal to any of these values I want the variable set to null so a blank space is printed out.
    I've started of doing it like:
    IF v_service_request_id IN ('Not Given', 'NG') THEN
    v_service_add_last_name := NULL;
    END IF;
    but I'm just wondering if this is the best way to do it? At this rate, I'm going to have this piece of code in 15 times, once for each variable. Would I be more efficient using case statements or some other function?
    Also, where it says IN ('Not Given', 'NG') this is just an example of the values I'm checking for. In reality there's around 30. Is there any way I could put these values into some sort of stored list and then just say:
    IF v_service_request_id IN (some_stored_list) THEN
    v_service_add_last_name := NULL;
    END IF;
    Thanks everyone, I'd appreciate any help.
    Ian

    Assuming the list of 30 values id the same for all fields, then another alternative would be to create a function in the same package to do the test. Something like:
    CREATE PACKAGE p AS
       PROCEDURE my_main_proc (p_pam1 IN NUMBER, p_pam2 IN VARCHAR2);
    END;
    CREATE PACKAGE BODY p AS
       FUNCTION test_values (p_val IN VARCHAR2) RETURN VARCHAR2 IS
    BEGIN
       IF p_val IN ('Not Given', 'NG', 'NA', 'Unknown') THEN
          RETURN NULL;
       ELSE
          RETURN p_val;
       END IF;
    END;
    PROCEDURE my_main_proc (p_pam1 IN NUMBER, p_pam2 IN VARCHAR2) IS
    << Declare local variables >>
    BEGIN
       << get records >>
       v_service_add_last_name := test_values(v_service_request_id);
       v_other_field := test_values(v_other_id);
    END;
    END;You still need to maintain the list in the function, but only in one place.
    HTH
    John

  • 3 dice random if else questions beginner

    Hi all,
    I have searched my brain, and the internet for help, to no avail, I cannont find any. I am new to Java Programming. Sometimes I do not understand my instructor, he confuses me. I have to write a small program that includes tossing 3 dice. any pair is 100, any 3 of a kind (except 6's) is 200, and toss 3 sixes to get 300. I can get my code to work, but not correctly. I've tried the && and ||(or) when the ||(or) is used, for pairs, 3 of a kinds are paid 100. Is this confusing?
    I guess...
    if ((die1 == die2) && (die2 == die3) && (die1 == die3)) {
    resultTextField.setText("Winner 200!");
    else {
         resultTextField.setText("Try again?");
    This works great. but, when I try other ways say with the ||(or)
    it throws everything off
    I'm stumped, maybe I have logic block or something.
    If any one can help, this would be great.
    I'm sure its easy for someone, after all, I'm at the beginning stages.

    multipost
    http://forum.java.sun.com/thread.jspa?threadID=774839

  • Formula If/Then/Else question

    Hello all,
      I am using the following formula to read one value (valuation price), and if it = 0, then display the value of another field (moving price), if <> 0, then display that field (valuation price). 
    ( 'Valuation Price' == 0 ) * 'Moving Price' + ( 'Valuation Price' <> 0 ) * 'Valuation Price'
    However, only the first part of the evaluation returns a value, ie only the rows that have a valuation price =0.  If I reverse the order, it does the same thing, almost like it won't evaluate the "else" part of the evaluation.
    If anyone see's something obvious I would appreciate your input.  I have read the help file and done some searching but have found nothing relevant.  
    Thanks for any help
    Bill Coombs

    Bill, change your formula to
    ( NODIM('Valuation Price')== 0 ) * NODIM('Moving Price') + ( NODIM('Valuation Price') <> 0 ) * NODIM('Valuation Price')
    Hope this works.
    -KRREDDY

  • Simple if else question

    please help me in this regard. how can i print Helloworld by replacing the <condition> with proper one
    if(<condition>)
         sop("Hello");
    else
         sop("world");

    java will not allow u to do operations inside the
    condition.Yes it will, you just can not do ones that return null, and the overall must be a boolean, i.e.
    int printf( String f ) {
    /// implementation
    if( ( printf( "Hello" )  - 5 ) > 0 )  {
    /// This will never be called.
      printf( "Farts!!" );
    } else {
        printf( "World" );
    }

  • 2 questions, do i have to activate adobe encoder manualy and....

    Howdy peoples.
    Adobe support have been no help but ask for more money for a product i just bout so i thought it would be worth a go asking here.
    question 1:
    I have deployed premier elements across 40 machines with volume licence. this is fine but when ever you go to use a MPEG video the adobe mpg encoder wants you to activate this. now I really don't want to have to do this my self to each system and I REALLY don't want student having to do this them selves. is there a way to do this through the installation process or something else
    question 2:
    Why is it that adobe premiere elements has such a heart attack when ever used on a network with roaming profiles. by default you try and open it up, it try's to create your profile and settings and freezes up. your only option is to open up the application data from a local user and then then paste that in to a network users profile and change the scratch folders to something like C:\student which doesn't totally fix the problem cause it then changes 1 of these to your roaming my documents  and opens and prompts to change this one every time but seems to be usable BUT its my belief that I shouldn't have to script in the creation of these files or put up with extra prompts when creating a project.
    Look foward to any input.
    Regards
    Brendan

    Sorry, Beredan, but this really is an issue for Adobe Support. You're working with issues that go beyond the standard functions of this consumer product.
    Premiere Elements often does not work as designed when deployed across a network -- Unless you've got some special arrangement with Adobe regarding volume licensing and network function.

  • White Screen after Load on Facebook Game(s) on Firefox

    I recently installed Firefox and had previously used IE and Chrome.
    One of the main reason why I discontinue Chrome was due to the problems that arose with multiple tabs
    However White Screen appear on One of the Facebook Games after the game page load.
    Afterward, similar white screen appear on IE/Chrome for this game.
    The game still works on another PC without Firefox and by using another account.
    Yes, I have contacted the aps developer and the connection problem seem to originated from my end.
    The Only New Application I have installed to the PC that no longer works for Candy Wood on Facebook are Mozilla and the Adobe (upgrade) that was installed together. I think plug-in might had been a the problem or with scripts overlapping but I am no tech expert to know a solution.
    Please in detail: Tell me how to get the game working again. If there is a file I should remove.. pin point where it is located.
    Here is a picture on what my white screen looks like and does not belong to me.
    https://support.mozilla.org/en-US/questions/958791?esab=a&as=aaq
    On the Inspect Element: "Use of getPreventDefault() is deprecated. Use defeatPrevented instead"
    I haven't got a clue what this mean or how to fix it. Google has people stating this file might be duplicated coding and need to remove one of them when someone else questioned it but without proper full instruction... I don't know how.

    If all browsers on the same system have the same problem, it could be related to external software. For example, your McAfee security suite may block suspicious content, either in its firewall component or perhaps in parental controls.
    The message you saw in the web console about defaultprevented is not important.
    If you right-click the middle of the page where the game should appear, does the right-click (context) menu have an entry labeled This Frame? If so, try expanding that list and opening that frame in a new tab. Usually this would pull the game frame out of Facebook into its own tab. Does that display?

  • How do i adjust brightness on second monitor

    how do you adjust brightness of the second monitor ?? just upgraded the graphics board to ati radeon 5770 and added a second monitor -

    Never mind - found the answer inside the answer to someone else' question - the USB was not plugged in which provided the nice slider

  • CP5 - W7 - Advanced interactions - where to find information

    Hi there!
    Have you ever wondered where the complete list of variables used by Adobe Captivate 5 is.
    If you do not wonder, please show me where.
    I have a simple question, or maybe not so simple
    A user takes a test with 5 random questions 10 points each
    I want to be able to jump to a specific page or show a specific button if result is above a specific % or if user has completed/passed the test or if is more than a certain points.
    But how, how can I get the result from the quiz.
    Can I get the current result when the user is on question 3 of 5
    (if 81% is what you need to pass the test then if you have 20% fail there is no need to take more questions.)
    Which are all the variables associated with quizzes
    Which other variables can you use
    How can you depending on a if/else question change
    * Visibility of objects such as buttons and so on
    * Path of presentation
    * Motion properties of an effect
         * Speed of an motion
         * Height of an object
    An example of what I want...
    I have a start page with 5 image buttons.
    Each button is a link to a some slides E.G.
    Read about the sun, moon, water, air or earth
    When pressing the moon button I get to some moon pages and on the last one I jump back to the start page
    When viewing the moon pages i presume that captivate logs that, and that I should be able to some how extract that information.
    When back on the start page I want to change the image symbol on the moon button from a moon to a moon with a green check mark. (this chapter is read)
    My questions in short:
    Are these kind of interactions possible?
    Which system variables can one use?
    Is there a easy to understand CP5 tutorial?
    Please fill in with your wishes/knowledge here.
    Best Regards // Daniel

    Thank you!
    I found what I am looking for thanks to you
    Complete list
    (http://pipwerks.com/2010/08/23/complete-list-of-variables-for-adobe-captivate-5/)
    // Daniel

  • Anyone know what this means? warning.cpu.alert.b5 it came through skype

    Anyone know what this means? warning.cpu.alert.b5
    It came as a skype call........very strange.  I can't find anything on google search

    Anyone else questioning this?  the info from Skye is:
    Do not repond to the call or go to any suggested website.
    "This link or website may be "phishing" sites, where it will ask for personal information which they will be using in their personal interest. Furthermore, this link may also contain viruses that could damage your computer. "
    Hope this helps others out there.........

  • Need helo

    This is what I am trying but all in vain.
    public class QuestionFactory {
    private String direction5[] = {"bvdhb","vfsjvb"};
         private String direction6 = "cscsc";
         private String direction7 = "cscscs";
         private String direction8 = "cscscsw";
         public String question1[];
    public QuestionFactory()
         Random r = new Random();
              int randint = 1+ Math.abs(r.nextInt()) % 3;          
              System.out.println("Random1 "+randint);
              String str1;                    
              str1 = direction4[randint-1];               
              //Random number generator to get the random number for direction number 5
              Random r1 = new Random();
              int randint1 = 1+ Math.abs(r1.nextInt()) % 2;          
              System.out.println("***"+randint1);          
              System.out.println("");
              String str2;          
              str2 = direction5[randint1-1];               
              //Creating an array of string to store the direction          
              question1 = {direction1,direction2,direction3,str1,str2,direction6,direction7,direction8};
              System.out.println("");               
    }

    ok line 44 here is      question1[0] = direction1; this line
    and here is my complete code for this class:
    package cis675.virat.tiwari.assignment1;
    import java.util.*;
    import java.io.*;
    import java.io.FileReader.*;
    import javax.swing.*;
    public class QuestionFactory {
         public String direction1 = "Abbreviations:Computer Science has so many abbrev.To win this question, your team must enter the full name for the provided abbreviation.I'll print the abbreviation,then start the timer."; 
         private String direction2 = "Lexicon: To win this LexiCon, your team must agree on the correct definition for a word.Please enter a, b, c, or d, to this multiple-choice question.  I'll print the word and definitions, then start the timer.";
         private String direction3 = "Polygraph: To win this Polygraph your team must agree if a statement is true or false.  I'll display the statement and start the timer.";
         private String direction4[] = {" Charades:To win this question your team must choose one person who can act out the answer just like charades to the rest of the team.  I'll provide a hint for the team.  Then, I'll start the timer after I display the word to the performer"
                                                                ,"Password: To win this question, your team must choose one person who can give single-word verbal queues to describe the answer, but can use no names or gestures.  The communicator can use words related to the object, but cannot say the word or any derivative.  I'll provide a hint for the team.  Then I'll start the timer after I display the word to the performer."
                                                                ,"Sketch: To win this question your team must choose one person who can get you to guess the answer by drawing clues on paper with no talking, letters, or symbols.  (Writing numbers is ok.)  I'll provide a hint for the team.  Then I'll start the timer after I display the word to the artist."};
         private String direction5[] = {"bvdhb","vfsjvb"};
         private String direction6 = "cscsc";
         private String direction7 = "cscscs";
         private String direction8 = "cscscsw";
          String question1[] = {};
        //public TextReader data;
         //Constructor for class Question factory
         public  QuestionFactory()
              //Random number generator to get the random number for direction number 4
              Random r = new Random();
              int randint = 1+ Math.abs(r.nextInt()) % 3;          
              System.out.println("Random1 "+randint);
              String str1;                    
              str1 = direction4[randint-1];               
              //Random number generator to get the random number for direction number 5
              Random r1 = new Random();
              int randint1 = 1+ Math.abs(r1.nextInt()) % 2;          
              System.out.println("***"+randint1);          
              System.out.println("");
              String str2;          
              str2 = direction5[randint1-1];          
              //Creating an array of string to store the direction          
               //question1 = {direction1,direction2,direction3,str1,str2,direction6,direction7,direction8};
              question1[0] = direction1;
              question1[1] = direction2;
              question1[2] = direction3;
              question1[3] = str1;
              question1[4] = str2;
              question1[5] = direction6;
              question1[6] = direction7;
              question1[7] = direction8;     
              System.out.println("directions");
              System.out.println("");               
         //GenerateQuestion() takes the name of the file to read file as parameter
         // and generate the question object and add to Question Linked List
         //Also generates Question Type
         public String[] GenerateQuestion (String data)throws Exception
              FileReader f = new FileReader(data);
              Scanner s = new Scanner(f);
              String[] abc = {};
              Question question;
              //Scanner s = new Scanner(new File(data));
              while((s.hasNext()))
                   //string to store the string question type from the file                
                   String str1 = s.nextLine();                    
                   String temp = str1.substring(0,1);               
                   System.out.println("temp is: "+temp);               
                   //integer converstion of the string
                   int qType = Integer.parseInt(temp);
                   System.out.println("Question Type: "+ qType);               
                   if(qType ==1||qType == 6||qType == 8)
                        question = new Question();
                        System.out.println(""+ question);
                   else if (qType == 2|| qType == 3 || qType == 7)
                        question = new OneCharacterAnswer();
                        System.out.println(""+ question);
                   else
                        question = new TrustedAnswer();
                        System.out.println("5***5"+ question);
                  question.parse(str1);
                  //question.setDirections(question1);
                   // Look at the Question Type and create the correct type of Question               
                   //if(s.hasNextInt())
                        //for(int i;i<s.nextInt() ;i++)
                             //char space = data.charAt(i);
                        //s.nextLine();
                        //int i = 0;                    
                        //System.out.println(s.findInLine(""));                    
                        //char first = data.charAt(5);
              return abc;
         public static void main(String [] args) throws Exception
              QuestionFactory qf1 = new QuestionFactory();
              String questionType = JOptionPane.showInputDialog("Select the Question type(file name)");
              qf1.GenerateQuestion(questionType);          
    }

  • Remote panel image

    Hello all.
    I have LabVIEW 7.1.1, run-time engine7.1.1 and  IMAQ Vision 7.1.
    May I see Image on remote panel?
    Respect
     Aleksandr.

    Thanks You for the answer.
    But I have else question.
    May I do the separate server remote panel that install it to another computer.
    Another computer will be without LV.
    Regards
    Aleksandr
    Message Edited by [email protected] on 05-31-2006 06:57 AM

  • Import image using JS (preferred on document-level)

    Hello,
    I am going to implement a dynamic legend using JavaScript in Adobe Acrobat. The document contains a lot of layers. Every layer has an own legend. The origin idea is to implement the legend so, that it contains the images in a dialog box for the visible layers. I can only hide/show the layers by setting state to false or true (this.getOCGs()[i].state = false;) on document-level.
    Question 1: Can I extract data from layer somehow  for legend establishing? I think no, as we only have these function on layers: getIntent(), setIntent() and  setAction(). Right? Therefore I decided to arrange it so, that all needed icons for every layer are saved in a folder with corresponding names. JavaScript should import the icons and I build the a dialog window with icons of visible Layers and place a text(description for this icon).
    I tried all possibilities of image import described here: http://pubhelper.blogspot.com.au/2012/07/astuces-toolbar-icons-et-javascript.html. I got only one way (Convert the icons as hexadecimal strings). This way isn't good, as it is too much work to create with an other tool a hexadecimal string from a images and place it into a javascript code.
    Unfortunately, I cannot import image using other methods:(. Since the security settings in Adobe are changed after version 7 or so, it is not possible to use functions like app.newDoc, app.openDoc, even app.getPath On document-level. I decided to implement the import on the folder level using trusted functions like this:
    Variant 1:
    var importImg = app.trustedFunction(function() {
        app.beginPriv();
        var myDoc = app.newDoc({
            nWidth: 20,
            nHeight: 20
            var img = myDoc.importIcon("icon", "/icon.png", 0);
            app.endPriv();
        return img;
    var oIcon = importImg();
    NotAllowedError: Security settings prevent access to this property or method.
    App.newDoc:109:Folder-Level:User:acrobat.js
    Variant 2:
    var importImg = app.trustedFunction(function() {
           var appPath = var phPath = app.getPath({
            cCategory: "user",
            cFolder: "javascript"
           try {
                   app.beginPriv();
            var doc = app.openDoc({
                cPath: phPath + "/icon.png",
                bHidden: true
             app.endPriv();
        } catch (e) {
            console.println("Could not open icon file: " + e);
            return;
            var oIcon = util.iconStreamFromIcon(doc.getIcon("icon"));
        return oIcon;
    var oIcon = importImg();
    Error: Could not open icon file: NotAllowedError: Security settings prevent access to this property or method.
    The settings in Preferences->JavaScript-> JavaScript Security are disabled (Enable menu item JS execution privileges, enable global object security policy).
    Question 2: Is it not allowed or should I change some other settings or use the import on any other way?
    I tried all these possibilities with .jpg, .png, .pdf. with different sizes(big images and 20x20 pxls), It doesn't work.
    Could somebody help me, as I spent a lot of time with trying different possibilities. It would be actually better to implement the main goal described above on document level, are there other possibilities to access images, maybe using xml or something else) (Question 3)?
    Thank you and kind regards,
    Alex

    ... After checking: I cannot delete my posts either.
    I can see some sort of button "Actions" at the bottom of my replies, but it seems to be missing from a 'main' post. You may want to ask this in the Forum About Forums: Forum comments

  • Keyboard Input

    http://www.rafb.net/paste/results/D3082433.html
    In that link are all three of my classes (UserInterface.java, CalcEngine.java, and Calculator.java)
    I'm trying to do keyboard input for the numbers, the decimal, all the operations and enter. But the way I have it set up, I can't get any of the methods in the CalcEngine.java to run once a button is pressed. It's hard for me the explain, but if you compile it and try looking at the code, you'll understand what I mean.
    -sachit

    Alright, I'll post the 3 classes here.
    #### UserInterface.java ####
    // Date Started: March 1, 2004
    // Date Finished: March 26, 2004
    // Program Description: A graphical user interface for the calculator.
    //                              No calculation is being done here. This class is
    //                              responsible just for putting up the display on
    //                              screen. It then refers to the "CalcEngine" to do
    //                              all the real work.
    import java.awt.*;
    import java.awt.event.*;
    public class UserInterface implements KeyListener
         private CalcEngine calc;
         Frame panelFrame=new Frame("Non-Scientific Calculator");
         static Label displayLabel;
         static String button="";
         // Method Name: UserInterface()
         // Parameters Passed: None
         //     Data Returned: None
         //     Method Purpose: A user interface for the given calcEngine.
         public UserInterface()
              makeFrame();
              panelFrame.setVisible(true);
         // Method Name: setVisible()
         // Parameters Passed: boolean variable visible
         //     Data Returned: None
         //     Method Purpose: Sets the panalFrame interface visible.
    public void setVisible(boolean visible)
              panelFrame.setVisible(visible);
         // Method Name: makeFrame()
         // Parameters Passed: None
         //     Data Returned: None
         //     Method Purpose: The full display of buttons and labels on the calculator.
         private void makeFrame()
              CalcEngine buttonHandler = new CalcEngine();
              Button[] myButtons=new Button[30];
              String[] labels={"","","BS","CE","C","PI","sin","cos","tan","%","sqrt","7","8","9","/","x�","4","5","6","x","1/x","1","2","3","-","-/+","0",".","=","+"};
              Font titleFont=new Font("Courier", Font.BOLD,20);
              Font buttonFont=new Font("Arial", Font.BOLD,13);
              String display="0";
              displayLabel=new Label(display);
              String info = buttonHandler.getInfo();
              Label infoLabel=new Label(info);
              //Labels all the buttons
              for(int i=0;i<myButtons.length;i++)
                   myButtons=new Button(labels[i]);
              panelFrame.setLayout(new BorderLayout(4,5));
              panelFrame.setBackground(Color.gray);
                   displayLabel.setFont(titleFont);
                   displayLabel.setAlignment(Label.RIGHT);
                   panelFrame.add("North",displayLabel);
              Panel secondPanel=new Panel();
              panelFrame.add("Center",secondPanel);
              secondPanel.setLayout(new GridLayout(6,5,5,2));
              secondPanel.setBackground(Color.gray);
                   for(int i=0; i<myButtons.length; i++)
                        secondPanel.add(myButtons[i]);     
                        myButtons[i].setFont(buttonFont);
                        myButtons[i].addKeyListener(this);
                        myButtons[i].addActionListener(buttonHandler);
                   myButtons[0].setBackground(Color.gray);
                   myButtons[0].hide();
                   myButtons[1].hide();
                   panelFrame.add("South",infoLabel);
              panelFrame.resize(270,250);
              panelFrame.show();
         // Method Name: redisplay()
         // Parameters Passed: None
         //     Data Returned: None
         //     Method Purpose: Updates the display of the current number being inputed.
         //                         Also truncates the decimal if it is ".0".
         public static void redisplay()
              boolean itsInt=false;
              int doubleChecker = (int)CalcEngine.getDisplayValue();
              int intValue=0;
              if(CalcEngine.getDisplayValue() == (float)doubleChecker)
                   intValue=(int)Math.round(CalcEngine.getDisplayValue());
                   itsInt=true;
              if(itsInt)
                   displayLabel.setAlignment(Label.RIGHT);
                   displayLabel.setText("" +intValue);
              else
                   displayLabel.setAlignment(Label.RIGHT);
                   displayLabel.setText("" + CalcEngine.getDisplayValue());
         public void keyTyped(KeyEvent e)
              char keyChar = e.getKeyChar();
              button=""+keyChar;
              CalcEngine calcEng= new CalcEngine();
              if(keyChar == '+')
                   System.out.println("+ PRESSED!");
              else if(keyChar == '-')
                   System.out.println("- PRESSED!");
              else if(keyChar == KeyEvent.VK_SLASH)
                   System.out.println("/ PRESSED!");
              else if(keyChar == '*')
                   System.out.println("x PRESSED!");
              else if(keyChar == KeyEvent.VK_1)
                   System.out.println("1 PRESSED!");
              else if(keyChar == KeyEvent.VK_2)
                   System.out.println("2 PRESSED!");
              else if(keyChar == KeyEvent.VK_3)
                   System.out.println("3 PRESSED!");
              else if(keyChar == KeyEvent.VK_4)
                   System.out.println("4 PRESSED!");
              else if(keyChar == KeyEvent.VK_5)
                   System.out.println("5 PRESSED!");
              else if(keyChar == KeyEvent.VK_6)
                   System.out.println("6 PRESSED!");
              else if(keyChar == KeyEvent.VK_7)
                   System.out.println("7 PRESSED!");
              else if(keyChar == KeyEvent.VK_8)
                   System.out.println("8 PRESSED!");
              else if(keyChar == KeyEvent.VK_9)
                   System.out.println("9 PRESSED!");
              else if(keyChar == KeyEvent.VK_0)
                   System.out.println("0 PRESSED!");
              else if(keyChar == KeyEvent.VK_ENTER || keyChar == KeyEvent.VK_EQUALS)
                   calcEng.equals();
                   System.out.println("= PRESSED!");          
              else if(keyChar == KeyEvent.VK_PERIOD)
                   System.out.println(". PRESSED!");
              /*else
                   /// QUESTION: what do these next two lines do?
                   byte bytes[] = {(byte)keyChar};
                   System.out.println(bytes);
                   //     command = new String(bytes);
         public static String passButton()
              return button;
         public void keyPressed(KeyEvent e)
         public void keyReleased(KeyEvent e)
    #### CalcEngine.java #####
    // Date Started: March 1, 2004
    // Date Finished: March 26, 2004
    // Program Description: Does all the calculations for the calculator.
    import java.awt.event.*;
    import java.awt.*;
    public class CalcEngine implements ActionListener
         final int ARRAY_SIZE=100;
         String []buttonPressed = new String[ARRAY_SIZE];
         String buttonCheck="";
         static String userDisplay="";
         int numberLength=0;
         int currentNumber=0;
         int previousNumber=0;
         int currentElement=0;
         boolean allowDecimal=true;
         boolean cEPressed=false;
         String buttonCheckKey;
         // Method Name: CalcEngine()
         // Parameters Passed: None
         //     Data Returned: None
         //     Method Purpose: Instance of the CalcEngine.
         public CalcEngine()
              buttonCheckKey=UserInterface.passButton();
              buttonCheck=buttonCheckKey;
              System.out.println("ButtonCheckKey " +buttonCheck);
              if(buttonCheck=="=")
                   if(currentElement>=2 && !buttonPressed[currentElement].equals(""))
                        equals();
              else if(buttonCheck.equals("C"))
                   clear();
              else if(buttonCheck.equals("CE"))
                   clearOne();
              else if(buttonCheck.equals("BS"))
                   backSpace();
              else if(buttonCheck.equals("sqrt"))
                   squareRoot();
              else if(buttonCheck.equals("sin") || buttonCheck.equals("cos") || buttonCheck.equals("tan"))
                   trig(buttonCheck);
              else if(buttonCheck.equals("PI"))
                   numPI();
              else if(buttonCheck.equals("1/x"))
                   oneOver();
              else if(buttonCheck.equals("x�"))
                   powerTwo();
              else if(buttonCheck.equals("-/+"))
                   negPos();
              //else if(buttonCheck.equals("."))
              //     decimal(event);
              else if((buttonCheck.equals("+") || buttonCheck.equals("-") || buttonCheck.equals("x") || buttonCheck.equals("/") || buttonCheck.equals("%")) && !buttonPressed[currentElement].equals(""))
                   operations(buttonCheck);
              //else     
              //     allNumbers(event);
              System.out.println("1st: "+buttonPressed[0]+ "\n2nd: " buttonPressed[1] "\n3rd: " buttonPressed[2] "\n4th: " buttonPressed[3] "\n5th: " +buttonPressed[4]);
              System.out.println("6th: "+buttonPressed[5]+ "\n7th: " buttonPressed[6] "\n8th: " buttonPressed[7] "\n9th: " buttonPressed[8]"\n");
         // Method Name: getDisplayValue()
         // Parameters Passed: None
         //     Data Returned: float variable N/A
         //     Method Purpose: Retrived the updated number to display on the calculator
         //                         and passes it as a double.
    public static double getDisplayValue()
              return Double.valueOf(userDisplay).doubleValue();
         // Method Name: actionPerformed()
         // Parameters Passed: ActionEvent variable event
         //     Data Returned: None
         //     Method Purpose: Run the correct method depending on what button is pressed.
         public void actionPerformed(ActionEvent event/*, String button, boolean keyBoard*/)
              //Removes null from buttonPressed array
              for(int i=0; i<buttonPressed.length; i++)
                   if(buttonPressed[i]==null)
                        buttonPressed[i]="";
              numberLength++;
              buttonCheck=event.getActionCommand();     //Gets the button that was pressed
              //Runs the correct method depending on which button is pressed
              if(buttonCheck=="=")
                   if(currentElement>=2 && !buttonPressed[currentElement].equals(""))
                        equals();
              else if(buttonCheck.equals("C"))
                   clear();
              else if(buttonCheck.equals("CE"))
                   clearOne();
              else if(buttonCheck.equals("BS"))
                   backSpace();
              else if(buttonCheck.equals("sqrt"))
                   squareRoot();
              else if(buttonCheck.equals("sin") || buttonCheck.equals("cos") || buttonCheck.equals("tan"))
                   trig(buttonCheck);
              else if(buttonCheck.equals("PI"))
                   numPI();
              else if(buttonCheck.equals("1/x"))
                   oneOver();
              else if(buttonCheck.equals("x�"))
                   powerTwo();
              else if(buttonCheck.equals("-/+"))
                   negPos();
              else if(buttonCheck.equals("."))
                   decimal(event);
              else if((buttonCheck.equals("+") || buttonCheck.equals("-") || buttonCheck.equals("x") || buttonCheck.equals("/") || buttonCheck.equals("%")) && !buttonPressed[currentElement].equals(""))
                   operations(buttonCheck);
              else     
                   allNumbers(event);
              System.out.println("1st: "+buttonPressed[0]+ "\n2nd: " buttonPressed[1] "\n3rd: " buttonPressed[2] "\n4th: " buttonPressed[3] "\n5th: " +buttonPressed[4]);
              System.out.println("6th: "+buttonPressed[5]+ "\n7th: " buttonPressed[6] "\n8th: " buttonPressed[7] "\n9th: " buttonPressed[8]"\n");
         // Method Name: clear()
         // Parameters Passed: None
         //     Data Returned: None
         //     Method Purpose: Is run if the "C" button is pressed. Clears all the numbers
         //                         inputted into the calculator.
         public void clear()
              for(int i=0; i<buttonPressed.length; i++)
                        buttonPressed[i]="";
              userDisplay="0";
              currentElement=0;
              numberLength=0;
              UserInterface.redisplay();
         // Method Name: clearOne()
         // Parameters Passed: None
         //     Data Returned: None
         //     Method Purpose: Is run if the "CE" button is pressed. Deletes the last
         //                         entire number inputted into the calculator. For example,
         //                         if "5x123" was inputted, it would go back to "5x".
         public void clearOne()
              if(currentElement >= 2)
                   buttonPressed[currentElement]="";
                   userDisplay=buttonPressed[currentElement-2];
                   numberLength=0;
                   cEPressed=true;
                   UserInterface.redisplay();
         // Method Name: backSpace()
         // Parameters Passed: None
         //     Data Returned: None
         //     Method Purpose: Is run if the "BS" button is pressed. Deletes the last
         //                         number inputted into the calculator. For example,
         //                         if "5x123" was inputted, it would go back to "5x12".
         public void backSpace()
                   int stringSize=buttonPressed[currentElement].length();
                   buttonPressed[currentElement] = userDisplay.substring(0, userDisplay.length() - 1);
                   userDisplay=buttonPressed[currentElement];
                   UserInterface.redisplay();
         // Method Name: trig()
         // Parameters Passed: String variable buttonCheck
         //     Data Returned: None
         //     Method Purpose: Is run if the "sin", "cos", or "tan" button is pressed.
         //                         Finds the sin, cos or tan of the current number.
         public void trig(String buttonCheck)
              if(buttonCheck.equals("sin"))
                   double sinThisNum=Double.valueOf(buttonPressed[currentElement]).doubleValue();
                   double sinNum=Math.sin(sinThisNum);
                   buttonPressed[currentElement]=""+sinNum;               
              else if(buttonCheck.equals("cos"))
                   double cosThisNum=Double.valueOf(buttonPressed[currentElement]).doubleValue();
                   double cosNum=Math.cos(cosThisNum);
                   buttonPressed[currentElement]=""+cosNum;                              
              else if(buttonCheck.equals("tan"))
                   double tanThisNum=Double.valueOf(buttonPressed[currentElement]).doubleValue();
                   double tanNum=Math.tan(tanThisNum);
                   buttonPressed[currentElement]=""+tanNum;                              
              userDisplay=buttonPressed[currentElement];
              UserInterface.redisplay();
         // Method Name: squareRoot()
         // Parameters Passed: None
         //     Data Returned: None
         //     Method Purpose: Is run if the "sqrt" button is pressed. Sqaures the current
         //                         number.
         public void squareRoot()
              if(currentElement==0 || currentElement % 2==0)
                   double rootThisNum=Double.valueOf(buttonPressed[currentElement]).doubleValue();
                   double rootedNum=Math.sqrt(rootThisNum);
                   buttonPressed[currentElement]=""+rootedNum;
                   userDisplay=buttonPressed[currentElement];
                   UserInterface.redisplay();
         // Method Name: numPI()
         // Parameters Passed: None
         //     Data Returned: None
         //     Method Purpose: Is run if the "PI" button is pressed. Allows the user to
         //                         input the value of PI.
         public void numPI()
              double PInumber=Math.PI;
              buttonPressed[currentElement]=""+PInumber;
              userDisplay=buttonPressed[currentElement];
              UserInterface.redisplay();
         // Method Name: oneOver()
         // Parameters Passed: None
         //     Data Returned: None
         //     Method Purpose: Is run if the "1/x" button is pressed. This will divide
         //                         the current number by 1.
         public void oneOver()
              if(currentElement==0 || currentElement % 2==0)
                   double oneOverNum=Double.valueOf(buttonPressed[currentElement]).doubleValue();
                   oneOverNum=1/oneOverNum;
                   buttonPressed[currentElement]=""+oneOverNum;
                   userDisplay=buttonPressed[currentElement];
                   UserInterface.redisplay();
         // Method Name: powerTwo()
         // Parameters Passed: None
         //     Data Returned: None
         //     Method Purpose: Is run if the "x^2" button is pressed. This will take the
         //                         current number to the power 2.
         public void powerTwo()
              if(currentElement==0 || currentElement % 2==0)
                   double powNum=Double.valueOf(buttonPressed[currentElement]).doubleValue();
                   powNum=Math.pow(powNum,2);
                   buttonPressed[currentElement]=""+powNum;
                   userDisplay=buttonPressed[currentElement];
                   UserInterface.redisplay();
         // Method Name: negPos()
         // Parameters Passed: None
         //     Data Returned: None
         //     Method Purpose: Is run if the "-/+" button is pressed. Toggles the number
         //                         between a negative and positive value.
         public void negPos()
              if(userDisplay.charAt(0)!='-')
                   userDisplay="-"+userDisplay;
              else
                   userDisplay=userDisplay.substring(1);
              buttonPressed[currentElement]=userDisplay;
              UserInterface.redisplay();
         // Method Name: decimal()
         // Parameters Passed: ActionEvent variable event
         //     Data Returned: None
         //     Method Purpose: Is run if the "C" button is pressed. Clears all the numbers
         //                         inputted into the calculator.
         public void decimal(ActionEvent event)
              if(allowDecimal)
                   buttonPressed[currentElement]+=event.getActionCommand();
                   userDisplay+=event.getActionCommand();
                   allowDecimal=false;
                   UserInterface.redisplay();
         // Method Name: operations()
         // Parameters Passed: String variable buttonCheck
         //     Data Returned: None
         //     Method Purpose: Is run if the "+","-","x","/","%" button is pressed. Depending
         //                         on which operation is selected, the calculator will perform that.
         public void operations(String buttonCheck)
              currentElement++;
              if(buttonCheck.equals("+"))
                   buttonPressed[currentElement]="+";
              else if(buttonCheck.equals("-"))
                   buttonPressed[currentElement]="-";
              else if(buttonCheck.equals("x"))
                   buttonPressed[currentElement]="x";
              else if(buttonCheck.equals("/"))
                   buttonPressed[currentElement]="/";
              else if(buttonCheck.equals("%"))
                   buttonPressed[currentElement]="%";
              currentElement++;
              numberLength=0;
              userDisplay="0";
              allowDecimal=true;               
         // Method Name: allNumbers()
         // Parameters Passed: ActionEvent variable event
         //     Data Returned: None
         //     Method Purpose: Is run if any of the numbers are pressed. Adds the inputted
         //                         number to the already ongoing number in the display.
         public void allNumbers(ActionEvent event)
              if(checkInt(event.getActionCommand()))
                   if(cEPressed)
                        buttonPressed[currentElement]+=event.getActionCommand();
                        UserInterface.redisplay();
                        userDisplay=event.getActionCommand();
                        cEPressed=false;                         
                        UserInterface.redisplay();
                   else
                        buttonPressed[currentElement]+=event.getActionCommand();
                        userDisplay+=event.getActionCommand();
                        UserInterface.redisplay();
         // Method Name: checkInt()
         // Parameters Passed: String variable dataInput
         //     Data Returned: None
         //     Method Purpose: A quick check to see if the button pressed is a number.
         //                         Rather than doing if(buttonCheck=="1") for every number.
         public boolean checkInt(String dataInput)
              try
                   int n=Integer.parseInt(dataInput);
                   return true;          
              catch (NumberFormatException nfe)
                   return false;
         // Method Name: equals()
         // Parameters Passed: None
         //     Data Returned: None
         //     Method Purpose: Is run if the "=" button is pressed. Takes all the inputted
         //                         numbers and operations and executes all the calculations.
         public void equals()
              double firstNum=0;
              double secondNum=0;
              double currentAns=0;
              int howBig=0;
              for(int i=0; i<buttonPressed.length;i+=2)
                   if(buttonPressed[i]!="")
                        howBig++;
              firstNum=Double.valueOf(buttonPressed[0]).doubleValue();
              for(int j=0; j<=howBig-1; j+=2)
                   secondNum=Double.valueOf(buttonPressed[j+2]).doubleValue();
                   if(buttonPressed[j+1].equals("+"))
                        currentAns=firstNum+secondNum;
                   else if(buttonPressed[j+1].equals("-"))
                        currentAns=firstNum-secondNum;
                   else if(buttonPressed[j+1].equals("x"))
                        currentAns=firstNum*secondNum;
                   else if(buttonPressed[j+1].equals("/"))
                        currentAns=firstNum/secondNum;
                   else if(buttonPressed[j+1].equals("%"))
                        currentAns=firstNum%secondNum;
                   firstNum=currentAns;     
              for(int i=0; i<buttonPressed.length; i++)
                        buttonPressed[i]="";
              buttonPressed[0]=""+currentAns;
              currentElement=0;
              userDisplay=""+currentAns;
              UserInterface.redisplay();
         // Method Name: getInfo()
         // Parameters Passed: None
         //     Data Returned: String variable N/A
         //     Method Purpose: Return the title of this calculation engine.
         public String getInfo()
              return "ver 0.9 Copyright � 2001-2003 Harish.";
    ### Calculator.java ###
    // Date Started: March 1, 2004
    // Date Finished: March 26, 2004
    // Program Description: The main class of a simple calculator.
    public class Calculator
         private CalcEngine engine;
         private UserInterface gui;
         // Method Name: Calculator()
         // Parameters Passed: None
         //     Data Returned: None
         //     Method Purpose: Creates the calculator and displays it on the screen.
         public Calculator()
              engine = new CalcEngine();
              gui = new UserInterface();
         // Method Name: show()
         // Parameters Passed: None
         //     Data Returned: None
         //     Method Purpose: If the window is closed, it will show it again.
         public void show()
              gui.setVisible(true);
         // Method Name: main()
         // Parameters Passed: String variable []args
         //     Data Returned: None
         //     Method Purpose: The main method that runs the Calculator()
         public static void main(String [] args)
              new Calculator();
    -s64

  • Creative audio, or Integrated aud

    Hi everyone, this is my first post... I hope I'm in the correct place. This is probably going to sound stupid, but I am not too advanced yet, so I hope you go easy on me!:smileyvery-happy:I?have been using my Creative Audigy Soundblaster 2-ZS for three years now, and I love it. The version number is 2.03.29; and my computer is a new Dell Dimension E-50. I have the Dell audio set-up with the sub woofer; sounds great too... I don't know all the different functions of Audigy Soundblaster, but I do use?it as my default for audio, and I use the Creative MediaSource as my video player. I don't have Windows Media Player installed; I want Creative for all my audio and video. Now, the question...
    I have always had a difficult time trying to properly balance the audio with the graphic equalizer. The high treble will sometimes get so high that?it will?distort; like an over-saturation of treble. The low bass seems fine though.... This new Dell is all virgin, so to say... meaning I have not swapped out any components. I don't have the expertise for that anyways... My nephew was here the other day, and I happened to mention the audio / trebel snafu I seem to get. He asked me if I disabled the onboard audio... I said no; I know nothing about that, nor do I know how to do it neither. He went on to say that I might want to disable it... he said I am actually using two different "sound and/or equalizers" here. Can somebody tell me if this is true, please?I wonder if that is why I have so much difficulty in trying to balance out the audio.....
    Probably a stupid question, but I am a bit new. I searched for info and read so many different posts, that I am even more confused. In case it matters, I do not have any yellow "?" in my Device Manager. Nor do I have any troubles with this computer. It is running like a champ (except for video playback, but I better make a different post for that later on). (codec, I think..)So, if anyone could please shed some light for me I would be so appreciati've; and maybe I'd even be able to keep my hair color and not shed too many more grays here.:smileyvery-happy:?I hope I didn't ask a stupid question; apologies if I did, or if I posted in the wrong place. Many thanks!?Tommy

    ALWAYS disable onboard features when you are upgrading to better hardware (like yourself ).
    There are a couple different ways to disable it, each having its own perk.
    . =====Disabling via BIOS=======
    This is the highly prefered method, because as far as Windows or any other software, and in fact all hardware except your motherboard are concerned it makes the old on-board sound stop existing. This means there is 0% chance of it causing a problem. To get into you BIOS you need to press the appropriate key when you computer is first booting up. For my computer the key is Delete, others I have seen as F0, and pretty much any other key could also be assigned. The key you need to press should either be displayed on screen at boot-up or atleast your manual will tell you what it is. Once in you BIOS there is usually a section for "Integrated Peripherals" or the such. Within that category, or where ever else it is found, you can disable the hardware completely (you can turn it back on in this fashion any time as well).
    Note : Reading over your manual for a section on BIOS or "Setup" as some seem to call it might not be a bad idea
    DON'T MESS WITH ANYTHING IN YOUR BIOS EXCEPT THIS IF YOU DON'T KNOW WHAT YOUR DOING!!!!
    2. ======Disabling via Windows======
    Disabling in Windows will stop any programs from accessing the hardware, and in fact to them it has been removed, but it is still recognized as there by your system and could potentially cause problems, even though unlikely. Regardless it is still using system resources though because it was software disabled, not through BIOS (very little resources though). Disabling via Windows is however much safer and easier to find for the average user.
    In Windows XP SP2:
    Start
    Control Panel (Classic View)
    System => Hardware Tab => Device Manager
    Locate the hardware (in your case it would be under "Sounds, Video, and Game Controllers")
    Right Click => Properties
    At the bottom is a drop down menu that you can select enable/disable in.
    You do NOT want to disable...
    Audio Codecs
    Legacy Audio Drivers
    Legacy Video
    Media Control Devices
    Video Codecs
    Anything with "Creative" in it
    or anything else questionable
    If you disable something you did not want disabled, you can always enable it once you realize the mistake .
    I always disable via BIOS myself, it can help speed up your boot-time if you disable pointless things.
    Hope I was of some help Good luck!!!
    BTW, I love my Audigy 2 ZS too
    [edit] Just as a side not, BIOS on a namebrand computer is not as dangerous to play with as a custom built. This is because namebrand systems have most of their settings restricted so the user can't screw it up. lolMessage Edited by sni'ves on -09-200603:38 PM

Maybe you are looking for