Creating another class window within one class

Ok I have a main window class, at some point if you click some button I want it to make the first window invisible and have this other, second class, appear, and further on, for both to talk to eachother. These are applets, and I have tried having one applet launch using applet.init() and hoping it would launch but it doesn't work that easy.

so it has to create a new window within the first class? I cannot use two classes? here:
   import java.awt.*;
   import java.awt.event.*;
   import javax.swing.*;
   import javax.swing.JOptionPane;
    public class Darkness extends JApplet implements ItemListener, ActionListener
          private int intBold = Font.BOLD;
          private int intItalic = Font.PLAIN;
      private Color currentColor = Color.blue;
          private Color dateColor = Color.red;
          private Color regColor = Color.black;
          private JComboBox Years;
      private JRadioButton Sword, Bow, Flame, Ice;
      private JButton Walk[] = new JButton[6];
      private int x, y;
        private ButtonGroup Months;
          private int MO;
      private String[] buttonnames = {"Walk", "Town"};
          private String[] section = {"Forest","Mountains"};
          private String SECTION;
public void init()
               SECTION = section[0];
               Image image = getImage(getCodeBase(), "Background.jpg");
               Container content = new Work(new ImageIcon(image).getImage());
               setContentPane(content);
               Years = new JComboBox(section);
               Years.setMaximumRowCount(3);
               Years.setSize(80,30);
               Years.setLocation(260,450);
         Container c = getContentPane();
         c.setLayout(null);
               c.add(Years);
         Sword = new JRadioButton("Sword");
         Bow = new JRadioButton("Bow");
         Flame = new JRadioButton("Flame");
         Ice = new JRadioButton("Ice");
         Sword.setLocation(50, 400);
         Bow.setLocation(175, 400);
         Flame.setLocation(300, 400);
         Ice.setLocation(425, 400);
               Sword.setBackground(currentColor);
               Bow.setBackground(currentColor);
               Flame.setBackground(currentColor);
               Ice.setBackground(currentColor);
         Sword.setSize(100,30);
         Flame.setSize(100,30);
         Ice.setSize(100,30);
         Bow.setSize(100,30);
         Sword.addItemListener(this);
         Flame.addItemListener(this);
         Ice.addItemListener(this);
         Bow.addItemListener(this);
         c.add(Sword);
         c.add(Ice);
         c.add(Flame);
         c.add(Bow);
         Months = new ButtonGroup();
         Months.add(Sword);
         Months.add(Ice);
         Months.add(Flame);
         Months.add(Bow);
int b = 200; //for button placement
     for(int i = 0; i < 2; i++)
                    Walk[i] = new JButton(buttonnames);
                    Walk[i].setSize(80, 40);          
                    Walk[i].addActionListener(this);
                    Walk[i].setVisible(true);
                    Walk[i].setLocation(b, 500);
                    c.add(Walk[i]);
                    b = b + 100;
public void itemStateChanged(ItemEvent e)
Container d = getContentPane();
d.setLayout(null);
int y = 200;
          if(e.getSource() == Years)
     SECTION = section[Years.getSelectedIndex()];
     repaint();
}//end
public void paint(Graphics g)
super.paint(g);
g.setColor(Color.red);
g.drawRoundRect(0,0,600,600,10,10);
g.setColor(Color.red);
               g.setFont(new Font("Courier", intBold + intItalic, 30));
g.drawString("Darkness",250,50);
g.setFont(new Font("Courier", intBold + intItalic, 12));
g.drawString("Monster", 150,175);
g.drawString("Monster Health", 250,175);
               g.drawString("Pick an area", 260,445);
public void actionPerformed(ActionEvent e)
int Randomizer;
java.util.Random r = new java.util.Random();
Randomizer = r.nextInt(10)+1;
     if(e.getSource() == Walk[0] & SECTION == "Forest")
          JOptionPane.showMessageDialog(null, "" + Randomizer, "Damage!", JOptionPane.INFORMATION_MESSAGE);     
     if(e.getSource() == Walk[1])
//**********************HERE IS WHERE I WANT TO CALL THE OTHER APPLET*************
//**********************HERE IS WHERE I WANT TO CALL THE OTHER APPLET*************
//**********************HERE IS WHERE I WANT TO CALL THE OTHER APPLET*************
//**********************HERE IS WHERE I WANT TO CALL THE OTHER APPLET*************
//**********************HERE IS WHERE I WANT TO CALL THE OTHER APPLET*************
//**********************HERE IS WHERE I WANT TO CALL THE OTHER APPLET*************
//**********************HERE IS WHERE I WANT TO CALL THE OTHER APPLET*************
          JOptionPane.showMessageDialog(null, "Returning to Town", "Info", JOptionPane.INFORMATION_MESSAGE);
//THE FIRST CLASS SHOULD CALL THIS CLASS::::Completely different file not same .java
//********************************************************************************8
//********************************************************************************8
//********************************************************************************8
//********************************************************************************8
//********************************************************************************8
//********************************************************************************8
//********************************************************************************8
//********************************************************************************8
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.JOptionPane;
public class Town extends JApplet implements ActionListener
               private int intBold = Font.BOLD;
          private int intItalic = Font.PLAIN;
private JButton Buy[] = new JButton[6];
private String[] ButtonNames = {"Walk", "Town"};
public void init()
          Image image = getImage(getCodeBase(), "Town.jpg");
          Container content = new Work(new ImageIcon(image).getImage());
          setContentPane(content);
Container c = getContentPane();
c.setLayout(null);
Buy[0] = new JButton(ButtonNames[0]);
Buy[0].setSize(80, 40);          
                    Buy[0].addActionListener(this);
                    Buy[0].setLocation(400, 300);
                    c.add(Buy[0]);
     public void paint(Graphics g)
super.paint(g);
g.setColor(Color.yellow);
g.drawRoundRect(0,0,600,600,10,10);
g.setColor(Color.red);
g.setFont(new Font("Courier", intBold + intItalic, 30));
g.drawString("Town",110,150);
g.setFont(new Font("Courier", intBold + intItalic, 12));
g.drawString("Sunday", 25,175);
g.drawString("Monday", 100,175);
g.drawString("Tuesday", 175,175);
g.drawString("Wednesday", 250,175);
g.drawString("Thursday", 325,175);
g.drawString("Friday", 400,175);
g.drawString("Saturday", 475,175);
               g.drawString("", 260,445);
public void actionPerformed(ActionEvent e)
if(e.getSource() == Buy[0])
JOptionPane.showMessageDialog(null, "" , "Info", JOptionPane.INFORMATION_MESSAGE);     
          public static int Money()
int t = 3;
return t;

Similar Messages

  • In Pages (5.5.1) can I create multiple Paragraph Styles within one paragraph?

    In Pages (5.5.1) can I create multiple Paragraph Styles within one paragraph. 
    I need to make a table of contents for my Mater's Thesis and want to use the automatic table of contents feature.  I want the first sentence of a paragraph to have a different paragraph setting than the rest of the paragraph.  Is this possible?
    Thanks!

    Nice of you to be doing this for your Mother's Thesis.
    There are several issues here:
    1. A Paragraph Style is what it says, the style for the paragraph
    2. You can format text within a paragraph by applying a Character Style
    3. Pages 5.5.1 lets you apply formatting to overall text for the T.O.C. but not parts of it and you can not retain that formatting as a Paragraph style
    So in answer to your question, no.
    You will need to create the T.O.C. manually and unfortunately as Pages 5.5.1 can't create bookmarks (just one of over 100 missing features) you will be unable to link the T.O.C. to the referred pages in the list.
    Peter
    Apple's marketing slogan:
    Pages 5.5.1 - Can't Do That!

  • LSMW Material Master - create several valution types within one Run

    Hello @ll,
    i created a LSMW for material master migration, and i would like to create up to 4 different accounting views (based on different valuation types) within one LSMW Run.
    As there is the Field BWTAR on Structure BMM00, and the accounting fields on Structure BMMH1 i dont know if:
    1. this is possible in general with LSMW and
    2. if possible where i have to set the "transfer_record" commands...
    Does anybody have experience on this?
    BR,
    Gregor H.

    I never used the standard batch input method, so I cant answer this part. But with IDOC as import method I do this right now and it works without any problem
    The transfer record command is set in the  section of processing time  __END_OF_RECORD__
    you can display this section when you are in field mapping and conversion rules. choose from menu Extras > Layout and activate all boxes.

  • Accessing a variable defined in one class from another class..

    Greetings,
    I've only been programming in as3 for a couple months, and so far I've written several compositional classes that take MovieClips as inputs to handle behaviors and interactions in a simple game I'm creating. One problem I keep coming upon is that I'd love to access the custom variables I define within one class from another class. In the game I'm creating, Main.as is my document class, from which I invoke a class called 'Level1.as' which invokes all the other classes I've written.
    Below I've pasted my class 'DieLikeThePhishes'. For example, I would love to know the syntax for accessing the boolean variable 'phish1BeenHit' (line 31) from another class. I've tried the dot syntax you would use to access a MovieClip inside another MovieClip and it doesn't seem  to be working for me. Any ideas would be appreciated.  Thanks,
    - Jeremy
    package  jab.enemy
    import flash.display.MovieClip;
    import flash.events.Event;
    import jab.enemy.MissleDisappear;
    public class DieLikeThePhishes
    private var _clip2:MovieClip; // player
    private var _clip3:MovieClip; //phish1
    private var _clip4:MovieClip; //phish2
    private var _clip5:MovieClip; //phish3
    private var _clip6:MovieClip; //phish4
    private var _clip10:MovieClip; // background
    private var _clip11:MovieClip // missle1
    private var _clip12:MovieClip // missle2
    private var _clip13:MovieClip // missle3
    private var _clip14:MovieClip // missle4
    private var _clip15:MovieClip // missle5
    private var _clip16:MovieClip // missle6
    private var _clip17:MovieClip // missle7
    private var _clip18:MovieClip // missle8
    private var _clip19:MovieClip // missle9
    private var _clip20:MovieClip // missle10
    private var _clip21:MovieClip // missle11
    private var _clip22:MovieClip // missle12
    var ay1 = 0;var ay2 = 0;var ay3 = 0;var ay4 = 0;
    var vy1 = 0;var vy2 = 0;var vy3 = 0;var vy4 = 0;
    var phish1BeenHit:Boolean = false;var phish2BeenHit:Boolean = false;
    var phish3BeenHit:Boolean = false;var phish4BeenHit:Boolean = false;
    public function DieLikeThePhishes(clip2:MovieClip,clip3:MovieClip,clip4:MovieClip,clip5:MovieClip,clip6:M ovieClip,clip10:MovieClip,clip11:MovieClip,clip12:MovieClip,clip13:MovieClip,clip14:MovieC lip,clip15:MovieClip,clip16:MovieClip,clip17:MovieClip,clip18:MovieClip,clip19:MovieClip,c lip20:MovieClip,clip21:MovieClip,clip22:MovieClip)
    _clip2 = clip2;_clip3 = clip3;_clip4 = clip4;_clip5 = clip5;_clip6 = clip6;
    _clip10 = clip10;_clip11 = clip11;_clip12 = clip12;_clip13 = clip13;_clip14 = clip14;
    _clip15 = clip15;_clip16 = clip16;_clip17 = clip17;_clip18 = clip18;_clip19 = clip19;
    _clip20 = clip20;_clip21 = clip21;_clip22= clip22;
    _clip3.stage.addEventListener(Event.ENTER_FRAME, onEnterFrame)
    function onEnterFrame(event:Event):void
    vy1+= ay1;_clip3.y += vy1; vy2+= ay2;_clip4.y += vy2;
    vy3+= ay3;_clip5.y += vy3; vy4+= ay4;_clip6.y += vy4;
    if (phish1BeenHit ==false)
    if(_clip3.y >620)
    {_clip3.y = 620;}
    if (phish2BeenHit ==false)
    if(_clip4.y >620)
    {_clip4.y = 620;}
    if (phish3BeenHit ==false)
    if(_clip5.y >620)
    {_clip5.y = 620;}
    if (phish4BeenHit ==false)
    if(_clip6.y >620)
    {_clip6.y = 620;}
    if (_clip11.hitTestObject(_clip3) ||_clip12.hitTestObject(_clip3)||_clip13.hitTestObject(_clip3)||_clip14.hitTestObject(_cl ip3)||_clip15.hitTestObject(_clip3)||_clip16.hitTestObject(_clip3)||_clip17.hitTestObject( _clip3)||_clip18.hitTestObject(_clip3)||_clip19.hitTestObject(_clip3)||_clip20.hitTestObje ct(_clip3)||_clip21.hitTestObject(_clip3)||_clip22.hitTestObject(_clip3))
    _clip3.scaleY = -Math.abs(_clip3.scaleY);
    _clip3.alpha = 0.4;
    ay1 = 3
    vy1= -2;
    phish1BeenHit = true;
    if (_clip11.hitTestObject(_clip4) ||_clip12.hitTestObject(_clip4)||_clip13.hitTestObject(_clip4)||_clip14.hitTestObject(_cl ip4)||_clip15.hitTestObject(_clip4)||_clip16.hitTestObject(_clip4)||_clip17.hitTestObject( _clip4)||_clip18.hitTestObject(_clip4)||_clip19.hitTestObject(_clip4)||_clip20.hitTestObje ct(_clip4)||_clip21.hitTestObject(_clip4)||_clip22.hitTestObject(_clip4))
    _clip4.scaleY = -Math.abs(_clip4.scaleY);
    _clip4.alpha = 0.4;
    ay2 = 3
    vy2= -2;
    phish2BeenHit = true;
    if (_clip11.hitTestObject(_clip5) ||_clip12.hitTestObject(_clip5)||_clip13.hitTestObject(_clip5)||_clip14.hitTestObject(_cl ip5)||_clip15.hitTestObject(_clip5)||_clip16.hitTestObject(_clip5)||_clip17.hitTestObject( _clip5)||_clip18.hitTestObject(_clip5)||_clip19.hitTestObject(_clip5)||_clip20.hitTestObje ct(_clip5)||_clip21.hitTestObject(_clip5)||_clip22.hitTestObject(_clip5))
    _clip5.scaleY = -Math.abs(_clip5.scaleY);
    _clip5.alpha = 0.4;
    ay3 = 3
    vy3= -2;
    phish3BeenHit = true;
    if (_clip11.hitTestObject(_clip6) ||_clip12.hitTestObject(_clip6)||_clip13.hitTestObject(_clip6)||_clip14.hitTestObject(_cl ip6)||_clip15.hitTestObject(_clip6)||_clip16.hitTestObject(_clip6)||_clip17.hitTestObject( _clip6)||_clip18.hitTestObject(_clip6)||_clip19.hitTestObject(_clip6)||_clip20.hitTestObje ct(_clip6)||_clip21.hitTestObject(_clip6)||_clip22.hitTestObject(_clip6))
    _clip6.scaleY = -Math.abs(_clip6.scaleY);
    _clip6.alpha = 0.4;
    ay4 = 3
    vy4= -2;
    phish4BeenHit = true;
    if (_clip3.y > 10000)
    _clip3.x = 1000 +3000*Math.random()-_clip10.x;
    _clip3.y = 300;
    _clip3.alpha = 1;
    _clip3.scaleY = Math.abs(_clip3.scaleY);
    ay1 = vy1 = 0;
    phish1BeenHit = false;
    if (_clip4.y > 10000)
    _clip4.x = 1000 +3000*Math.random()-_clip10.x;
    _clip4.y = 300;
    _clip4.alpha = 1;
    _clip4.scaleY = Math.abs(_clip4.scaleY);
    ay2 = vy2 = 0;
    phish2BeenHit = false;
    if (_clip5.y > 10000)
    _clip5.x = 1000 +3000*Math.random()-_clip10.x;
    _clip5.y = 300;
    _clip5.alpha = 1;
    _clip5.scaleY = Math.abs(_clip5.scaleY);
    ay3 = vy3 = 0;
    phish3BeenHit = false;
    if (_clip6.y > 10000)
    _clip6.x = 1000 +3000*Math.random()-_clip10.x;
    _clip6.y = 300;
    _clip6.alpha = 1;
    _clip6.scaleY = Math.abs(_clip6.scaleY);
    ay4 = vy4 = 0;
    phish4BeenHit = false;
    var missleDisappear1 = new MissleDisappear(_clip11,_clip3,_clip4,_clip5,_clip6,_clip10);
    var missleDisappear2 = new MissleDisappear(_clip12,_clip3,_clip4,_clip5,_clip6,_clip10);
    var missleDisappear3 = new MissleDisappear(_clip13,_clip3,_clip4,_clip5,_clip6,_clip10);
    var missleDisappear4 = new MissleDisappear(_clip14,_clip3,_clip4,_clip5,_clip6,_clip10);
    var missleDisappear5 = new MissleDisappear(_clip15,_clip3,_clip4,_clip5,_clip6,_clip10);
    var missleDisappear6 = new MissleDisappear(_clip16,_clip3,_clip4,_clip5,_clip6,_clip10);
    var missleDisappear7 = new MissleDisappear(_clip17,_clip3,_clip4,_clip5,_clip6,_clip10);
    var missleDisappear8 = new MissleDisappear(_clip18,_clip3,_clip4,_clip5,_clip6,_clip10);
    var missleDisappear9 = new MissleDisappear(_clip19,_clip3,_clip4,_clip5,_clip6,_clip10);
    var missleDisappear10 = new MissleDisappear(_clip20,_clip3,_clip4,_clip5,_clip6,_clip10);
    var missleDisappear11 = new MissleDisappear(_clip21,_clip3,_clip4,_clip5,_clip6,_clip10);
    var missleDisappear12 = new MissleDisappear(_clip22,_clip3,_clip4,_clip5,_clip6,_clip10);

    I would approach it in much the same way as you would in java, by making getters and setters for all of your class variables.
    Getters being for returning the values, Setters being for setting them.
    So you would make a get function for the variable you want to access ala:
    function get1PhishBeenHit():boolean {
         return this.phish1BeenHit;
    Then to access the value of that variable from outwith the class:
    var result:boolean = ClassInstanceName.get1PhishBeenHit();

  • Using an array in one class from another

    If I create a new string array in a class, and then set the values in that class, how can I use these value in another class? The way I have tried is to create a new instance of the class that holds the array, but when thinking about it, if I create a new instance surely the value in the array wont have been set? hence why when I am trying to use the array all the values are null.
    Thanks

    You could create a member variable in one class, making the the variable of the other class' type. Then simply call one of the member object's methods, passing the array reference as an argument.

  • Referencing a method in one class from a constructor in another?

    Hi,
    I'm not sure whether this is a simple question or not, but instead of rewriting the method in another class, is there a way that I can reference that method, eg:
    public int getTitleCode() {
            return titleCode;  }within the constructor of another class. I don't want to use inheritance with this because it would change all my existing contructors.
    Any ideas how to do this, or is it just simpler to add the method to both classes?
    Many thanks!

    Hi,
    I'm trying to use a method, defined in Class A, within one of the constructors in Class B. Class B object represents a copy of the output of Class A, with the addition of a few extra methods.
    Therefore to represent the details correctly in the saved text file for class B, I need to call a method from class A to save the text file for class B correctly.
    Class B saves a file with a reference number unique to that class, plus a reference number that is also saved in the text file for class A.
    I can achieve the correct result for the above by having the same method in both classes, but I just wondered whether instead of this I could in fact call the method from class A in the constructor for class B. With the following code,
        referenceNumber = refNum;
            titleReferenceNumber = titleRefNum;
            titleRefNum = titles.getTitleCode();
        }I just get a 'nullpointerexception' when I try to run this in the main class.
    Any help or advice appreciated!

  • Transfer of Asset from one class to another

    Hi Friends,
    one asset has been created using wrong asset class.
    We haven't passed any dep run entries at all.
    I created another asset in correct asset class and tried to use ABUMN.
    Under Transfer:
    to existing asset - it does not allow me: error : retirement of old asset data not poss. actually i am not trying to retire the asset
    Under Transfer:
    to New asset - I am trying to use the correct asset class, it does not allow me, error: Enter asset number which is between X and Y (we have external no. range)
    Thanks for assistance
    Sanjay

    Hi,
    I am getting following error:
    Retirement of old assets data not possible (No existing old assets data)
    Message no. AA416
    Diagnosis
    You have tried to post an retirement based on amount, using a transaction type which refers to old assets data (acquisitions from previous years).
    However, the sum of the APC at the start of the fiscal year and the transactions, related to the past, equals 0.
    Procedure
    Check the transaction type entered and the asset.
    Thanks
    Sanjay

  • How can I create a Web Service with several classes

    Hello,
    I developed an API which I want to use to create a webService that offer an acces to all the classes and use all their methods.I tried this with Netbeans but I view that I will have a WSDL file for each class.
    But I have tested the yahoo api web service of the image search and it offer acces to several objects such us request and result.So I want to make a service that offer the use of several objects. Can I do this.If yes how ? Because I have read tutorials about WebServices and they mention that to create a webservice I must have an EndPoint class so only one class.
    Please I juste began with webservices so I don't know how to do.
    Thanks in advance.

    I don't believe this is possible when starting from Java. I think you need to start with a WSDL to get this to work. I am curious as to why having multiple WSDLs is an issue, would you care to eloborate.
    Thanks

  • Combining multiple programs into one class

    So I have three classes, each with a program that does something different. I have to combine all three of them into one class, that gives an initial user interface asking which of the three programs would the user like to run, then runs the chosen program. How do I combine all three program classes into one class and have them run in such a way.
    Everything must be within ONE class.

    I know that.
    My issue is actually doing it in a way that isn't really ugly. Right now I just used a few huge if statements and put all my programs in those. I need to break it up into separate...methods I think it is.
    Here's my ugly ugly code.
    import java.util.*;
    import java.text.*;
    public class AssignmentFour {
         public static void main(String[] args) {
              Scanner sc1 = new Scanner(System.in);
              System.out.println("What program would you like to run:" );
              System.out.println("1. Long Distance Charges ");
              System.out.println("2. Internet Provider Charges ");
              System.out.println("3. Math Tutor ");
              System.out.println("4. Quit ");
              System.out.println("=> ");
              String numb = sc1.next();
              int num1 = new Integer(numb).intValue();
              if (num1 == 1) {Scanner sc2 = new Scanner(System.in);
              System.out.print("Please Enter the Starting Time of your call: ");
              String clock = sc2.nextLine();
              Scanner sc3 = new Scanner(System.in);
              System.out.print("Please Enter the Length of your call: ");
              String length = sc3.nextLine();
              float clock1 = Float.parseFloat(clock);
              int length1 = new Integer (length).intValue();
              double cost1 = 0;
              if (clock1 < 6.59) {cost1 = 0.14;}
              if (clock1 < 19.00 && clock1 > 7.00) {cost1 = 0.42;}
              if (clock1 < 23.59 && clock1 > 7.01) {cost1 = 0.28;}
              if (clock1 > 0.59 && clock1 < 0.99) {System.out.println("Error! Improper input!");}
              if (clock1 > 1.59 && clock1 < 1.99) {System.out.println("Error! Improper input!");}
              if (clock1 > 2.59 && clock1 < 2.99) {System.out.println("Error! Improper input!");}
              if (clock1 > 3.59 && clock1 < 3.99) {System.out.println("Error! Improper input!");}
              if (clock1 > 4.59 && clock1 < 4.99) {System.out.println("Error! Improper input!");}
              if (clock1 > 5.59 && clock1 < 5.99) {System.out.println("Error! Improper input!");}
              if (clock1 > 6.59 && clock1 < 6.99) {System.out.println("Error! Improper input!");}
              if (clock1 > 7.59 && clock1 < 7.99) {System.out.println("Error! Improper input!");}
              if (clock1 > 8.59 && clock1 < 8.99) {System.out.println("Error! Improper input!");}
              if (clock1 > 9.59 && clock1 < 9.99) {System.out.println("Error! Improper input!");}
              if (clock1 > 10.59 && clock1 < 10.99) {System.out.println("Error! Improper input!");}
              if (clock1 > 11.59 && clock1 < 11.99) {System.out.println("Error! Improper input!");}
              if (clock1 > 12.59 && clock1 < 12.99) {System.out.println("Error! Improper input!");}
              if (clock1 > 13.59 && clock1 < 13.99) {System.out.println("Error! Improper input!");}
              if (clock1 > 14.59 && clock1 < 14.99) {System.out.println("Error! Improper input!");}
              if (clock1 > 15.59 && clock1 < 15.99) {System.out.println("Error! Improper input!");}
              if (clock1 > 16.59 && clock1 < 16.99) {System.out.println("Error! Improper input!");}
              if (clock1 > 17.59 && clock1 < 17.99) {System.out.println("Error! Improper input!");}
              if (clock1 > 18.59 && clock1 < 18.99) {System.out.println("Error! Improper input!");}
              if (clock1 > 19.59 && clock1 < 19.99) {System.out.println("Error! Improper input!");}
              if (clock1 > 20.59 && clock1 < 20.99) {System.out.println("Error! Improper input!");}
              if (clock1 > 21.59 && clock1 < 21.99) {System.out.println("Error! Improper input!");}
              if (clock1 > 22.59 && clock1 < 22.99) {System.out.println("Error! Improper input!");}
              if (clock1 > 23.59) {System.out.println("Error! Improper input!");}
              if (length1 < 300) {length1 = length1;}
              if (length1 < 1) {System.out.println("Error! Improper input!");}
              if (length1 > 300) {System.out.println("Error! Improper input!");}
              double finalcost = (cost1*length1);
              DecimalFormat format = new DecimalFormat("0.00");
              String finalcostprint = (format.format(finalcost) + " ");
              if (clock1 > 0.00 && clock1 < 0.59 && length1 < 300 && length1 > 0) {System.out.println("The charge for your call is " + finalcostprint + "");}
              if (clock1 > 1.00 && clock1 < 1.59 && length1 < 300 && length1 > 0) {System.out.println("The charge for your call is " + finalcostprint + "");}
              if (clock1 > 2.00 && clock1 < 2.59 && length1 < 300 && length1 > 0) {System.out.println("The charge for your call is " + finalcostprint + "");}
              if (clock1 > 3.00 && clock1 < 3.59 && length1 < 300 && length1 > 0) {System.out.println("The charge for your call is " + finalcostprint + "");}
              if (clock1 > 4.00 && clock1 < 4.59 && length1 < 300 && length1 > 0) {System.out.println("The charge for your call is " + finalcostprint + "");}
              if (clock1 > 5.00 && clock1 < 5.59 && length1 < 300 && length1 > 0) {System.out.println("The charge for your call is " + finalcostprint + "");}
              if (clock1 > 6.00 && clock1 < 6.59 && length1 < 300 && length1 > 0) {System.out.println("The charge for your call is " + finalcostprint + "");}
              if (clock1 > 7.00 && clock1 < 7.59 && length1 < 300 && length1 > 0) {System.out.println("The charge for your call is " + finalcostprint + "");}
              if (clock1 > 8.00 && clock1 < 8.59 && length1 < 300 && length1 > 0) {System.out.println("The charge for your call is " + finalcostprint + "");}
              if (clock1 > 9.00 && clock1 < 9.59 && length1 < 300 && length1 > 0) {System.out.println("The charge for your call is " + finalcostprint + "");}
              if (clock1 > 10.00 && clock1 < 10.59 && length1 < 300 && length1 > 0) {System.out.println("The charge for your call is " + finalcostprint + "");}
              if (clock1 > 11.00 && clock1 < 11.59 && length1 < 300 && length1 > 0) {System.out.println("The charge for your call is " + finalcostprint + "");}
              if (clock1 > 12.00 && clock1 < 12.59 && length1 < 300 && length1 > 0) {System.out.println("The charge for your call is " + finalcostprint + "");}
              if (clock1 > 13.00 && clock1 < 13.59 && length1 < 300 && length1 > 0) {System.out.println("The charge for your call is " + finalcostprint + "");}
              if (clock1 > 14.00 && clock1 < 14.59 && length1 < 300 && length1 > 0) {System.out.println("The charge for your call is " + finalcostprint + "");}
              if (clock1 > 15.00 && clock1 < 15.59 && length1 < 300 && length1 > 0) {System.out.println("The charge for your call is " + finalcostprint + "");}
              if (clock1 > 16.00 && clock1 < 16.59 && length1 < 300 && length1 > 0) {System.out.println("The charge for your call is " + finalcostprint + "");}
              if (clock1 > 17.00 && clock1 < 17.59 && length1 < 300 && length1 > 0) {System.out.println("The charge for your call is " + finalcostprint + "");}
              if (clock1 > 18.00 && clock1 < 18.59 && length1 < 300 && length1 > 0) {System.out.println("The charge for your call is " + finalcostprint + "");}
              if (clock1 > 19.00 && clock1 < 19.59 && length1 < 300 && length1 > 0) {System.out.println("The charge for your call is " + finalcostprint + "");}
              if (clock1 > 20.00 && clock1 < 20.59 && length1 < 300 && length1 > 0) {System.out.println("The charge for your call is " + finalcostprint + "");}
              if (clock1 > 21.00 && clock1 < 21.59 && length1 < 300 && length1 > 0) {System.out.println("The charge for your call is " + finalcostprint + "");}
              if (clock1 > 22.00 && clock1 < 22.59 && length1 < 300 && length1 > 0) {System.out.println("The charge for your call is " + finalcostprint + "");}
              if (clock1 > 23.00 && clock1 < 23.59 && length1 < 300 && length1 > 0) {System.out.println("The charge for your call is " + finalcostprint + "");}
              if (num1 == 2) {
                   Scanner sc4 = new Scanner(System.in);
                   System.out.print("Enter customer billing information (First Name Last Name Package Hours Used): ");
                   String firstname = sc1.next();
                   String lastname = sc1.next();
                   String package1 = sc1.next();
                   String hours = sc4.next();
                   String packaged = package1.substring(0,1);
                   int hour = new Integer(hours).intValue();
                   double costa = (12.95 + 1.50*(hour-10));
                   double costb = (16.95 + 0.85*(hour-20));
                   double costc = (29.95);
                   char pack = packaged.charAt(0);
                   double cost = 0;
                   char A = 'A';
                   char B = 'B';
                   char C = 'C';
                   if (pack == A) {cost = 12.95 + 1.50*(hour-10);}
                   if (pack == B) {cost = 16.95 + 0.85*(hour-20);}
                   if (pack == C) {cost = 29.95;}
                   DecimalFormat format = new DecimalFormat("0.00");
                   String costprint = (format.format(cost));
                   if (pack == A) {System.out.println("Charges for " + firstname + " " + lastname + " (" + package1 + ") are $" + costprint + "");}
                   if (pack == B) {System.out.println("Charges for " + firstname + " " + lastname + " (" + package1 + ") are $" + costprint + "");}
                   if (pack == C) {System.out.println("Charges for " + firstname + " " + lastname + " (" + package1 + ") are $" + costprint + "");}
                   double saved = 0;
                   float costprinty = new Float(costprint).intValue();
                   if (costprinty>costa) {saved = cost - costa;}
                   if (costprinty>costb) {saved = cost - costb;}
                   if (costprinty>costc) {saved = cost - costc;}
                   char packy = 'A';
                   if (cost>costa) {packy = A;}
                   if (cost>costb) {packy = B;}
                   if (cost>costc) {packy = C;}
                   if (cost>costa && cost>costb && costa>costb) {saved = cost - costb;}
                   if (cost>costa && cost>costb && costb>costa) {saved = cost - costa;}
                   if (cost>costa && cost>costc && costa>costc) {saved = cost - costc;}
                   if (cost>costa && cost>costc && costb>costa) {saved = cost - costa;}
                   if (cost>costb && cost>costc && costb>costc) {saved = cost - costc;}
                   if (cost>costb && cost>costc && costc>costb) {saved = cost - costb;}
                   DecimalFormat format2 = new DecimalFormat("0.00");
                   String savey = (format.format(saved));
                   if (saved > 0) {System.out.println("" + firstname + " " +lastname+ " could have saved $" + savey + " by switching to package " + packy + ".");
                   if (num1 == 3) {
                        Random r = new Random();
                        int a = r.nextInt(99);
                        int b = r.nextInt(99);
                        int c = (a + b);
                        int d = (a * b);
                        int z = r.nextInt(2);
                   Scanner sc5 = new Scanner(System.in);
                   if (z == 0) System.out.print("" + a + " + " + b + " = ");
                   if (z == 1) System.out.print("" + a + " * " + b + " = ");
                   String answer = sc5.next();
                   int answery = new Integer(answer).intValue();
                   if (c == answery && z == 0) {System.out.println("Congratulations! You are a math whiz!");}
                   else if (d == answery && z == 1) {System.out.println("Congratulations! You are a math whiz!");}
                   else {System.out.println("Wrong!");}
                   if (num1 == 4) {
                        System.out.println("Goodbye");
                   else {System.out.println("Improper input!");
    }

  • Stock transport orders within one plant

    Hi all,
    I am wondering how to process a stock transport order, that is created to transfer stock within one plant (from one stor.loc to another). My general scope is to use the shipping module to process the logistic part of that transaction.
    So I created a stock transport order (purch. order type UB) where the shipping plant and the receiving plant are identical. Now I can't create the delivery note (VL10B does not show the order. In SAP docu, I found only a hint that a STO can be also used within one plant, but how to create the delivery note?
    Thanks to all for answers
    Jörg

    Hi
    Please go thru the following navigation to set up STO between Storage location with delivery.
    SPRO-> Material management -> Purchasing -> Purchase order -> Set up stock transport order -> step up stock transport order between storage locations
    In first step Activate Stock transfer between storage locations and do other configurations.
    Regards
    Ramakrishna

  • Problem in creating a model window

    Hi,
    I am trying to open a window on the click of the button and I am getting the following error
    Parameter windowInfo must not be null.
    this is the code i wrote to open the window
    IWDWindow excelLinkWindow;
    try{
                   wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("excel"+wdComponentAPI.getComponentInfo());
                excelLinkWindow =
                wdComponentAPI.getWindowManager().createModalWindow(
                wdComponentAPI.getComponentInfo().findInWindows("Popup"));
                excelLinkWindow.setWindowPosition(WDWindowPos.CENTER);
                excelLinkWindow.setWindowSize(500, 1500);
                excelLinkWindow.open();
              }catch(Exception e ){
                   wdThis.wdGetAPI().getComponent().getMessageManager().reportException("error"+e.getMessage(),false);
    Please let me know the solution

    HI
    1.Create another new window named "Popup". Embed dynpro view in data navigator of this window (if view is in same component) else use "Embed interface view for a component instance",if view is from another component.
    2. create a WinInstance Node of cardinality 1:1 and node element of java native type IWDWindow. in both primary and popup views.
    3. Create mapping.
    4. Create an action In caller view and write this piece of code in it.
    IWDWindowInfo winInfo = wdComponentAPI.getComponentInfo().findInWindows("Popup");
         IWDWindow window = wdComponentAPI.getWindowManager().createModalWindow(winInfo);
         window.setTitle(" Purchase Order Unit");
         window.setWindowPosition(WDWindowPos.CENTER);
         *wdContext.currentWindowInstanceElement().setWinInstance(window);* // To handle called popup window
         window.show();
    5. create a closeWindow Action in popup window and write this line to destroy window Instance.
    wdContext.currentWinInstanceElement().getWinInstance().destroyInstance();
    6. Right click on window name and choose properties then from properties copy window name and paste in your code i.e findInWindows("Popup"); This is just to ensure that there will be no typing error.
    Thanks,
    Mandeep Virk

  • Calling a method within a class form another class(ViewController)

    I am creating an SQL project in XCODE. I have one view. My main view controller is loading the database to a table/array. I want to add another class (with no NIB) just to handle the display of the table in a UITableView. So, I added a skeleton cocoa touch class file to my classes folder to handle this function when parameters change.
    So, in my app delegate, the "applicationdidFinishLaunchingWithOptions" method loads my mainViewController and NIB.  On the "viewDidLoad" method in my mainViewController, I read a URL into an SQLite database and close the database.  Herein lies the problem: I want to call my new class (TableViewHandler) and pass it the array created in the mainViewController and use the array to populate the UITable.
    How do I call a class from within another class (which has no NIB) to populate the table?  Especially if my TableViewHandler has no "viewDidLoad", "viewDidAppear", etc.
    Regads,
    -Kevin

    This is what my exact problem.
    i've created a bean (DataBean) to access the database. i'm having a servlet program (ShopBook). now to check some details over there in the database from the servlet i'm in need to use a method in the DataBean.
    both ShopBook.java and DataBean.java lies in the package shoppack.
    in ShopBook i tried to instantiate the object to DataBean as
    DataBean db = new DataBean();
    it shows the compiler error, unable to resolve symbol DataBean.
    note:
    first i compiled DataBean.java, it got compiled perfectly and the class file resides inside the shoppack.
    when i'm trying to compile the ShopBook its telling this error.
    hope i'm clear in explaining my problem. can u please help me?
    thank u in advance.
    regards,
    Fazli

  • Calling a method of one class from another withing the same package

    hi,
    i've some problem in calling a method of one class from another class within the same package.
    for eg. if in Package mypack. i'm having 2 files, f1 and f2. i would like to call a method of f2 from f1(f1 is a servlet) . i donno exactly how to instantiate the object for f2. can anybody please help me in this regard.
    Thank u in advance.
    Regards,
    Fazli

    This is what my exact problem.
    i've created a bean (DataBean) to access the database. i'm having a servlet program (ShopBook). now to check some details over there in the database from the servlet i'm in need to use a method in the DataBean.
    both ShopBook.java and DataBean.java lies in the package shoppack.
    in ShopBook i tried to instantiate the object to DataBean as
    DataBean db = new DataBean();
    it shows the compiler error, unable to resolve symbol DataBean.
    note:
    first i compiled DataBean.java, it got compiled perfectly and the class file resides inside the shoppack.
    when i'm trying to compile the ShopBook its telling this error.
    hope i'm clear in explaining my problem. can u please help me?
    thank u in advance.
    regards,
    Fazli

  • Object Creation Of One class into another and vice versa

    Hello Everyone,
    My name is Prashant Sharma from Jaipur [Rajasthan]
    Can u people help me
    How to create of one class into another and vice versa
    Eg,
    I am having class A and class B
    I want to create object of class A into class B and vice versa
    Plz help me out of this problem as soon as possible....

    Read this: [Creating Objects|http://java.sun.com/docs/books/tutorial/java/javaOO/objectcreation.html]
    Then, do one of these three:
    1. Create an instance of the class
    2. Extend the class
    3. Access methods within the class
    Try it out. Post the problem code if you're having trouble.

  • Is it possible to call methods from another class from within an abstract c

    Is it possible to call methods from another class from within an abstract class ?

    I found an example in teh JDK 131 JFC that may help you. I t is using swing interface and JTable
    If you can not use Swing, then you may want to do digging or try out with the idea presented here in example 3
    Notice that one should refine the abstract table model and you may want to create a method for something like
    public Object getValuesAtRow(int row) { return data[row;}
    to give the desired row and leave the method for
    getValuesAt alone for getting valued of particaular row and column.
    So Once you got the seelcted row index, idxSelctd, from your table
    you can get the row or set the row in your table model
    public TableExample3() {
    JFrame frame = new JFrame("Table");
    frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {System.exit(0);}});
    // Take the dummy data from SwingSet.
    final String[] names = {"First Name", "Last Name", "Favorite Color",
    "Favorite Number", "Vegetarian"};
    final Object[][] data = {
         {"Mark", "Andrews", "Red", new Integer(2), new Boolean(true)},
         {"Tom", "Ball", "Blue", new Integer(99), new Boolean(false)},
         {"Alan", "Chung", "Green", new Integer(838), new Boolean(false)},
         {"Jeff", "Dinkins", "Turquois", new Integer(8), new Boolean(true)},
         {"Amy", "Fowler", "Yellow", new Integer(3), new Boolean(false)},
         {"Brian", "Gerhold", "Green", new Integer(0), new Boolean(false)},
         {"James", "Gosling", "Pink", new Integer(21), new Boolean(false)},
         {"David", "Karlton", "Red", new Integer(1), new Boolean(false)},
         {"Dave", "Kloba", "Yellow", new Integer(14), new Boolean(false)},
         {"Peter", "Korn", "Purple", new Integer(12), new Boolean(false)},
         {"Phil", "Milne", "Purple", new Integer(3), new Boolean(false)},
         {"Dave", "Moore", "Green", new Integer(88), new Boolean(false)},
         {"Hans", "Muller", "Maroon", new Integer(5), new Boolean(false)},
         {"Rick", "Levenson", "Blue", new Integer(2), new Boolean(false)},
         {"Tim", "Prinzing", "Blue", new Integer(22), new Boolean(false)},
         {"Chester", "Rose", "Black", new Integer(0), new Boolean(false)},
         {"Ray", "Ryan", "Gray", new Integer(77), new Boolean(false)},
         {"Georges", "Saab", "Red", new Integer(4), new Boolean(false)},
         {"Willie", "Walker", "Phthalo Blue", new Integer(4), new Boolean(false)},
         {"Kathy", "Walrath", "Blue", new Integer(8), new Boolean(false)},
         {"Arnaud", "Weber", "Green", new Integer(44), new Boolean(false)}
    // Create a model of the data.
    TableModel dataModel = new AbstractTableModel() {
    // These methods always need to be implemented.
    public int getColumnCount() { return names.length; }
    public int getRowCount() { return data.length;}
    public Object getValueAt(int row, int col) {return data[row][col];}
    // The default implementations of these methods in
    // AbstractTableModel would work, but we can refine them.
    public String getColumnName(int column) {return names[column];}
    public Class getColumnClass(int col) {return getValueAt(0,col).getClass();}
    public boolean isCellEditable(int row, int col) {return (col==4);}
    public void setValueAt(Object aValue, int row, int column) {
    data[row][column] = aValue;
    };

Maybe you are looking for

  • RMAN backup files are still exist since long time, how to delete?

    Dear sir; I'm using the below script to do daily backup, however there are many rman backup files are still exist and consumes HD size, how could I delete these files in daily bases? some files dated in FEB, MAR, APR, ============Daily RMAN script===

  • Instances not visible in Oracle BPEL Control 10.1.3.4

    Hi , I am having a problem in looking for the list of instances under the "Instances" tab. I have no issues with the process execution tough . In the run up to this installation I have done the following things 1) Installed the SOA 10.1.3.1 2) Ran th

  • Running iLife 06 and iLife 08 together

    I was just curious - plan to buy an Intel machine early next year. Could I post things on my web site using iLife 08 on the new computer and also post things on the same web site using iLife 06, which will be left on the old computer? Or do I have to

  • Dimension and fact column types

    Hi All I'm studying data ware housing concept and using book Training Kit Exam 70-463  but I'm unable to understand the following topics. --Column types in Dimension --Column Types in Fact I tried to Google these topics but I cannot find any good exp

  • Group link issue with JHS 11.1.1.3.35

    Hi guys, I've just upgraded our current project to JHeadstart 11.1.1.3.35. Well done on the release ! Each time I find myself needing less and less custom coding in templates :) My 2 favourite features are calling an AM method from a JHeadstart comma