Please Help/ GUI Calculator

I'm trying to create a GUI Calculator but cannot get my program to compile. Please could someone assistm, thanks.
import java.io.*;
import java.util.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class CalculatorFrame extends JFrame
     private Container contentPane;
     //The componenets used in the calculator
     private JTextField display;
     private JButton addition;
     private JButton subtract;
     private JButton multiply;
     private JButton divide;
     private JButton mod;
     private JButton enter;
     private JButton [] digits;
     //End of components
     //Integer representations for the arithmetic operations needed
     private final static int ADD = 1;
     private final static int SUB = 2;
     private final static int MUL = 3;
     private final static int DIV = 4;
     private final static int MOD = 5;
     //ENd of arithmethic operations
     //Integer holding the operator that the user requested
     private int op;
     //Boolean variable to help perform the calculations
     private boolean firstFilled;
     private boolean clearScreen;
     //Constructor for the class
     public CalculatorFrame()
     contentPane=new Container();
     this.setSize(400,300); //sets the size of the frame
     this.setTitle("MIS 222 Calculator"); //sets the title of the frame
     //allows the "X" box in the upper right hand corner to close the entire application
     this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     contentPane=this.getContentPane(); //gets the content pane
     //Methods
     addDisplay();
     addDigits();
     addDigitActionListeners();
     addOperation();
private void addDisplay()
     JLabel displayLab = new JLabel("Answer");
     JPanel north = new JPanel();
     north.add(displayLab);
     contentPane.add(north, "North");
//diplay was already declared above the constructor
     display = new JTextField(25);
//adding the components to the panel
     north.add(displayLab);
     north.add(display);
//adding the panel to frame's content pane
     contentPane.add(north, "North");
//Declaring the global digits array
private void addDigits()
     //Add 1 large panel to hold the 3 inner panels
     JPanel digPanel = new JPanel();
     //Set the panel's preferred size so that it will keep everything in line
     digPanel.setPreferredSize(new Dimension(200, 275));
     //Initialize the top 3 digits' JPanel and set its preferrd size
     JPanel topDigits = new JPanel();
     topDigits.setPreferredSize(new Dimension(200,60));
     //Initialize the middle 2 digits' JPanel and set its preferred size
     JPanel midDigits = new JPanel();
     midDigits.setPreferredSize(new Dimension(200,60));
     //Initialize the bottom digits' JPanel and set its preferred size
     JPanel botDigits = new JPanel();
     botDigits.setPreferredSize(new Dimension(200, 75));
     //Initialize the JButton array
     digits = new JButton[11];
     //Initialize each of the top Panel's digit buttons, and add it to the top panel
     for(int i=1; i<4; i++)
          String lab=(new Integer(i)).toString();
          digits=new JButton(lab);
          topDigits.add(digits[i]);
          //Adding the top Digit Panel to the overall digit panel
          digPanel.add(topDigits, BorderLayout.CENTER);
          //Adding the middle Digit Panel to the overall digit panel
          digPanel.add(midDigits, BorderLayout.CENTER);
          //Adding the bottom Digit Panel to the overall digit panel
          digPanel.add(botDigits, BorderLayout.CENTER);
          //Add the overall digit Panel to the Frame's contentpane
          contentPane.add(digPanel, BorderLayout.CENTER);
          //Method created to add the DigitAction Listeners
          addDigitActionListeners();
//Method created to add all of the DigitActionListeners
private void addDigitActionListeners()
          for(int i=0; i<10; i++)
               digits[i].addActionListener(new DigitActionListener(i));
          digits[10].addActionListener(new DigitActionListener("."));
//DigitActionListener class
public class DigitActionListener implements ActionListener
     private String myNum;
     public DigitActionListener(int num)
          myNum=""+num;
     public DigitActionListener(String num)
          myNum=num;
     public void actionPerformed(ActionEvent e)
          if(display.getText().equals("Please enter a valid number")|| clearScreen)
               clearScreen=false;
               display.setText("");
//OperatorActionListener class
public void OpActionListener implements ActionListener
     private int myOpNum;
     public OpActionListener(int op)
          myOpNum=op;
     public void actionPerformed(ActionEvent e)
     {  //Checks to see if the user has already enterd a number
          if(!firstFilled)
          try{
               //Parse the number entered
               String number=display.getText();
               dNum1=Double.parseDouble(number);
               //Sets the flag for the firstFilled to true
               firstFilled=true
               //Sets the op variable so when the "Enter" button is pressed, it will know which operation to perform
               op=myOpNum;
               //Clears the textbox
               display.setText("");
               catch(Exception er)
                    display.setText("Please enter a valid number");
     //This is the second number being entered
          else{
               try{
                    String number=display.getText();
                    String result;
                    dNum2=Double.parseDouble(number);
                    firstFilled=true;
                    op=myOpNum;
                    display.setText("");
               catch(Exception er)
                    display.setText("Please enter a valid number");
private void addOperation()
     JPanel opPanel=new JPanel();
     opPanel.setPreferredSize(new Dimension(75,200));
     JButton clear = new JButton("C");
     JButton addition = new JButton("+");
     JButton subtraction = new JButton("-");
     JButton multiply = new JButton("*");
     JButton divide = new JButton("/");
     JButton mod = new JButton("%");
     JButton enter = new JButton("Enter");
     addition.addActionListener(new OpActionListener(ADD));
     subtraction.addActionListener(new OpActionListener(SUB));
     multiply.addActionListener(new OpActionListener(MUL));
     divide.addActionListener(new OpActionListener(DIV));
     mod.addActionListener(new OpActionListener(MOD));
     clear.addActionListener(new ActionListener()
          public void actionPerformed(ActionEvent e)
               display.setText("");
               firstFilled=false;
     enter.addActionListener(new ActionListener()
          public void actionPerformed(ActionEvent e)
               double result;
               String answer="";
               String number = display.getText();
               dNum2 = Double.parseDouble(number);
               dNum1=Double.parseDouble(number);
               switch(op)
                    case ADD:
                         result = dNum1 + dNum2;
                         break;
                    case SUB:
                         result = dNum1 - dNum2;
                         break;
                    case MUL:
                         result = dNum1 * dNum2;
                         break;
                    case DIV:
                         result = dNum1 / dNum2;
                         break;
                    default:
                         result= -1.0;
                         break;
                    if(result==(int)result)
                         answer=(new Integer((int)result)).toString();
                    else
                         answer=(new Double(result)).toString();
                    display.setText(answer);
                    clearScreen=true;
                    firstFilled=false;
                    dNum1=0;
                    dNum2=0;
          opPanel.add(clear);
          opPanel.add(addition);
          opPanel.add(subtraction);
          opPanel.add(multiply);
          opPanel.add(divide);
          opPanel.add(mod);
          opPanel.add(enter);
          contentPane.add(opPanel, "East");
     //Creating the frame object
     public class CalculatorMain
          public void main(String[] args)
               CalculatorFrame cf=new CalculatorFrame();
               cf.show();
ERRORS THAT I HAVE!!:
javac calculatorframe.javacalculatorframe.java:150: '(' expected
public void OpActionListener implements ActionListener
^
calculatorframe.java:7: class CalculatorFrame is public, should be declared in a file named CalculatorFrame.java
public class CalculatorFrame extends JFrame
^
calculatorframe.java:54: cannot resolve symbol
symbol : method addOperation ()
location: class CalculatorFrame
addOperation();
^
3 errors
>

Hi, actually it's all written there:
>
ERRORS THAT I HAVE!!:
javac calculatorframe.javacalculatorframe.java:150: '(' expected
public void OpActionListener implements
ActionListenerpublic void ... is part of a possible method signature. That's probably why the compiler expects '(' as this is need for a method.
To define a class use:
public class ... (or better: private class ..., if the class is not used outside of this file.
^
calculatorframe.java:7: class CalculatorFrame is
public, should be declared in a file named
CalculatorFrame.java
public class CalculatorFrame extends JFrame
^As it says, you defined a class CalculatorFrame in a file calculatorframe.java. But the file name should be the same as the class name (case sensitive). Java classes should start with capital letters, so rename the file to:
CalculatorFrame.java
calculatorframe.java:54: cannot resolve symbol
symbol : method addOperation ()
location: class CalculatorFrame
addOperation();
^
3 errors
>You didn't declare the method 'addOperation' (-> cannot resolve symbol; which simbol: method addOperation (); where: location: class CalculatorFrame; you see it's all there)
Note there is a method called 'addOperation' in the class OpActionListener, but not in CalculatorFrame.
Note I didn't read the code, just the error messages. I hope this helps.
-Puce

Similar Messages

  • Please Help : GUI component

    My plan is to create a GUI based page-editor(html) for text(bold,italic,underline etc..), images(not creation of image, just insert) and some more basic component with limited functionalities. This contains drag&drop option also.
    Hope Swing will be the best solution for this.
    Can anybody please help by providing any useful information for this. No problem even if the information you have is very basic level.
    Thanks in advance

    Yes swing is a better idea than AWT, build a class for each type of object you want to put on the page(JLabels will be a good solution for text and images).
    If you just want to move the object around the page you don't need to use DAD, implementing mousedrag will do the job.
    Noah

  • Please help in calculating average from random nos. generated

    Actually i am new to LV and i don't understand e'thing pretty well. Can anyone please help me with this problem?
    I have to construct a VI that displays a random no. once every sec., and then in the same VI, i am trying to compute the average of the last four nos. generated, i.e. the average is displayed only after 4 numbers have been generated, else the average displays zero.
    Well, i was trying to  get this, but so far what i have got is a VI that is generating average, but that is not what i need.
    Thanks for any help.
    CL

    Easiest would be to use "Mean PtByPt.vi" in the Analyze...Point by Point palette. It is most flexible, e.g. if you would want to change the averaging length in the future.
    Alternatively, you could use shift registers initialized with NaN. I would prefer NaN over zero for incomplete samples, zero is not unique, it could be a legal value. See attached simple example (LabVIEW 7.1). Modify as needed.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Average4.vi ‏31 KB

  • Please help urgent Calculation at the end of alv report

    Hi ..
    It is necessary to define clearly  col1 first record is 10 col2 first record is 20 ..
    col1 second record is 15 col2  second record is 25 .
    COL3 first value is 10 / 20 .
    col3 second value is 15 / 25 .
    This datas come from internal table .
    When I add at the end for all columns it get wrong calculation or lets say I want to do like total col1 10+ 15 total  col2 is 20+ 25 . Total column3 is would like to be 25 / 45 .
    How can I insert a line which is doing this operation in my alv .

    try this
    first
    DATA : SAT_EVENTS     TYPE SLIS_T_EVENT.
    DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          I_LIST_TYPE = 0
        IMPORTING
          ET_EVENTS   = SAT_EVENTS[].
      READ TABLE SAT_EVENTS WITH KEY NAME =  SLIS_EV_TOP_OF_PAGE
                               INTO LS_EVENT.
      IF SY-SUBRC = 0.
        MOVE 'TOP_OF_PAGE' TO LS_EVENT-FORM.
        APPEND LS_EVENT TO SAT_EVENTS.
      ENDIF.
      READ TABLE SAT_EVENTS WITH KEY NAME =  SLIS_EV_END_OF_LIST
                             INTO LS_EVENT.
      IF SY-SUBRC = 0.
        MOVE 'END_OF_LIST' TO LS_EVENT-FORM.
        APPEND LS_EVENT TO SAT_EVENTS.
      ENDIF.
    form for end of list
    FORM END_OF_LIST.
      DATA: P_HEADER TYPE SLIS_T_LISTHEADER,
            PA_HEADER TYPE SLIS_LISTHEADER.
      DATA: INFO(100).
    info = <your calculated value for col3>
    PA_HEADER-TYP = 'S'.
    PA_HEADER-INFO = INFO.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
        IT_LIST_COMMENTARY       = P_HEADER
      I_LOGO                   =
         I_END_OF_LIST_GRID       = 'X'
    ENDFORM.                    "END-OF-LIST
    in REUSE_ALV_GRID_DISPLAY pass
    IT_EVENTS =  SAT_EVENTS[]
    hope this will work
    regards
    Shiba dutta
    Message was edited by:
            SHIBA DUTTA

  • Help please- GUI calculator

    I am trying to create a GUI calculator which:
    -must use the JOptionPane class to create dialog boxes for user input and
    output.
    -If the user attempts to divide by 0, you must print a message to that effect (e.g.,
    "division by 0 not allowed").
    -If the user enters an invalid operator, you must print a message to that effect
    (e.g., "operation not supported").
    My Program will not work, and any help would be greatly appreciated!
    import javax.swing.JOptionPane;
    public class GUI {
         String numberString =
              JOptionPane.showInputDialog("Welcome to my GUI Calculator!\n The following operations are supported:\n +(addition), -(subtraction), *(multiplication)\n /(division),and ^(exponent)\n\n Enter your calculation separated by spaces and press OK.\n Example:2.5 + 3");
         int firstSpace =
         numberString.indexOf(" ");
         double answer;
         double
         operand1 = Double.parseDouble(numberString.substring(0,firstSpace));
         double
         operand2 = Double.parseDouble(numberString.substring(firstSpace+3,numberString.length()));
         char
         operator = numberString.charAt(firstSpace+1);
         while (operator == "+")
              answer = operand1 + operand2;
         while (operator == "-")
              answer = operand1 - operand2;
         while (operator == "*")
              answer = operand1 * operand2;
         while (operator == "/")
         { if (operand2 == 0)
              JOptionPane.showInputDialog("Division by 0 not allowed!");
              else
              answer = operand1 / operand2;
         while (operator == "^")
              answer = Math.pow(operand1, operand2);
    while (operator != "+, -, *, /, ^")
         JOptionPane.showInputDialog("Operation not supported.");
    JOptionPane.showMessageDialog("numberString = answer");
    System.exit(0);
    }

    When you post code, please wrap it in [code] [/code] tags so it's easy to read.
    You're confusing strings with characters. You read the operator as a character. But when you check it, you compare it with Strings (you can tell they're Strings because you're using double quotes). You should be using single quotes there.
    Your code makes a lot of assumptions about the format of the data it's given, for example the number of spaces and where they'll appear.
    And this part:while (operator != "+, -, *, /, ^") There's absolutely no reason why that would work. Where did you get the idea that was a thing to do? If you want to see if the operator is in a list of characters, there are a variety of things you can do, but probably the simplest is just to have five if/else statements. You're going to need those anyway when you do the math operation; when you get to the last one, just put an else statement saying that you don't recognize the operator.

  • Please help with the GUI quiz question!

    Hi Folks,
    Please help me with the code for the following GUI.
    The display window of the application should have two panels at the top level (you could have multiple panels contained within a top-level panel). The first top level panel should have a grid or a border layout and should include apart from various label objects: 1) a textfield to store the info entered, 2) a combobox 3) a combobox or a list box , 4) a radio-button group , 5) a combo box 6) checkboxes for additional accessories, and 7) checkboxes .
    The second top-level panel that is placed at the bottom of the window should have a submit button, a clear button and a textarea for output.
    Thanks a lot.

    Please be a little more explicit about what you're doing, what you expect to happen, and what you actually observe.
    Please post a short, concise, executable example of what you're trying to do. This does not have to be the actual code you are using. Write a small example that demonstrates your intent, and only that. Wrap the code in a class and give it a main method that runs it - if we can just copy and paste the code into a text file, compile it and run it without any changes, then we can be sure that we haven't made incorrect assumptions about how you are using it.
    Post your code between [code] and [/code] tags. Cut and paste the code, rather than re-typing it (re-typing often introduces subtle errors that make your problem difficult to troubleshoot). Please preview your post when posting code.
    Please assume that we only have the core API. We have no idea what SomeCustomClass is, and neither does our collective compiler.
    If you have an error message, post the exact, complete error along with a full stack trace, if possible. Make sure you're not swallowing any Exceptions.
    Help us help you solve your problem.

  • How ix_sel is calculated? Jonathan Lewis please help

    There is table TETRO, partitioned by column BSTATE, and subpartitioned by column C (not present below).
    Also there is query:
    SELECT *
      FROM TETRO T
    WHERE T.BOST = 'BB810'
       and BSTATE = 'CLOSED'And there is global index IDX_1 on columns BOST, BSTATE.
    The questions are following:
    1. How in this case calculated ix_sel for the index above?
    2. How calculated cardinality of index?
    I think it is really one question.
    Thie is excerpt from 10053:
    QUERY BLOCK TEXT
    SELECT *
      FROM TETRO T
    WHERE T.BOST = 'BB810'
       and BSTATE = 'CLOSED'
    QUERY BLOCK SIGNATURE
    qb name was generated
    signature (optimizer): qb_name=SEL$1 nbfros=1 flg=0
      fro(0): flg=0 objn=789900 hint_alias="T"@"SEL$1"
    SYSTEM STATISTICS INFORMATION
      Using WORKLOAD Stats
      CPUSPEED: 1033 millions instructions/sec
      SREADTIM: 0 milliseconds
      MREADTIM: 1 millisecons
      MBRC: 12.000000 blocks
      MAXTHR: -1 bytes/sec
      SLAVETHR: -1 bytes/sec
    BASE STATISTICAL INFORMATION
    Table Stats::
      Table: TETRO  Alias:  T  Partition [7]
        #Rows: 5689355  #Blks:  490747  AvgRowLen:  267.00
        #Rows: 5689355  #Blks:  490747  AvgRowLen:  267.00
    Index Stats::
      Index: IDX_1  Col#: 7 9
        LVLS: 3  #LB: 337246  #DK: 453  LB/K: 744.00  DB/K: 36878.00  CLUF: 16705760.00
      Index: IDX_2  Col#: 7  PARTITION [7]
        LVLS: 2  #LB: 28106  #DK: 2  LB/K: 14053.00  DB/K: 392101.00  CLUF: 784203.00
        LVLS: 2  #LB: 28106  #DK: 2  LB/K: 14053.00  DB/K: 392101.00  CLUF: 784203.00
    SINGLE TABLE ACCESS PATH
      BEGIN Single Table Cardinality Estimation
      Column (#7): BOST(VARCHAR2)  Part#: 7
        AvgLen: 7.00 NDV: 16 Nulls: 0 Density: 0.0625
      Column (#7): BOST(VARCHAR2)
        AvgLen: 7.00 NDV: 16 Nulls: 0 Density: 0.0625
      Column (#9): BSTATE(VARCHAR2)  Part#: 7
        AvgLen: 6.00 NDV: 1 Nulls: 0 Density: 1
      Column (#9): BSTATE(VARCHAR2)
        AvgLen: 6.00 NDV: 1 Nulls: 0 Density: 1
      Table: TETRO  Alias: T    
        Card: Original: 5689355  Rounded: 355585  Computed: 355584.69  Non Adjusted: 355584.69
      END   Single Table Cardinality Estimation
      Access Path: TableScan
        Cost:  142335.78  Resp: 142335.78  Degree: 0
          Cost_io: 122064.00  Cost_cpu: 5486476442
          Resp_io: 122064.00  Resp_cpu: 5486476442
    kkofmx: index filter:"T"."BSTATE"='CLOSED'
    kkofmx: index filter:"T"."BSTATE"='CLOSED'
    kkofmx: index filter:"T"."BOST"='BB810' AND "T"."BSTATE"='CLOSED'
    kkofmx: index filter:"T"."BOST"='BB810' AND "T"."BSTATE"='CLOSED'
    kkofmx: index filter:"T"."BSTATE"='CLOSED'
      Access Path: index (AllEqRange)
        Index: IDX_1
        resc_io: 37627.00  resc_cpu: 351652199
        ix_sel: 0.0022075  ix_sel_with_filters: 0.0022075
        Cost: 38926.31  Resp: 38926.31  Degree: 1
      Access Path: index (AllEqRange)
        Index: IDX_2
        resc_io: 50772.00  resc_cpu: 980748811
        ix_sel: 0.0625  ix_sel_with_filters: 0.0625
        Cost: 54395.73  Resp: 54395.73  Degree: 1
      ****** trying bitmap/domain indexes ******
      ****** finished trying bitmap/domain indexes ******
      Best:: AccessPath: IndexRange  Index: IDX_1
             Cost: 38926.31  Degree: 1  Resp: 38926.31  Card: 355584.69  Bytes: 0
    OPTIMIZER STATISTICS AND COMPUTATIONS
    GENERAL PLANS
    Considering cardinality-based initial join order.
    Permutations for Starting Table :0
    Join order[1]:  TETRO[T]#0
    Best so far: Table#: 0  cost: 38926.3068  card: 355584.6875  bytes: 94941195
    (newjo-stop-1) k:0, spcnt:0, perm:1, maxperm:80000
    Number of join permutations tried: 1
    Final - First Rows Plan:  Best join order: 1
      Cost: 38926.3068  Degree: 1  Card: 355585.0000  Bytes: 94941195
      Resc: 38926.3068  Resc_io: 37627.0000  Resc_cpu: 351652199
      Resp: 38926.3068  Resp_io: 37627.0000  Resc_cpu: 351652199
    kkoipt: Query block SEL$1 (#0)
    Current SQL statement for this session:
    explain plan for
    SELECT *
      FROM TETRO T
    WHERE T.BOST = 'BB810'
       and BSTATE = 'CLOSED'
    ============
    Plan Table
    ============
    ------------------------------------------------------+-----------------------------------+---------------+
    | Id  | Operation                           | Name    | Rows  | Bytes | Cost  | Time      | Pstart| Pstop |
    ------------------------------------------------------+-----------------------------------+---------------+
    | 0   | SELECT STATEMENT                    |         |       |       |   38K |           |       |       |
    | 1   |  TABLE ACCESS BY GLOBAL INDEX ROWID | TETRO   |  347K |   91M |   38K |  00:00:11 | ROW LOCATION| ROW LOCATION|
    | 2   |   INDEX RANGE SCAN                  | IDX_1   |   12K |       |   828 |  00:00:01 |       |       |
    ------------------------------------------------------+-----------------------------------+---------------+
    Predicate Information:
    2 - access("T"."BOST"='BB810' AND "BSTATE"='CLOSED')
    I expected that ix_sel will equal density(BOST in parition 7) * density(BSTATE in parition 7) = 0.0625
    And cardinality of index scan = ix_sal * num_rows(in parition 7) = 355K.
    And I see this calculations in section Table
      Table: TETRO  Alias: T    
        Card: Original: 5689355  Rounded: 355585  Computed: 355584.69  Non Adjusted: 355584.69But why ix_sel(IDX_1) = 0.0022075 (instaed of 0.0625)?
    And cardinality of index range scan is 12K instead of 355K ?

    Fathers, please help to understand following piece (10053 on the bottom of the page).
    This similar case as above. The same tables and predicates.
    But local index is used (forced by a hint).
    select --+ index(t TETROBOSTMANAGEDBYCLOSEDSTATES)
      from TETRO t
    where BSTATE = 'CLOSED'
       and BOST = 'BS277'Please notice, I force partition pruning using predicate BSTATE = 'CLOSED'.
    And number of subpartitions is 13.
    This index consists columns BOST(just a column), C (subpartition key), C1 (just a column)
    So, in this case ix_sel and cardinality same as I expected to see w/o histograms.
      Access Path: index (RangeScan)
        Index: TETROBOSTMANAGEDBYCLOSEDSTATES
        resc_io: 269487.00  resc_cpu: 1987916858
        ix_sel: 0.0625  ix_sel_with_filters: 0.0625
        Cost: 276832.08  Resp: 276832.08  Degree: 1
      Best:: AccessPath: IndexRange  Index: TETROBOSTMANAGEDBYCLOSEDSTATES
             Cost: 276832.08  Degree: 1  Resp: 276832.08  Card: 355584.69  Bytes: 0But why final execution plan has another cardinality of index scan (31K)?
    ============
    Plan Table
    ============
    -----------------------------------------------------------------------------+-----------------------------------+---------------+
    | Id  | Operation                            | Name                          | Rows  | Bytes | Cost  | Time      | Pstart| Pstop |
    -----------------------------------------------------------------------------+-----------------------------------+---------------+
    | 0   | SELECT STATEMENT                     |                               |       |       |  270K |           |       |       |
    | 1   |  PARTITION RANGE SINGLE              |                               |  347K |   91M |  270K |  00:01:13 | 8     | 8     |
    | 2   |   PARTITION LIST ALL                 |                               |  347K |   91M |  270K |  00:01:13 | 1     | 27    |
    | 3   |    TABLE ACCESS BY LOCAL INDEX ROWID | TETRO                         |  347K |   91M |  270K |  00:01:13 | 190   | 216   |
    | 4   |     INDEX RANGE SCAN                 | TETROBOSTMANAGEDBYCLOSEDSTATES|   31K |       |  5844 |  00:00:02 | 190   | 216   |
    -----------------------------------------------------------------------------+-----------------------------------+---------------+
    Predicate Information:
    3 - filter("BSTATE"='CLOSED')
    4 - access("BOST"='BS277')
    QUERY BLOCK TEXT
    select --+ index(t TETROBOSTMANAGEDBYCLOSEDSTATES)
    * from TETRO t where BSTATE = 'CLOSED' and BOST = 'BS277'
    BASE STATISTICAL INFORMATION
    Table Stats::
      Table: TETRO  Alias:  T  Partition [7]
        #Rows: 5689355  #Blks:  490747  AvgRowLen:  267.00
        #Rows: 5689355  #Blks:  490747  AvgRowLen:  267.00
    Index Stats::
      Index: TETROBOSTMANAGEDBYCLOSEDSTATES  Col#: 7 11 25  PARTITION [7]
        LVLS: 3  #LB: 87376  #DK: 3679167  LB/K: 1.00  DB/K: 1.00  CLUF: 4224354.00
        LVLS: 3  #LB: 87376  #DK: 3679167  LB/K: 1.00  DB/K: 1.00  CLUF: 4224354.00
        User hint to use this index
    SINGLE TABLE ACCESS PATH
      BEGIN Single Table Cardinality Estimation
      Column (#9): BSTATE(VARCHAR2)  Part#: 7
        AvgLen: 6.00 NDV: 1 Nulls: 0 Density: 1
      Column (#9): BSTATE(VARCHAR2)
        AvgLen: 6.00 NDV: 1 Nulls: 0 Density: 1
      Column (#7): BOST(VARCHAR2)  Part#: 7
        AvgLen: 7.00 NDV: 16 Nulls: 0 Density: 0.0625
      Column (#7): BOST(VARCHAR2)
        AvgLen: 7.00 NDV: 16 Nulls: 0 Density: 0.0625
      Table: TETRO  Alias: T    
        Card: Original: 5689355  Rounded: 355585  Computed: 355584.69  Non Adjusted: 355584.69
      END   Single Table Cardinality Estimation
      Access Path: index (RangeScan)
        Index: TETROBOSTMANAGEDBYCLOSEDSTATES
        resc_io: 269487.00  resc_cpu: 1987916858
        ix_sel: 0.0625  ix_sel_with_filters: 0.0625
        Cost: 276832.08  Resp: 276832.08  Degree: 1
      Best:: AccessPath: IndexRange  Index: TETROBOSTMANAGEDBYCLOSEDSTATES
             Cost: 276832.08  Degree: 1  Resp: 276832.08  Card: 355584.69  Bytes: 0
    OPTIMIZER STATISTICS AND COMPUTATIONS
    GENERAL PLANS
    Considering cardinality-based initial join order.
    Permutations for Starting Table :0
    Join order[1]:  TETRO[T]#0
    Best so far: Table#: 0  cost: 276832.0812  card: 355584.6875  bytes: 94941195
    (newjo-stop-1) k:0, spcnt:0, perm:1, maxperm:80000
    ============
    Plan Table
    ============
    -----------------------------------------------------------------------------+-----------------------------------+---------------+
    | Id  | Operation                            | Name                          | Rows  | Bytes | Cost  | Time      | Pstart| Pstop |
    -----------------------------------------------------------------------------+-----------------------------------+---------------+
    | 0   | SELECT STATEMENT                     |                               |       |       |  270K |           |       |       |
    | 1   |  PARTITION RANGE SINGLE              |                               |  347K |   91M |  270K |  00:01:13 | 8     | 8     |
    | 2   |   PARTITION LIST ALL                 |                               |  347K |   91M |  270K |  00:01:13 | 1     | 27    |
    | 3   |    TABLE ACCESS BY LOCAL INDEX ROWID | TETRO                         |  347K |   91M |  270K |  00:01:13 | 190   | 216   |
    | 4   |     INDEX RANGE SCAN                 | TETROBOSTMANAGEDBYCLOSEDSTATES|   31K |       |  5844 |  00:00:02 | 190   | 216   |
    -----------------------------------------------------------------------------+-----------------------------------+---------------+
    Predicate Information:
    3 - filter("BSTATE"='CLOSED')
    4 - access("BOST"='BS277')

  • Please help me with this calculation script

    Hello everyone.
    I have 2 fields named A and B. FieldA is user-enter value and FieldB is calculated. I want to write a script that do the following:
    If FieldA is more than or equal to $10000, then FieldB always is $1000, Else FieldB = FieldA * 10%.
    I don't know about scripting; however, after hour of search through google, I wrote this one:
    var tvar
    If (tvar >= 10000)then deposit.value = 1000
    else deposit.value = total.rawValue*0.01
    endif
    And when I try to run, it say "Invalid Property Set Operation, value doesn't have a default property."
    I know my script is bad and over the place. Can anyone please help me with this problem ASAP. Thank you so much, I'm in your debt.
    I used Adobe LiveCycle Designer to create a PDF file.

    Thank you for your response.
    tvar = total
    At first I wrote it like this:
    If (total.rawValue >= 10000)then deposit.rawvalue = 1000
    else deposit.rawvalue = total.rawValue*0.01
    endif
    then I get an error message "accessor 'Total.rawValue' is unknown"
    Hic, I think my script is screwed. Can you help me start fresh :)
    Thank again.

  • Hello I have a problem in calculating the apple id Can you help me please   I forgot answer security questions for your account How can knowledge Please help Please reply as soon as possible   I can not buy from camels Store And the rest of the account ba

    Hello
    I have a problem in calculating the apple id Can you help me please
    I forgot answer security questions for your account How can knowledge
    Please help
    Please reply as soon as possible
    I can not buy from camels Store
    And the rest of the account balance  $25
    Message was edited by: lingo azam

    I think you mean App Store.
    Rescue email address and how to reset Apple ID security questions

  • Please help: password protected GUI

    hi
    can any one help me GUI of application to be password protected. in the attachment graph whould be visible all the time but when i enter 1 password filtered signal and its corresponding parameters are visible (now graph and filtered signal waveform and its parameter are visible) and when i enter 2nd password all things must be visible.
    please help
    Attachments:
    1.vi ‏80 KB

    smercurio_fc, see now you are following me around.... (Beat you by a few minutes on the other tread).
    I think the question is not about passwording the diagram, but a UI choice where certain parts are only shown after entering a password. For example, there might be data for the operator and there might be extra data or controls only of interest to the engineer. The display should change depending on the  privileges of the current user.
    Message Edited by altenbach on 05-17-2007 01:33 PM
    LabVIEW Champion . Do more with less code and in less time .

  • Please Help - Need Help with Buttons for GUI for assignment. URGENT!!

    Can someone please help me with the buttons on this program? I cannot figure out how to get them to work.
    Thanks!!!
    import java.awt.*;
    import java.awt.event.*;
    import java.text.NumberFormat;
    import javax.swing.*;
    import javax.swing.JButton;
    public class InventoryTAH implements ActionListener
        Maker[] proMaker;
        JTextField[] fields;
        NumberFormat nf;
        public void actionPerformed(ActionEvent e)
            int index = ((JComboBox)e.getSource()).getSelectedIndex();
            populateFields(index);
        public static void main(String[] args)
            try
                UIManager.setLookAndFeel(
                        "com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
            catch (Exception e)
                System.err.println(e.getClass().getName() + ": " + e.getMessage());
            InventoryTAH test = new InventoryTAH();
            test.initMakers();
            test.showGUI();
            test.populateFields(0);
        private void initMakers() {
            proMaker = new Maker[10];
            proMaker[0] = new Maker( 1, "Pens",1.59,100,"Bic");
            proMaker[1] = new Maker( 2, "Pencils", .65, 100,"Mead");
            proMaker[2] = new Maker( 3, "Markers", 1.29, 100,"Sharpie");
            proMaker[3] = new Maker( 4, "Paperclips", 1.19, 100,"Staples");
            proMaker[4] = new Maker( 5, "Glue", .85, 100,"Elmer's");
            proMaker[5] = new Maker( 6, "Tape", .50, 100,"3m");
            proMaker[6] = new Maker( 7, "Paper", 1.85, 100,"Mead");
            proMaker[7] = new Maker( 8, "Stapler", 2.21, 100,"Swingline");
            proMaker[8] = new Maker( 9, "Folders", .50, 100,"Mead");
            proMaker[9] = new Maker( 10, "Rulers", .27, 100,"Stanley");      
          int maxNum = 10;
          int currentNum = 0;
          int currentInv = 0;
             Action firstAction = new AbstractAction("First")
              public void actionPerformed(ActionEvent evt)
                   currentInv = 0;
                   int populateFields;
          JButton firstButton = new JButton(firstAction);
          Action previousAction = new AbstractAction("Previous")
              public void actionPerformed(ActionEvent evt)
                   currentInv--;
                   if (currentInv < 0)
                        currentInv = maxNum - 1;
                   int populateFields;
          JButton previousButton = new JButton(previousAction);
          Action nextAction  = new AbstractAction("Next")
              public void actionPerformed(ActionEvent evt)
                   currentInv++;
                   if (currentInv >= currentNum)
                        currentInv = 0;
                  int populateFields;
          JButton nextButton = new JButton(nextAction);
          Action lastAction = new AbstractAction("Last")
              public void actionPerformed(ActionEvent evt)
                   currentInv = currentNum - 1;
                   int populateFields;
          JButton lastButton = new JButton(lastAction);
              JPanel buttonPanel = new JPanel( );
        private void showGUI() {
            JLabel l;
            JButton button1;
                JButton button2;
            fields = new JTextField[8];
            JFrame f = new JFrame("Inventory");
            Container cp = f.getContentPane();
            cp.setLayout(new GridBagLayout());
            cp.setBackground(UIManager.getColor(Color.BLACK));
            GridBagConstraints c = new GridBagConstraints();
            c.gridx = 0;
            c.gridy = GridBagConstraints.RELATIVE;
            c.gridwidth = 1;
            c.gridheight = 1;
            c.insets = new Insets(2, 2, 2, 2);
            c.anchor = GridBagConstraints.EAST;
            cp.add(l = new JLabel("Item Number:", SwingConstants.CENTER), c);
            l.setDisplayedMnemonic('a');
            cp.add(l = new JLabel("Item Name:", SwingConstants.CENTER), c);
            l.setDisplayedMnemonic('b');
            cp.add(l = new JLabel("Number of Units in Stock:", SwingConstants.CENTER), c);
            l.setDisplayedMnemonic('c');
            cp.add(l = new JLabel("Price per Unit: $", SwingConstants.CENTER), c);
            l.setDisplayedMnemonic('d');
            cp.add(l = new JLabel("Total cost of Item: $", SwingConstants.CENTER), c);
            l.setDisplayedMnemonic('e');
            cp.add(l = new JLabel("Total Value of Merchandise in Inventory: $", SwingConstants.CENTER), c);
            l.setDisplayedMnemonic('f');
            cp.add(l = new JLabel("Manufacturer:", SwingConstants.CENTER), c);
            l.setDisplayedMnemonic('g');
            cp.add(l = new JLabel("Restocking Fee: $", SwingConstants.CENTER), c);
            l.setDisplayedMnemonic('h');
                c.gridx = 1;
            c.gridy = 0;
            c.weightx = 1.0;
            c.fill = GridBagConstraints.HORIZONTAL;
            c.anchor = GridBagConstraints.CENTER;
            cp.add(fields[0] = new JTextField(), c);
            fields[0].setFocusAccelerator('a');
            c.gridx = 1;
            c.gridy = GridBagConstraints.RELATIVE;
            cp.add(fields[1] = new JTextField(), c);
            fields[1].setFocusAccelerator('b');
            cp.add(fields[2] = new JTextField(), c);
            fields[2].setFocusAccelerator('c');
            cp.add(fields[3] = new JTextField(), c);
            fields[3].setFocusAccelerator('d');
            cp.add(fields[4] = new JTextField(), c);
            fields[4].setFocusAccelerator('e');
            cp.add(fields[5] = new JTextField(), c);
            fields[5].setFocusAccelerator('f');
            cp.add(fields[6] = new JTextField(), c);
            fields[6].setFocusAccelerator('g');
            cp.add(fields[7] = new JTextField(), c);
            fields[7].setFocusAccelerator('h');
            c.weightx = 0.0;
            c.fill = GridBagConstraints.NONE;
              cp.add(firstButton);
              cp.add(previousButton);
              cp.add(nextButton);
              cp.add(lastButton);
                          JComboBox combo = new JComboBox();
            for(int j = 0; j < proMaker.length; j++)
                combo.addItem(proMaker[j].getName());
            combo.addActionListener(this);
                cp.add(combo);
                cp.add(button1 = new JButton("   "), c);
            f.pack();
            f.addWindowListener(new WindowAdapter()
                public void windowClosing(WindowEvent evt)
                    System.exit(0);
            f.setVisible(true);
      private void populateFields(int index) {
            Maker maker = proMaker[index];
            fields[0].setText(Long.toString(maker.getNumberCode()));
            fields[1].setText(maker.getName());
            fields[2].setText(Long.toString(maker.getUnits()));
            fields[3].setText(Double.toString(maker.getPrice()));
            fields[4].setText(Double.toString(maker.getSum()));
            fields[5].setText(Double.toString(maker.totalAllInventory(proMaker)));
            fields[6].setText(maker.getManufact());
            fields[7].setText(Double.toString(maker.getSum()*.05));       
    class Maker {
        int itemNumber;
        String name;
        int units;
        double price;
        String manufacturer;
        public Maker(int n, String name, double price, int units, String manufac) {
            itemNumber = n;
            this.name = name;
            this.price = price;
            this.units = units;
            manufacturer = manufac;
        public int getNumberCode() { return itemNumber; }
        public String getName() { return name; }
        public int getUnits() { return units; }
        public double getPrice() { return price; }
        public double getSum() { return units*price; }
        public String getManufact() { return manufacturer; }
        public double totalAllInventory(Maker[] makers) {
            double total = 0;
            for(int j = 0; j < makers.length; j++)
                total += makers[j].getSum();
            return total;
    }}

    // I have made some modifications. Please try this.
    import java.awt.*;
    import java.awt.event.*;
    import java.text.NumberFormat;
    import javax.swing.*;
    import javax.swing.JButton;
    public class InventoryTAH implements ActionListener
    Maker[] proMaker;
    JTextField[] fields;
    NumberFormat nf;
    int currentInv = 0;
    public void actionPerformed(ActionEvent e)
    currentInv= ((JComboBox)e.getSource()).getSelectedIndex();
    populateFields(currentInv);
    public static void main(String[] args)
    try
    UIManager.setLookAndFeel(
    "com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
    catch (Exception e)
    System.err.println(e.getClass().getName() + ": " + e.getMessage());
    InventoryTAH test = new InventoryTAH();
    test.initMakers();
    test.showGUI();
    test.populateFields(0);
    private void initMakers() {
    proMaker = new Maker[10];
    proMaker[0] = new Maker( 1, "Pens",1.59,100,"Bic");
    proMaker[1] = new Maker( 2, "Pencils", .65, 100,"Mead");
    proMaker[2] = new Maker( 3, "Markers", 1.29, 100,"Sharpie");
    proMaker[3] = new Maker( 4, "Paperclips", 1.19, 100,"Staples");
    proMaker[4] = new Maker( 5, "Glue", .85, 100,"Elmer's");
    proMaker[5] = new Maker( 6, "Tape", .50, 100,"3m");
    proMaker[6] = new Maker( 7, "Paper", 1.85, 100,"Mead");
    proMaker[7] = new Maker( 8, "Stapler", 2.21, 100,"Swingline");
    proMaker[8] = new Maker( 9, "Folders", .50, 100,"Mead");
    proMaker[9] = new Maker( 10, "Rulers", .27, 100,"Stanley");
         int maxNum = 10;
         int currentNum = 0;
    Action firstAction = new AbstractAction("First")
              public void actionPerformed(ActionEvent evt)
                   currentInv = 0;
                   populateFields(currentInv);
         JButton firstButton = new JButton(firstAction);
         Action previousAction = new AbstractAction("Previous")
              public void actionPerformed(ActionEvent evt)
                   currentInv--;
                   if (currentInv < 0)
                        currentInv = maxNum - 1;
                   populateFields(currentInv);
         JButton previousButton = new JButton(previousAction);
         Action nextAction = new AbstractAction("Next")
              public void actionPerformed(ActionEvent evt)
                   currentInv++;
                   if (currentInv >= maxNum)
                        currentInv = 0;
              populateFields(currentInv);
         JButton nextButton = new JButton(nextAction);
         Action lastAction = new AbstractAction("Last")
              public void actionPerformed(ActionEvent evt)
                   currentInv = maxNum-1;
                   populateFields(currentInv);
         JButton lastButton = new JButton(lastAction);
              JPanel buttonPanel = new JPanel( );
    private void showGUI() {
    JLabel l;
    JButton button1;
              JButton button2;
    fields = new JTextField[8];
    JFrame f = new JFrame("Inventory");
    Container cp = f.getContentPane();
    cp.setLayout(new GridBagLayout());
    cp.setBackground(UIManager.getColor(Color.BLACK));
    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = GridBagConstraints.RELATIVE;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.insets = new Insets(2, 2, 2, 2);
    c.anchor = GridBagConstraints.EAST;
    cp.add(l = new JLabel("Item Number:", SwingConstants.CENTER), c);
    l.setDisplayedMnemonic('a');
    cp.add(l = new JLabel("Item Name:", SwingConstants.CENTER), c);
    l.setDisplayedMnemonic('b');
    cp.add(l = new JLabel("Number of Units in Stock:", SwingConstants.CENTER), c);
    l.setDisplayedMnemonic('c');
    cp.add(l = new JLabel("Price per Unit: $", SwingConstants.CENTER), c);
    l.setDisplayedMnemonic('d');
    cp.add(l = new JLabel("Total cost of Item: $", SwingConstants.CENTER), c);
    l.setDisplayedMnemonic('e');
    cp.add(l = new JLabel("Total Value of Merchandise in Inventory: $", SwingConstants.CENTER), c);
    l.setDisplayedMnemonic('f');
    cp.add(l = new JLabel("Manufacturer:", SwingConstants.CENTER), c);
    l.setDisplayedMnemonic('g');
    cp.add(l = new JLabel("Restocking Fee: $", SwingConstants.CENTER), c);
    l.setDisplayedMnemonic('h');
              c.gridx = 1;
    c.gridy = 0;
    c.weightx = 1.0;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.CENTER;
    cp.add(fields[0] = new JTextField(), c);
    fields[0].setFocusAccelerator('a');
    c.gridx = 1;
    c.gridy = GridBagConstraints.RELATIVE;
    cp.add(fields[1] = new JTextField(), c);
    fields[1].setFocusAccelerator('b');
    cp.add(fields[2] = new JTextField(), c);
    fields[2].setFocusAccelerator('c');
    cp.add(fields[3] = new JTextField(), c);
    fields[3].setFocusAccelerator('d');
    cp.add(fields[4] = new JTextField(), c);
    fields[4].setFocusAccelerator('e');
    cp.add(fields[5] = new JTextField(), c);
    fields[5].setFocusAccelerator('f');
    cp.add(fields[6] = new JTextField(), c);
    fields[6].setFocusAccelerator('g');
    cp.add(fields[7] = new JTextField(), c);
    fields[7].setFocusAccelerator('h');
    c.weightx = 0.0;
    c.fill = GridBagConstraints.NONE;
              cp.add(firstButton);
              cp.add(previousButton);
              cp.add(nextButton);
              cp.add(lastButton);
                        JComboBox combo = new JComboBox();
    for(int j = 0; j < proMaker.length; j++)
    combo.addItem(proMaker[j].getName());
    combo.addActionListener(this);
              cp.add(combo);
              cp.add(button1 = new JButton(" "), c);
    f.pack();
    f.addWindowListener(new WindowAdapter()
    public void windowClosing(WindowEvent evt)
    System.exit(0);
    f.setVisible(true);
    private void populateFields(int index) {
    Maker maker = proMaker[index];
    fields[0].setText(Long.toString(maker.getNumberCode()));
    fields[1].setText(maker.getName());
    fields[2].setText(Long.toString(maker.getUnits()));
    fields[3].setText(Double.toString(maker.getPrice()));
    fields[4].setText(Double.toString(maker.getSum()));
    fields[5].setText(Double.toString(maker.totalAllInventory(proMaker)));
    fields[6].setText(maker.getManufact());
    fields[7].setText(Double.toString(maker.getSum()*.05));
    class Maker {
    int itemNumber;
    String name;
    int units;
    double price;
    String manufacturer;
    public Maker(int n, String name, double price, int units, String manufac) {
    itemNumber = n;
    this.name = name;
    this.price = price;
    this.units = units;
    manufacturer = manufac;
    public int getNumberCode() { return itemNumber; }
    public String getName() { return name; }
    public int getUnits() { return units; }
    public double getPrice() { return price; }
    public double getSum() { return units*price; }
    public String getManufact() { return manufacturer; }
    public double totalAllInventory(Maker[] makers) {
    double total = 0;
    for(int j = 0; j < makers.length; j++)
    total += makers[j].getSum();
    return total;
    }}

  • Easy Java GUI Question Please Help!

    Please help! whenever I try to run this code:
    package here;
    import java.awt.Graphics;
    import java.awt.Color;
    mport javax.swing.JFrame;
    public class Window extends JFrame {
    public Window(){
         setVisible(true);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setResizable(false);
    setSize(500,500);
         public void paint(Graphics g){
    g.drawString("Hello!", 75, 75);
    public static void main(String[] args) {
    new Window();
    this keeps happening http://www.youtube.com/watch?v=k7htCX6a4BI&feature=watch_response
    (I didn't post this video but it looks like I'm not the only one this has happened to)
    its like I get a weird screen capture :/
    I tried setting the bacgkround color and I tried using netbeans instead of eclipse. neither worked.
    Any help would be really great! I don't want to get discouraged from learning java!

    First of all it contains Syntax error .
    Call the super paint method when trying to override the paint method .
    package here;
    import java.awt.Graphics;
    import java.awt.Color;
    import javax.swing.JFrame;
    public class Window extends JFrame {
    public Window(){
    setVisible(true);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setResizable(false);
    setSize(500,500);
    public void paint(Graphics g){
    // call the base paint method first
    super.paint(g);
    g.drawString("Hello!", 75, 75);
    public static void main(String[] args) {
    new Window();
    Edited by: VID on Mar 31, 2012 5:05 AM

  • Please Help With GUI

    I wrote this simple frame work for a project and
    when I run it, it has a small square the I can't
    write to in the area labled "Graphics". I try
    to write "Blue Title" and a small square blocks
    out the "e " in "Blue Title". Will someone please
    help me with this, I don't know why the small
    square is their or how to get rid of it - thanks.
    The complete program follows, so all you have to
    do is copy and paste it into a file, compile and
    run it, to see what I am talking about.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.border.*;
    //import java.io.*;
    class ButtonPanel extends JPanel
         public ButtonPanel()
              JPanel panel = new JPanel();
              this.setBorder(new TitledBorder("Button Panel"));
              this.add(panel);
              JButton getDataStr = new JButton("Echo Data");
              panel.add(getDataStr);
              JCheckBox force00 = new JCheckBox("Force: (0, 0)", false);
              panel.add(force00);
              JButton compute = new JButton("Compute");
              panel.add(compute);
    class PlotterPanel extends JPanel
         static final int LFT_MARGIN = 60;
         static final int RHT_MARGIN = 20;
         static final int TOP_MARGIN = 20;
         static final int BOT_MARGIN = 20;
         private int plotWidth = 400;
         private int plotHeight = 400;
         private int width = plotWidth+LFT_MARGIN+RHT_MARGIN;
         private int height = plotHeight+TOP_MARGIN+BOT_MARGIN;
         public PlotterPanel()
              JPanel panel = new JPanel();
              this.setPreferredSize(new Dimension(width, height));
              this.add(panel);
         public void paintComponent(Graphics graphics)
              super.paintComponent(graphics);
              Graphics2D graphics2D = (Graphics2D)graphics;
              setBackground(Color.white);
              setForeground(Color.blue);
              graphics2D.drawString("Blue Title", (getWidth()/2)-25, 15);
    class PlotPanel extends JPanel
         public PlotPanel()
              JPanel panel = new JPanel();
              this.setBorder(new TitledBorder("Graphics"));
              panel.setLayout(new BorderLayout());
              this.add(panel);
              JPanel plotterPanel = new PlotterPanel();
              panel.add(plotterPanel, BorderLayout.CENTER);
    class PasteInputPanel extends JPanel
         public PasteInputPanel()
              JPanel panel = new JPanel();
              this.setBorder(new TitledBorder("Paste Input"));
              panel.setLayout(new BorderLayout());
              this.add(panel);
              JTextArea results = new JTextArea("Paste TextArea", 21, 20);
              results.setEditable(true);
              panel.add(results);
    class FileInputPanel extends JPanel
         public FileInputPanel()
              JPanel panel = new JPanel();
              this.setBorder(new TitledBorder("File Input"));
              panel.setLayout(new BorderLayout());
              this.add(panel);
              JLabel fileLbl = new JLabel("  File: ");
              panel.add(fileLbl, BorderLayout.WEST);
              JTextField dataFile = new JTextField("./FileName.ext");
              panel.add(dataFile, BorderLayout.EAST);
              JLabel statusLbl = new JLabel("Status: ");
              panel.add(statusLbl, BorderLayout.SOUTH);
    class InputPanel extends JPanel
         public InputPanel()
              JPanel panel = new JPanel();
              this.setBorder(new TitledBorder("Input Panel"));
              panel.setLayout(new BorderLayout());
              this.add(panel);
              JPanel fileInput = new FileInputPanel();
              panel.add(fileInput, BorderLayout.NORTH);
              JPanel pasteInput = new PasteInputPanel();
              panel.add(pasteInput, BorderLayout.CENTER);
    class ResultsPanel extends JPanel
         public ResultsPanel()
              JPanel panel = new JPanel();
              this.setBorder(new TitledBorder("Results Panel"));
              this.add(panel);
              JTextArea results = new JTextArea("Results TextArea", 5, 68);
              results.setEditable(true);
              panel.add(results);
    class GuiBugPanel extends JPanel
         public GuiBugPanel()
              this.setLayout(new BorderLayout());
              this.add(new ResultsPanel(), BorderLayout.NORTH);
              this.add(new InputPanel(), BorderLayout.WEST);
              this.add(new PlotPanel(), BorderLayout.CENTER);
              this.add(new ButtonPanel(), BorderLayout.SOUTH);
    class GuiBugFrame extends JFrame
         public GuiBugFrame(String title)
              super(title);
              this.getContentPane().add(new GuiBugPanel());
    public class GuiBug
         public static void main(String[] args)
              final GuiBugFrame frame = new GuiBugFrame("GuiBugFrame");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.pack();
              Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
              frame.setLocation((screenSize.width - frame.getWidth())/2, (screenSize.height - frame.getHeight())/2);
              frame.setVisible(true);
         }

    bbritta:
    I commented out the line:
    this.add(panel);
    and that small square disappeared - many thanks for
    your help - I can't believe that I spent so much
    time looking for a fix and you came up with it
    in a very short time - thanks again.

  • Please help...my browser can't display applets

    I know it might sound inept to be asking something about my mozilla browser in this forum but right now I am studying Java and using my browser to view the applet exercises I make. I am particularly in the methods section where you have to make recursions (I am using JAVA 2 how to program Third Edition by Deitel). I made my own version of the fibonacci program in the book . It has a GUI, action listener and the method where all the calculations take place. Unfortunately, when I test it on my brower, Mozilla Fireforx, it just displays the GUI and whole program does not work. The compiler, in this case javac, cannot sense anything wrong and I take it that my code is correct. However nothing still happens when I test it on my browser. As previously mentioned, it just displays the GUI and that's all. I really do not know what is wrong. Is it with my code or with the browser? Or is with the fact that I am using an outdated version of JAVA 2 how to program with a new version of J2SDK that makes my code incompatible with the new technology? please help. TY
    Here's my code:
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class AppletCode extends JApplet implements ActionListener {
         JLabel inputLabel, outputLabel;
         JTextField input, output;
         public void init(){
              Container c = getContentPane();
              c.setLayout(new FlowLayout());
              JLabel inputLabel = new JLabel();
              inputLabel.setText("Enter an Integer and press Enter");
              c.add(inputLabel);
              JTextField input = new JTextField(10);
              input.addActionListener(this);
              c.add(input);
              JLabel outputLabel = new JLabel();
              outputLabel.setText("Fibonacci Value is");
              c.add(outputLabel);
              JTextField output = new JTextField(20);
              output.setEditable(false);
              c.add(output);
         } // GUI
         public void actionPerformed(ActionEvent e) {
              long number, fibonacciValue;
              number = Long.parseLong(input.getText());
              fibonacciValue = fibonacci(number);
              output.setText(Long.toString(fibonacciValue));
         } // Action Listener
         public long fibonacci(long x) {
              if (x==0 || x==1)
                   return x;
              else
                   return fibonacci(x-1) + fibonacci(x-2);
         } // Fibonacci Module
    }

    I don't see anything obviously wrong with your code, but it's been a while since i coded applets, so there might still be something wrong. What exactly does not work? You see the 2 labels and the text fields? Can you enter any text into the text field? Have you looked into the Java Console wether it prints any exceptions? (and please use the [ code][ /code] tags to mark your code (without the spaces obviously))

  • Having problem with switch statement..please help

    here my question :
    GUI-based Pay Calculator
    A company pays its employees as executives (who receive a fixed weekly salary) and hourly workers (who receive a fixed hourly salary for the first 40 hours they work in a week, and 1.5 times their hourly wage for overtime worked).
    Each category of employee has its own paycode :
    ?     Paycode 1 for executives
    ?     Paycode 2 for hourly workers
    Write a GUI-based application to compute the weekly pay for each employee. Use switch to compute each employee?s pay based on that employee?s paycode.
    Use CardLayout layout manager to display appropriate GUI components. Obtain the employee name, employee paycode and other necessary facts from the user to calculate the employee?s pay based on the employee paycode:
    ?     For paycode 1, obtain the weekly salary.
    ?     For paycode 2, obtain the hourly salary and the number of hours worked.
    You may obtain other information which you think is necessary from the user.
    Use suitable classes for the GUI elements. (You can use javax.swing package or java.awt package for the GUI elements.)
    here my code so far :
    import java.awt.;*
    import java.awt.event.;*
    import javax.swing.;*
    *public class PayrollSystem implements ItemListener {*
    JPanel cards, JTextField, textField1, JLabel, label1;
    final static String EXECUTIVEPANEL = "1.EXECUTIVE";
    final static String HOURLYPANEL = "2.HOURLY WORKER";
    public void addComponentToPane(Container pane)
    *//Put the JComboBox in a JPanel to get a nicer look.*
    JPanel comboBoxPane = new JPanel(); //use FlowLayout
    JPanel userNameAndPasswordPane = new JPanel();
    *// User Name JLabel and JTextField*
    userNameAndPasswordPane.add(new JLabel("NAME"));
    JTextField textField1 = new JTextField(25);
    userNameAndPasswordPane.add(textField1);
    *String comboBoxItems[] = { EXECUTIVEPANEL, HOURLYPANEL };*
    JComboBox cb = new JComboBox(comboBoxItems);
    cb.setEditable(false);
    cb.addItemListener(this);
    comboBoxPane.add(cb);
    *//Create the "cards".*
    JPanel card1 = new JPanel();
    card1.add(new JLabel("WEEKLY SALARY"));
    card1.add(new JTextField(6));
    card1.add(new JLabel("TOTAL PAY"));
    card1.add(new JTextField(8));
    card1.add(new JButton("CALCULATE"));
    JPanel card2 = new JPanel();
    card2.add(new JLabel("HOURLY SALARY"));
    card2.add(new JTextField(6));
    card2.add(new JLabel("TOTAL HOURS WORK"));
    card2.add(new JTextField(8));
    card2.add(new JButton("CALCULATE"));
    *//Create the panel that contains the "cards".*
    cards= new JPanel(new CardLayout());
    cards.add(card1, EXECUTIVEPANEL);
    cards.add(card2, HOURLYPANEL);
    pane.add(comboBoxPane, BorderLayout.PAGE_START);
    pane.add(userNameAndPasswordPane, BorderLayout.CENTER);
    pane.add(cards, BorderLayout.PAGE_END);
    public void itemStateChanged(ItemEvent evt)
    CardLayout cl = (CardLayout)(cards.getLayout());
    cl.show(cards, (String)evt.getItem());
    ** GUI created*
    *private static void createAndShowGUI() {*
    *//Make sure we have nice window decorations.*
    JFrame.setDefaultLookAndFeelDecorated(true);
    *//Create and set up the window.*
    JFrame frame = new JFrame("GUI PAY CALCULATOR");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    *//Create and set up the content pane.*
    PayrollSystem demo = new PayrollSystem();
    demo.addComponentToPane(frame.getContentPane());
    *//Display the window.*
    frame.pack();
    frame.setVisible(true);
    *public static void main(String[] args) {*
    *//Schedule a job for the event-dispatching thread:*
    *//creating and showing this application's GUI.*
    *javax.swing.SwingUtilities.invokeLater(new Runnable() {*
    *public void run() {*
    createAndShowGUI();
    HOW CAN I PERFORM THE SWITCH STATEMENT INSIDE THIS CODE TO LET IT FULLY FUNCTIONAL..?
    I MUST PERFORM THE SWITCH STATEMENT LIKE IN THE QUESTION..
    PLEASE HELP ME..REALLY APPRECIATED...TQ

    hi
    A switch works with the byte, short, char, and int primitive data types. So you can simply give the
    switch (month) {
                case 1: 
                            System.out.println("January");
                            break;
                case 2:  {
                            System.out.println("February");
                             break;
                case 3: {
                              System.out.println("March");
                              break;
                             }where month controlls the flow
    moreover u can go to http://www.java-samples.com/java/free_calculator_application_in_java.htm
    for reference, just replace the if statement with switch with correct syntax

Maybe you are looking for

  • FDF Toolkit and pdf conversion

    yes, this is a newbie question...sorry if the answer is obvious. I am trying to design a form solution for my employer, and through some investigation have been given access to, and downloaded the FDF toolkit for Java from Adobe. The good news is the

  • How to tell DVD Studio that my assets are 16:9

    I'm burning a PAL DVD with a jpeg(720x576) menu that I created so that it would look right when squashed and have a short quicktime movie that's currently 4:3 (720x576) but taken from a 16:9 original so it's anamorphically stretched. From reading var

  • "Non-System Disk" Boot Camp Windows 7 on 5K iMac

    I've been trying to install Windows 7 as a Boot Camp partition on my 5K iMac for a few days now. It's driving me crazy. I've tried: Installing from multiple different USB devices – all USB 2.0, 16gb or 32gb. I've tried 4 different sticks now. I just

  • IPad+apple tv to 2 tvs

    Hello, We are trying to stream the screen activity of an iPad to 2 tvs if possible. I know there is an HDMI out to the tv but we would like it to be wireless so our speaker can move around freely. Is this possible with an Apple TV+iPad2+wifi?? Both t

  • What is wrong in the program???(a little bit hard)

    i write a simple welclient, however it doesn't run well, it's not able to exit completely. plz tell me why?thanks. mport java.io.*; import java.net.*; public class Getpage public static void main(String arg[]) throws IOException Socket client = new S