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.

Similar Messages

  • Help on GUI calculator

    I'm making a calculator on netbeans and so far i have been able to get the interface and an the function of the number buttons. Also I got the plus button to work but it does not work after using it once. I have tried, but im stuck and can't firgure out what to do next plz help. This is the code i have:
    * Calulator.java
    * Created on April 3, 2008, 11:30 AM
    package me;
    * @author period4
    public class Calulator extends javax.swing.JFrame {
    /** Creates new form Calulator */
    public Calulator() {
    initComponents();
    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {
    jButton17 = new javax.swing.JButton();
    Input = new javax.swing.JTextField();
    Button1 = new javax.swing.JButton();
    Button4 = new javax.swing.JButton();
    Button7 = new javax.swing.JButton();
    Button2 = new javax.swing.JButton();
    Button5 = new javax.swing.JButton();
    Button8 = new javax.swing.JButton();
    Button3 = new javax.swing.JButton();
    Button6 = new javax.swing.JButton();
    Button9 = new javax.swing.JButton();
    Button0 = new javax.swing.JButton();
    ButtonPlus = new javax.swing.JButton();
    ButtonMinus = new javax.swing.JButton();
    ButtonMultiply = new javax.swing.JButton();
    ButtonDecimal = new javax.swing.JButton();
    ButtonPositiveNegative = new javax.swing.JButton();
    ButtonDivide = new javax.swing.JButton();
    ButtonEquals = new javax.swing.JButton();
    jButton17.setText("jButton17");
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setTitle("Calculator");
    Button1.setText("1");
    Button1.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    Button1ActionPerformed(evt);
    Button4.setText("4");
    Button4.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    Button4ActionPerformed(evt);
    Button7.setText("7");
    Button7.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    Button7ActionPerformed(evt);
    Button2.setText("2");
    Button2.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    Button2ActionPerformed(evt);
    Button5.setText("5");
    Button5.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    Button5ActionPerformed(evt);
    Button8.setText("8");
    Button8.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    Button8ActionPerformed(evt);
    Button3.setText("3");
    Button3.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    Button3ActionPerformed(evt);
    Button6.setText("6");
    Button6.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    Button6ActionPerformed(evt);
    Button9.setText("9");
    Button9.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    Button9ActionPerformed(evt);
    Button0.setText("0");
    Button0.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    Button0ActionPerformed(evt);
    ButtonPlus.setText("+");
    ButtonPlus.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    ButtonPlusActionPerformed(evt);
    ButtonMinus.setText("-");
    ButtonMultiply.setText("*");
    ButtonDecimal.setText(".");
    ButtonDecimal.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    ButtonDecimalActionPerformed(evt);
    ButtonPositiveNegative.setText("+/-");
    ButtonDivide.setText("/");
    ButtonEquals.setText("=");
    ButtonEquals.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    ButtonEqualsActionPerformed(evt);
    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addContainerGap()
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addComponent(Input, javax.swing.GroupLayout.DEFAULT_SIZE, 227, Short.MAX_VALUE)
    .addGroup(layout.createSequentialGroup()
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
    .addComponent(Button7, javax.swing.GroupLayout.Alignment.LEADING, 0, 0, Short.MAX_VALUE)
    .addComponent(Button4, javax.swing.GroupLayout.Alignment.LEADING, 0, 0, Short.MAX_VALUE)
    .addComponent(Button1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
    .addComponent(Button2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .addComponent(Button5, 0, 0, Short.MAX_VALUE)
    .addComponent(Button8, 0, 0, Short.MAX_VALUE))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addComponent(Button3)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(ButtonPlus))
    .addGroup(layout.createSequentialGroup()
    .addComponent(Button6)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(ButtonMinus))
    .addGroup(layout.createSequentialGroup()
    .addComponent(Button9)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(ButtonMultiply))))
    .addGroup(layout.createSequentialGroup()
    .addComponent(ButtonDecimal)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(Button0)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(ButtonPositiveNegative)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(ButtonDivide)))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(ButtonEquals)))
    .addContainerGap())
    layout.setVerticalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addGap(22, 22, 22)
    .addComponent(Input, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addGap(15, 15, 15)
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(Button1)
    .addComponent(Button2)
    .addComponent(Button3)
    .addComponent(ButtonPlus))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(Button4)
    .addComponent(Button5)
    .addComponent(Button6)
    .addComponent(ButtonMinus))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(Button7)
    .addComponent(Button8)
    .addComponent(Button9)
    .addComponent(ButtonMultiply))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(ButtonDecimal)
    .addComponent(Button0)
    .addComponent(ButtonPositiveNegative)
    .addComponent(ButtonDivide)))
    .addGroup(layout.createSequentialGroup()
    .addGap(17, 17, 17)
    .addComponent(ButtonEquals, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)))
    .addContainerGap(44, Short.MAX_VALUE))
    pack();
    }// </editor-fold>//GEN-END:initComponents
    private void ButtonEqualsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonEqualsActionPerformed
    if(operator.equals("+"))
    solution = Double.parseDouble(integer1) + Double.parseDouble(integer2);
    Input.setText(Double.toString(solution));
    operator = null;
    integer1 = "";
    integer2 = "";
    //Input.setText(Double.toString(solution));
    solution = 0;
    // TODO add your handling code here:
    }//GEN-LAST:event_ButtonEqualsActionPerformed
    private void ButtonPlusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonPlusActionPerformed
    operator = "+";
    // TODO add your handling code here:
    }//GEN-LAST:event_ButtonPlusActionPerformed
    private void ButtonDecimalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonDecimalActionPerformed
    Input.setText(".");// TODO add your handling code here:
    }//GEN-LAST:event_ButtonDecimalActionPerformed
    private void Button0ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Button0ActionPerformed
    if(operator == null)
    integer1 = integer1.concat("0");
    Input.setText(integer1);
    else
    integer2 = integer2.concat("0");
    Input.setText(integer2);
    // TODO add your handling code here:
    }//GEN-LAST:event_Button0ActionPerformed
    private void Button9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Button9ActionPerformed
    if(operator == null)
    integer1 = integer1.concat("9");
    Input.setText(integer1);
    else
    integer2 = integer2.concat("9");
    Input.setText(integer2);
    // TODO add your handling code here:
    }//GEN-LAST:event_Button9ActionPerformed
    private void Button6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Button6ActionPerformed
    if(operator == null)
    integer1 = integer1.concat("6");
    Input.setText(integer1);
    else
    integer2 = integer2.concat("6");
    Input.setText(integer2);
    // TODO add your handling code here:
    }//GEN-LAST:event_Button6ActionPerformed
    private void Button3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Button3ActionPerformed
    if(operator == null)
    integer1 = integer1.concat("3");
    Input.setText(integer1);
    else
    integer2 = integer2.concat("3");
    Input.setText(integer2);
    // TODO add your handling code here:
    }//GEN-LAST:event_Button3ActionPerformed
    private void Button8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Button8ActionPerformed
    if(operator == null)
    integer1 = integer1.concat("8");
    Input.setText(integer1);
    else
    integer2 = integer2.concat("8");
    Input.setText(integer2);
    // TODO add your handling code here:
    }//GEN-LAST:event_Button8ActionPerformed
    private void Button5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Button5ActionPerformed
    if(operator == null)
    integer1 = integer1.concat("5");
    Input.setText(integer1);
    else
    integer2 = integer2.concat("5");
    Input.setText(integer2);
    // TODO and your handling code here:
    }//GEN-LAST:event_Button5ActionPerformed
    private void Button7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Button7ActionPerformed
    if(operator == null)
    integer1 = integer1.concat("7");
    Input.setText(integer1);
    else
    integer2 = integer2.concat("7");
    Input.setText(integer2);
    // TODO add your handling code here:
    }//GEN-LAST:event_Button7ActionPerformed
    private void Button4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Button4ActionPerformed
    if(operator == null)
    integer1 = integer1.concat("4");
    Input.setText(integer1);
    else
    integer2 = integer2.concat("4");
    Input.setText(integer2);
    // TODO add your handling code here:
    }//GEN-LAST:event_Button4ActionPerformed
    private void Button1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Button1ActionPerformed
    if(operator == null)
    integer1 = integer1.concat("1");
    Input.setText(integer1);
    else
    integer2 = integer2.concat("1");
    Input.setText(integer2);
    // TODO add your handling code here:
    }//GEN-LAST:event_Button1ActionPerformed
    private void Button2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Button2ActionPerformed
    if(operator == null)
    integer1 = integer1.concat("2");
    Input.setText(integer1);
    else
    integer2 = integer2.concat("2");
    Input.setText(integer2);
    // TODO add your handling code here:
    }//GEN-LAST:event_Button2ActionPerformed
    * @param args the command line arguments
    double solution;
    String integer1 = "";
    String integer2 = "";
    String operator;
    public static void main(String args[])
    java.awt.EventQueue.invokeLater(new Runnable()
    public void run()
    new Calulator().setVisible(true);
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton Button0;
    private javax.swing.JButton Button1;
    private javax.swing.JButton Button2;
    private javax.swing.JButton Button3;
    private javax.swing.JButton Button4;
    private javax.swing.JButton Button5;
    private javax.swing.JButton Button6;
    private javax.swing.JButton Button7;
    private javax.swing.JButton Button8;
    private javax.swing.JButton Button9;
    private javax.swing.JButton ButtonDecimal;
    private javax.swing.JButton ButtonDivide;
    private javax.swing.JButton ButtonEquals;
    private javax.swing.JButton ButtonMinus;
    private javax.swing.JButton ButtonMultiply;
    private javax.swing.JButton ButtonPlus;
    private javax.swing.JButton ButtonPositiveNegative;
    private javax.swing.JTextField Input;
    private javax.swing.JButton jButton17;
    // End of variables declaration//GEN-END:variables
    }

    Yeah. Seriously. I don't think anybody wants to wade through a whole bunch of IDE generated crap that you didn't bother to format with code tags.
    I know I don't.
    So maybe post some formatted relevent code (10 lines or less).

  • 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

  • I was in science trying to use my calculator and i couldn't slide to unlock my ipod. later i kept getting notifications but it still wouldnt slide. help please?

    i was in science trying to use my calculator and i couldn't slide to unlock my ipod. later i kept getting notifications but it still wouldnt slide. help please?

    Try:
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Restore from backup. See:
    iOS: How to back up
    - Restore to factory settings/new iOS device.
    -  Make an appointment at the Genius Bar of an Apple store.
    Apple Retail Store - Genius Bar

  • 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

  • GUI Calculator

    Hello everyone! I'm trying to create a GUI Calculator but cannot get my program to compile. Please could someone assist me, 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);
    //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.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
    >

    Here I did this for someone in the 'new to' forum about 2 weeks back. They had some really awful code they say they got from a java book -cannot recall the author, but I do know his work should be burned and the person executed with a mercy killing (I still haven't recovered from the shock of this and I think most of the regular contributors in these forums could write FAR BETTER books than this clown)
    Hmm... I do rant sometimes. Erm, you're welcome - this is their rebuild;-import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Calculator extends JFrame implements ActionListener{
       JButton []buttons = new JButton[25];
         private JTextField display= new JTextField("0.0",12);
       String status = "    Status : ";
       JLabel label = new JLabel(status);
         private double sum    = 0.0d;
         private String nums   = "";
         private double arg    = 0.0d;
         private double tot    = 0.0d;
         private boolean start = true,div,mult,add,sub;
         private String memory = "0";
       java.text.DecimalFormat df=new java.text.DecimalFormat("#,##0.0####");
       Font f = new Font("Times New Roman", Font.BOLD,14);
       Color midBlue  = new Color(20, 15, 140);
    public Calculator(){
         super();
         setTitle("Java Calculator");
       JPanel mainPan = new JPanel();
       mainPan.setLayout(new BorderLayout() );
       JPanel textPanel = new JPanel();
       textPanel.setBackground(midBlue);
       textPanel.setLayout(new BorderLayout());
       display.setHorizontalAlignment(JTextField.RIGHT);
       label.setForeground(Color.white);
       display.setFont(new Font("",0,14));
       display.setEditable(false);
       display.setBackground(Color.white);
       label.setFont(new Font("Arial",0,12));
       JPanel emptyPan = new JPanel();
       emptyPan.setBackground(midBlue);
       JPanel emptyP1 = new JPanel();
       emptyP1.setBackground(midBlue);
       JPanel emptyP2 = new JPanel();
       emptyP2.setBackground(midBlue);
       textPanel.add("North", label);
       textPanel.add("Center", display);
       textPanel.add("South",emptyPan );
       textPanel.add("East",emptyP1 );
       textPanel.add("West",emptyP2 );
       JPanel butPanel = new JPanel();
       butPanel.setBackground(midBlue);
       butPanel.setLayout(new GridLayout(5, 5, 10, 10));
       String []str = {"","","","CE","C","1","2","3","/","RM","4","5","6",
                      "*","CM","7","8","9","+","M+","0",".","=","-","M-"};
       for(int j=0; j<25; j++) {
          if(j<3) {
             buttons[j] = new JButton(str[j]);
             butPanel.add(buttons[j]);
          else {
             buttons[j] = new JButton(str[j]);
             buttons[j].addActionListener(this);
             buttons[j].setFont(f);
               buttons[j].setBorder(BorderFactory.createRaisedBevelBorder());
             butPanel.add(buttons[j]);
       JPanel emptyPan1 = new JPanel();
       emptyPan1.setBackground(midBlue);
       JPanel emptyPan2 = new JPanel();
       emptyPan2.setBackground(midBlue);
       JPanel emptyPan3 = new JPanel();
       emptyPan3.setBackground(midBlue);
       mainPan.add("North", textPanel);
       mainPan.add("Center", butPanel);
       mainPan.add("South", emptyPan1);
       mainPan.add("East", emptyPan2);
       mainPan.add("West", emptyPan3);
       getContentPane().add(mainPan);
    public void actionPerformed(ActionEvent e){
       String s = e.getActionCommand();
          if ((s.equals("1"))||(s.equals("2"))||(s.equals("3"))||(s.equals("4"))
            ||(s.equals("5"))||(s.equals("6"))||(s.equals("7"))||(s.equals("8"))
            ||(s.equals("9"))||(s.equals("0"))||(s.equals("."))){
               nums += s;
               display.setText(nums);
          if (s.equals("/")){
             arg=Double.parseDouble(display.getText());
             nums="";
             div=true;
          if (s.equals("*")){
             arg=Double.parseDouble(display.getText());
             nums="";
             mult=true;
          if (s.equals("-")){
             arg=Double.parseDouble(display.getText());
             nums="";
             sub=true;
          if (s.equals("+")){
             arg=Double.parseDouble(display.getText());
             nums="";
             add=true;
          if (s.equals("=")){
             tot=Double.parseDouble(display.getText());
             if(div)tot=arg/tot;
             if(mult)tot=arg*tot;
             if(add)tot=arg+tot;
             if(sub)tot=arg-tot;
             display.setText(df.format(tot));
             div=mult=sub=add=false;
    public static void main(String[] args){
        Calculator frame = new Calculator();
        frame.setVisible(true);
        frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
          Image onFrame = Toolkit.getDefaultToolkit().getImage("flag.gif") ;
        frame.setIconImage(onFrame);
        frame.setLocation(300, 240);
        frame.setResizable(false);
        frame.pack();
    }

  • Need help with a calculated column - is there any way to reference a value in the current row?

    Hey guys,
    I'm a bit of a DAX newbie, and I'm running into a block. I'm creating a Power View report about IT tickets. We are going to be creating a cube to automate the data soon, I'm currently working with a flat Excel Data Table of data to demonstrate the Power
    View reporting capabilities to the team. I need the default display to show the top 4-5 items basked on the Ticket Count. The three applicable columns I'm using are the TicketID, the ContactReason, and the AssetCategory - all three are
    text. One slide will show the top five Contact Reasons by Ticket Count, and the other will show the top five Categories by Ticket Count. The users will see this default view, but will be able to change it to see differently ranked items or can clear the
    ranking slicer altogether.
    What I've accomplished so far is to create the Calculated Field [Ticket Count] = COUNTA(Table1[TicketID])
    And 2 other calculated fields:
    [Contact Rank] = RANKX(ALL(Table1[ContactReason]),[Ticket Count],,,DENSE)
    [Asset Rank] = RANKX(ALL(Table1[AssetCategory]),[Ticket Count],,,DENSE)
    If I were creating a Pivot Table, this would be great. These fields calculate everything the right way. The problem is, I need to have a Rank slicer on each slide and the calculation by itself contains no data - with no data, there's nothing to slice. I
    realized I need to actually have columns of data so I can create a slicer. I need each row of the table to show the same [Contact Rank] for every instance of a particular ContactReason (and the same for the [Asset Rank] and AssetCategory).
    The RANKX formulas pasted into the Calculated Column section only show a value of 1 - with no Pivot table summarizing the fields, it's counting each row's ticket once, giving every line the tied Rank of #1.
    I've solved the problem in Excel by creating 2 Pivot Tables on a separate sheet that have the data field and the calculated field for ContactRason and AssetCategory. Then on my Excel Data Table, I've added two columns that do a VLOOKUP and pull over a the
    Calculated Rank from each Pivot Table that match the ContactReason and AssetCategory fields. This works on the flat Excel Data Table now, but will not be a solutions when we start pulling the data from the cube (and there is no flat table).
    What I think I need is an Expression for the RANKX formula that can give me, for each row, the count of all of the times a ContactReason shows up in an entire column. There's only about 100,000 lines of data and each ContactReason or AssetCategory
    may show up several thousand times. But if I can get the expression to return that count, then the RANKX formula should work in the Column. If it wasn't a DAX formula, I'd use a COUNTIF and say 'Count the entire ContactReason column anytime it's equal to the
    ContactReason on THIS row', but in DAX I don't know how to reference a single value in a row. I've tried the CALCULATE() formula, but it seems like the filter needs a specific value, and doesn't work on a dynamic "cell" value.
    Any help would be greatly appreciated! (I hope it all makes sense!)

    If I've understood you correctly then the ALLEXCEPT function may be what you're after and it could be applied in a similar way to the following...
    =
    RANKX(
    ALL(Table1),
    CALCULATE(
    COUNTROWS(table1),
    ALLEXCEPT(Table1, Table1[ContactReason])
    DENSE
    If this has missed the mark, would it be possible to clarify the requirement further?
    Regards,
    Michael Amadi
    Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to vote it as helpful :)
    Website: http://www.nimblelearn.com
    Blog: http://www.nimblelearn.com/blog
    Twitter: @nimblelearn

  • Excel sumifs and the powerpivot version help please

    very new to power pivot, can you help please?
    In an excel table I was able to do the following...
    =SUMIFS([GWP],[Date],[@Date],[PolType],[@PolType])
    I have 60k rows where the above totals all GWP where the date & policy type match the individual record.  This in effect gives a subtotal, per date per policy type rather than doing it in a pivot table.  This works
    nicely however it takes for ages to update, and calculate, also has issues when I then need to pivot table it.
    As a result I'm trying to use powerpivot, as I understand it is better at dealing with these big calculations, I've tried the calculate formula, but I cannot understand how to have a rolling criteria in the field.  Like I can in my sumifs.
    Thank you in advance for your help
    Mathew

    To duplicate your original SUMIF as a Calculated Column in PowerPivot you could use one of the following:
    Using EARLIER():
    =CALCULATE(
    SUM(Table1[GWP]),
    FILTER(
    Table1,
    Table1[Date] = EARLIER(Table1[Date]) &&
    Table1[PolType] = EARLIER(Table1[PolType])
    Using ALLEXCEPT:
    =CALCULATE(
    SUM(Table1[GWP]),
    ALLEXCEPT(
    Table1,
    Table1[Date],
    Table1[PolType]
    Both should produce the same result as a Calculated Column.
    The second version with ALLEXCEPT() should also work a Measure/Calculated Field:
    ALLEXCEPT Measure:=
    CALCULATE(
    SUM(Table1[GWP]),
    ALLEXCEPT(
    Table1,
    Table1[Date],
    Table1[PolType]
    The advantage of the measure is that it should return the expected result in a pivot and filtering dynamically.
    Your final measure would then be:
    Percent GWP:=
    SUM(Table1[GWP])/[ALLEXCEPT Measure]
    In all examples, replace 'Table1' with your actual table name in Power Pivot.

  • How to get reports cumulated balances? need help please

    Dear all,
    I need your help please in this issue.
    I am creting a report using reports designer in oracle, well the fact is i don't know how to do the following:
    if i have for example in the report the following to be diplayed :
    Date Amount Balance
    25/5/2011 2000
    27/5/2011 5000 should be calculated and equal to 2000+5000=*7000*
    28/5/2011 4000 calculated and equal to 7000 + 4000=*11000*
    29/5/2011 1000 calculated equal to 11000 + 1000 = 12000
    what is the method so i can get the balance values calculated 7000, 11000 and 12000? what do i do? any hints please
    thanks for your help

    Using analytic function can be done through query as below...
    SQL> SELECT EMPNO, ENAME, SAL, SUM(SAL) OVER (ORDER BY SAL ROWS UNBOUNDED PRECEDING) RUNNING_BALANCE
      2  FROM SCOTT.EMP
      3  /
         EMPNO ENAME             SAL RUNNING_BALANCE
          7369 SMITH             800             800
          7900 JAMES             950            1750
          7876 ADAMS            1100            2850
          7521 WARD             1250            4100
          7654 MARTIN           1250            5350
          7934 MILLER           1300            6650
          7844 TURNER           1500            8150
          7499 ALLEN            1600            9750
          7782 CLARK            2450           12200
          7698 BLAKE            2850           15050
          7566 JONES            2975           18025
          7788 SCOTT            3000           21025
          7902 FORD             3000           24025
          7839 KING             5000           29025
    14 rows selected.
    SQL> -Ammad

  • VERY slow download, need help please!

    Hello there, we recently moved house and have just had our internet and broadband activated, probobly 2-4 weeks ago, today i was downloading an update of my Xbox for a game, now bearing in mind i am directly connected through a wire to the homehub (BT HomeHub 3), it is a 2.07gb update, the first 75% went rather quickly(2-3 hours) i recently got home to find it was on 77%, this was an hour later, and 2 hours have passed now and it has only just reached 78%, which of my calculations are correct is less than 0.3KBS, which would put the completeion time around next week, i have tried unplugging the cable and restarting the HomeHub and nothing has worked(also whenever i do this the download skips back to 44% and spend 20 minutes befor jumping to 56% and then 40 mins befor going back to 78%. If anyone could help me i would be most gracious.
    Jacob

    welcome to the forum
    in order for the forum members to help please can you post the adsl stats from your router may need to 'show detail' to get all stats (if hub enter 192.168.1.254 in your browser and navigate to adsl or use a-z, if netgear enter 192.168.0.1) and run btspeedtester (MAC users may have problems) BT Speedtester and post the results .
    are you connected directly to the NTE5 master or test socket or to somewhere else? Is the master the only phone socket in your home?
    Have you tried the quiet line test? - dial 17070 option 2 - should hear nothing - best done with a corded phone. if cordless phone you may hear a 'dull hum' which is normal
    Someone may then be able to offer help/assistance/suggestions to your problem
    If you like a post, or want to say thanks for a helpful answer, please click on the Ratings star on the left-hand side of the post.
    If someone answers your question correctly please let other members know by clicking on ’Mark as Accepted Solution’.

  • Help please! Going mad with CSS in JEditorPane

    Hi gurus,
    For more then two days now i am trying to get css working with html in my jeditorpane.
    This is the stylesheet:
    .toc1
    font-size:12.0pt;
    font-family:Arial;
    font-weight:bold;
    margin-bottom: 0px;
    .toc2
    font-size:11.0pt;
    font-family:"Times New Roman";
    margin-left: 20px;
    margin-top: 0px;
    margin-bottom: 0px;
    .plannerhyperlink
    color:green;
    text-decoration:italic;
    SIMPLE isn't it?
    In my JEditorPane constructor I do this
    StyleSheet styleSheet = new StyleSheet();
    //StyleSheet styleSheet = kit.getStyleSheet();
    FileReader reader = new FileReader("/programs/eclipse/workspace/Planner/src/nl/renepetersconsultancy/planner/gui/HTMLHelp/test.css");
    styleSheet.loadRules(reader, new URL("file:/programs/eclipse/workspace/Planner/src/nl/renepetersconsultancy/planner/gui/HTMLHelp/test.css"));
    kit.setStyleSheet(styleSheet);
    setEditorKit(kit);
    setPage(url);
    I know that the rules are loaded: I printed them to check that. But nothing happens!!!! Almost all layout is gone. If I use the original stylesheet and load my rules on top of them, I can see I have all of them, but everything is layout with the original default style and again my layout is ignored.
    HELP Please, anyone. I am desperate (deadline + demo is tomorrow) :-(
    Rene'

    GL is far easier to do simple CSS than DW, but once you get through the awkward DW interface, it can become clearer. I can only easily see how CSS is created in DW by exporting a GL site that has some already in it. Still not as easy as GL, but we're now stuck with it.
    DW still does not handle full fledged CSS unless you have coding experience.
    DW has always been more for the programmer than designer (just try asking a question on the DW forum :-)
    CS4 seems to be an improvement, but not there yet.

  • I keep being asked to update my Safari but when I do a Software update it scans but never gives me a list and just says no new updates. Help please!

    I keep being asked to update my Safari but when I do a Software update it scans but never gives me a list and just says no new updates. Help please!

    There are no updates to either OS 10.5.8 or Safari 5.0.6.
    If you need a later version of Safari you must first upgrade your operating system to a later version of OS X.

  • At the end of my IMovie I want to write some text: as in" Happy Birthday Mandy we had a great time with you. etc..  How do I go about this? Which icon in IMovie lets me have a place to write text?? help please

    Please see my ? above: Im making an IMovie and need the last frame to just be text (can be on a color). I don't know how to go about doing this.  Ive already done all my photos and captions. Need to have it ready for TOMORROW: Friday May 23rd. Help please!
    Thanks

    You can choose a background for the text from Maps and Backgrounds.  Just drag a background to the end of the timeline, adjust to desired duration then drag title above it.
    Geoff.

  • I have just updated my PC with version11.14. I can no longer connect to my Bose 30 soundtouch via media player Can anyone help please

    I have a Bose soundtouch system .Until today I could play my iTunes music through it via air  player . .I have just uploaded the latest upgrade from iTunes and now I am unable to connect to the Bose system . Can anyone help please? I can connect via my iPad and by using the Bose app so it is not the Bose at fault

    @puebloryan, I realize this thread is a bit old, but I have encountered a similr problem and wondered if you had found a solution. I've been using home sharing from itines on my PCs for years, but two days ago, it suddenly stopped. I can share from my Macs, but not from the ONE PC library where I keep all my tunes. I tried all the usual trouble-shooting measures.
    After turning home sharing off on the PC's iTunes, turning it back on and turning some other settings off and on, my Macs and Apple TV could briefly "see" the PC library, but as soon as I try to connect -- the wheel spins for a bit and then the connection vanishes. It's as if they try and then give up.
    Since this sounds so similar to your problem, I was hoping you finally found a solution. I am also starting a new thread. Thanks!

  • My iMac 24 can no longer be paired with the keyboard; it doesn't recognise any keyboard at boot up, even the one it is paired with. Can anyone help, please?

    My iMac 24 can no longer be paired with the keyboard; it doesn't recognise any keyboard at boot up, even the one it is paired with. Can anyone help, please?
    Thank. Simon

    Brian - The batteries are fine and there has only every been one keyboard paired with it. We have tried my MacPro keyboard as well, and it will not even recognise that there is a discoverable keyboard nearby.
    Thanks, Simon

Maybe you are looking for