Sorry, here's the code for 2 solution in writing a pdf to file

//First solution
String outfile = "D:\\At Work\\Tags\\Release 3.7\\2476\\output.pdf";
PdfReader r1 = new PdfReader("D:\\At Work\\Tags\\Release 3.7\\2476\\textfield.pdf");
PdfStamper stamper = new PdfStamper(r1,new FileOutputStream(outfile));
stamper.close();
//Second Solution
String outfile = "D:\\At Work\\Tags\\Release 3.7\\2476\\output.pdf";
PdfReader r = new PdfReader("D:\\At Work\\Tags\\Release 3.7\\2476\\textfield.pdf");
PdfCopyFields copy = new PdfCopyFields(new FileOutputStream(outfile));
copy.addDocument(this);
copy.close();

Please use reply, not post new threads.

Similar Messages

  • I have the code for this project, but how do I add this user-defined exception that I want?

    For a final VB.NET project, I have to write a project that ascends and descends a word or number chosen by the user. 
    This is what I want to do:
    I want to add a user defined error that will stop the program and tell the user to input a value into the program if they did not. I do not know how to do this. I think I would use a Null Reference exception. 
    Here is the code for the project:
    Module Module1 'VB.NET Final Project 12/30/14 . Option 3: Write a program to run two separate threads printing numbers or words (It can do both) in ascending and descending orders. The words have to be given by the user.
        Dim Ascending As System.Threading.Thread = New Threading.Thread(AddressOf PrintAscend) 'Two threads are declared,
        Dim Descending As System.Threading.Thread = New Threading.Thread(AddressOf PrintDescend) 'ascending and descending 
        Sub Main()
            Console.WriteLine("VB.NET Final Project 12/30/14 . Option 3: Write a program to run two separate threads printing numbers or words (It can do both) in ascending and descending orders. The words have to be given by the user.")
            Ascending.Start() 'starts first thread
        End Sub
        Sub PrintAscend()
            Console.WriteLine("Please type in a word to print in ascending order.") 'the program asks for users to input a word
            Dim input As String 'as a string
            input = Console.ReadLine()
            For i As Integer = 0 To input.Length - 1
                Console.WriteLine(input.Chars(i)) 'prints the letters of the word in ascending order 
            Next
            If Ascending.ThreadState = Threading.ThreadState.Running Then Descending.Start() 'starts second thread
        End Sub
        Sub PrintDescend()
            Console.WriteLine("Please type in a word or number to print in descending order.")
            Dim input As String
            input = Console.ReadLine() 'user inputs the word that he wants
            For i As Integer = input.Length - 1 To 0 Step -1
                Console.WriteLine(input.Chars(i)) 'prints the letters of the word in descending order 
            Next
            Console.WriteLine("Please press enter key to close the program, and thanks for your time.")
            Console.ReadKey()
        End Sub
    End Module

    Dejavu again?
    Is your teacher instructing you to use a User Defined
    error or do you just want to accept the user input, check it, give a message, and repeat?
    It seems to me you are missing the basic program loop? This example checks the user input and then performs an action, then repeats. If the user enters Quit execution stops. Is that what you want to do?
    Module Module1
    Sub Main()
    Console.Title = "Make a Decision"
    Dim theline As String = ""
    Do While theline <> "Quit"
    Console.WriteLine(vbLf & "Enter a or b." & vbLf)
    theline = Console.ReadLine()
    Select Case theline
    Case "a", "A"
    Console.WriteLine(vbLf & ">> Result: You entered A.")
    Console.WriteLine(vbLf & " ** Output Complete **" & vbLf)
    Case "b", "B"
    Console.WriteLine(vbLf & ">> Result: You entered B.")
    Console.WriteLine(vbLf & " ** Output Complete **" & vbLf)
    Case Else
    Console.WriteLine(vbLf & """" & theline & """ is invalid.")
    End Select
    Loop
    End Sub

  • Streamlining the code for the button group with individual links and rollover imgs

    I am looking for a solution to streamline the code for the array of 20+  buttons located inside the scroll pane.
    I know I can make an array if all the buttons would have a unified code executable change, i.e. they would become larger and brighter.
    My problem is that each button represents an product image in the lights off stage, then of rollover it is a lights on stage so I have to import two images in the on and off stage and play around with the opacity.
    Additional problem is that each button has to ling to a different label.
    My question is: is it possible to unify the code if buttons have that much individuality or I have to make each one of them as in the example below.
    // makes a hand cursor appear over a mc acting as a button for all the buttons inside the scrollpnaeBckgrnd_mc.scrollpaneBckgrnd_btns_mc.
    MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.buttonMode = true;
    MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.useHandCursor = true;
    ///////////////INDIVIDUAL BUTTONS
              MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.FloraLyte _btn.FloraLyte_ON.alpha = 0;
                        var  FloraLyte_btn_Tween:TweenLite = TweenLite.to(MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.F loraLyte_btn.FloraLyte_ON, .5, {alpha:1, paused:true});
                        MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.Flor aLyte_btn.addEventListener(MouseEvent.ROLL_OVER, overHandler_FloraLyte_btn);
                        MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.Flor aLyte_btn.addEventListener(MouseEvent.ROLL_OUT, outHandler_FloraLyte_btn);
            MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.FloraLyte_btn. addEventListener(MouseEvent.CLICK, onClick_floralytePopUp);
                      function onClick_floralytePopUp(event:MouseEvent) :void {
                                            gotoAndPlay("floralytepp");
    function overHandler_FloraLyte_btn(e:MouseEvent):void{
             FloraLyte_btn_Tween.play();
             trace("you rolled over me");
    function outHandler_FloraLyte_btn(e:MouseEvent):void{
             FloraLyte_btn_Tween.reverse();
             trace("you rolled off me");
    MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.FloraLytell_btn .FloraLytell_ON.alpha = 0;
                        var  myTween:TweenLite = TweenLite.to(MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.F loraLytell_btn.FloraLytell_ON, .5, {alpha:1, paused:true});
                        MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.Flor aLytell_btn.addEventListener(MouseEvent.ROLL_OVER, overHandler);
                        MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.Flor aLytell_btn.addEventListener(MouseEvent.ROLL_OUT, outHandler);
            MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.FloraLytell_bt n.addEventListener(MouseEvent.CLICK, onClick_floralytellPopUp);
                      function onClick_floralytellPopUp(event:MouseEvent) :void {
                                            gotoAndPlay("floralyte2pp");
              function overHandler(e:MouseEvent):void{
             myTween.play();
             trace("you rolled over me");
              function outHandler(e:MouseEvent):void{
             myTween.reverse();
             trace("you rolled off me");

    as ned suggested, plan your flow and code into it. here is one example:
    var buttonArray = [someButton, someOtherButton, aDifferentButton];
    for(var i = 0; i < buttonArray.length; i++){
         //get reference to county movieclip
         var mc = buttonArray[i];
         //then add listeners
         mc.addEventListener(MouseEvent.ROLL_OVER, overMe);
    function overMe(e:MouseEvent){
         var mc = e.target;
         switch(mc){
              case: someButton:
                       someOtherButton:   doThis();
                                                     break;
              case: aDifferentButton:     doThat();
                                                     break;
              default:                            //do nothing;
                                                     break;
    function doThis(){
         trace("do this")
    function doThat(){
         trace("do that")

  • Problem in fetching the code for the line item

    Hi,
    I am working on a report in which to display the values corresponding to the line item of a PO.
    For, ex, if there are 3 line items 10,140,150 and their condition values such zing,zgrd,zbrd are the condition types consist of different values depending on the line item i.e. 10,140,150.
    My problem is when i execute the code the data of 1st line item is correctly fetched but the rest 2 line item data is pasted as it is. only the main pricre changes and the code for zing,zbrd,zgrd remains same as it is in the first line item 10.
    plzz proivde me guide lines how to solve this problem.
    Here's d code:-
    DATA : vspl LIKE konv-kbetr.
    DATA : vspl1 LIKE konv-kbetr.
    DATA : vkwert LIKE konv-kwert.
    DATA: VSPL2 LIKE KONV-kbetr.    "ZING COST
    DATA: VSPL3 LIKE KONV-kbetr.    "ZGRD COST
    DATA: VSPL4 LIKE KONV-kbetr.    "ZBDL COST
    LOOP AT item.
        SELECT kbetr FROM konv INTO item-rate  WHERE knumv = header-knumv AND kposn = item-ebelp
         AND ( kschl = 'ZP00' OR kschl = 'P001' OR kschl = 'PBXX' OR kschl = 'P000' OR kschl = 'PB00' OR kschl = 'ZING' OR kschl = 'ZBRD' OR kschl = 'ZGRD').
          MODIFY item.
       ENDSELECT.
      ENDLOOP.
      LOOP AT item.
        SELECT kwert FROM konv INTO vkwert  WHERE knumv = header-knumv AND kposn = item-ebelp
        AND ( kschl = 'ZP00' OR kschl = 'P001' OR kschl = 'PBXX' OR kschl = 'P000' OR kschl = 'PB00' OR kschl = 'ZING' OR kschl = 'ZBRD' OR kschl = 'ZGRD').
        ENDSELECT.
      ENDLOOP.
    CLEAR : vspl , vspl1 , vspl2 , vspl3 , vspl4.
      LOOP AT item.
        SELECT kbetr FROM konv INTO vspl  WHERE knumv = header-knumv AND kposn = item-ebelp  
       AND  kschl = 'ZCOM'.
        ENDSELECT.
        SELECT kbetr FROM konv INTO vspl1 WHERE knumv = header-knumv AND kposn = item-ebelp
        AND  kschl = 'ZBR1'.
        ENDSELECT.
    *******************Begin - new code added on 14.01.2009******************
        SELECT kbetr FROM konv INTO vspl2 WHERE knumv = header-knumv AND kposn = item-ebelp
        AND  kschl = 'ZING'.
        ENDSELECT.
       SELECT kbetr FROM konv INTO vspl3 WHERE knumv = header-knumv AND kposn = item-ebelp
       AND  kschl = 'ZGRD'.
        ENDSELECT.
       SELECT kbetr FROM konv INTO vspl4 WHERE knumv = header-knumv AND kposn = item-ebelp
       AND  kschl = 'ZBRL'.
       ENDSELECT.
    *******************End - new code added on 14.01.2009******************
      ENDLOOP.
      LOOP AT item.
        item-rate  = item-rate + vspl + vspl1.
    *******************Begin - new code added on 14.01.2009******************
        item-rate1 = item-rate1 + vspl2.
        item-rate2 = item-rate2 + vspl3.
        item-rate3 = item-rate3 + vspl4.
    ********************End - new code added on 14.01.2009*******************
        MODIFY item INDEX sy-tabix TRANSPORTING rate.
    *******************Begin -11`` new code added on 14.01.2009******************
        MODIFY item INDEX sy-tabix TRANSPORTING rate1.
        MODIFY item INDEX sy-tabix TRANSPORTING rate2.
        MODIFY item INDEX sy-tabix TRANSPORTING rate3.
    *********************End - new code added on 14.01.2009******************
      ENDLOOP.
    PLZ PROIVDE ME GUIDLINES HOW TO SOLVE THIS PROBLEM .
    Edited by: ricx .s on Jan 19, 2009 10:16 AM
    Edited by: Vijay Babu Dudla on Jan 19, 2009 5:22 AM

    Hello,
    Why are you looping at the same internal table so many times, you could probably perform everything within one loop instead.
    DATA : vspl LIKE konv-kbetr.
    DATA : vspl1 LIKE konv-kbetr.
    DATA : vkwert LIKE konv-kwert.
    DATA: VSPL2 LIKE KONV-kbetr. "ZING COST
    DATA: VSPL3 LIKE KONV-kbetr. "ZGRD COST
    DATA: VSPL4 LIKE KONV-kbetr. "ZBDL COST
    field-symbols <fs>.
    LOOP AT item assigning <fs>.
    SELECT kbetr FROM konv INTO <fs>-rate WHERE knumv = header-knumv AND kposn = item-ebelp
    AND ( kschl = 'ZP00' OR kschl = 'P001' OR kschl = 'PBXX' OR kschl = 'P000' OR kschl = 'PB00' OR kschl = 'ZING' OR kschl = 'ZBRD' OR kschl = 'ZGRD').
    MODIFY item.
    ENDSELECT.
    SELECT kwert FROM konv INTO vkwert WHERE knumv = header-knumv AND kposn = item-ebelp
    AND ( kschl = 'ZP00' OR kschl = 'P001' OR kschl = 'PBXX' OR kschl = 'P000' OR kschl = 'PB00' OR kschl = 'ZING' OR kschl = 'ZBRD' OR kschl = 'ZGRD').
    ENDSELECT.
    ENDLOOP.
    CLEAR : vspl , vspl1 , vspl2 , vspl3 , vspl4.
    SELECT kbetr FROM konv INTO vspl WHERE knumv = header-knumv AND kposn = item-ebelp
    AND kschl = 'ZCOM'.
    ENDSELECT.
    SELECT kbetr FROM konv INTO vspl1 WHERE knumv = header-knumv AND kposn = item-ebelp
    AND kschl = 'ZBR1'.
    ENDSELECT.
    *******************Begin - new code added on 14.01.2009******************
    SELECT kbetr FROM konv INTO vspl2 WHERE knumv = header-knumv AND kposn = item-ebelp
    AND kschl = 'ZING'.
    ENDSELECT.
    SELECT kbetr FROM konv INTO vspl3 WHERE knumv = header-knumv AND kposn = item-ebelp
    AND kschl = 'ZGRD'.
    ENDSELECT.
    SELECT kbetr FROM konv INTO vspl4 WHERE knumv = header-knumv AND kposn = item-ebelp
    AND kschl = 'ZBRL'.
    ENDSELECT.
    *******************End - new code added on 14.01.2009******************
    <fs>-rate = <fs>-rate + vspl + vspl1.
    *******************Begin - new code added on 14.01.2009******************
    <fs>-rate1 = item-rate1 + vspl2.
    <fs>-rate2 = item-rate2 + vspl3.
    <fs>-rate3 = item-rate3 + vspl4.
    ENDLOOP.
    Also, use field-symbols and use loop at itab assigning addition so that you can directly change the contents of the table without using modify statment.
    regards,
    Advait

  • I scratched the label off on a £25 gift card and it removed the code. How can I get the code for the card?

    I scratched the label off on a £25 gift card and it removed the code. How can I get the code for the card?

    Click here and request assistance. Gift cards are usually if not always final sale because it would be easy enough for someone dishonest to abuse returns or replacements of them.
    (58640)

  • Facing problem with the code for sending an .xls attachment via email, a field value contains leading zeros but excel automatically removes these from display i.e. (00444 with be displayed as 444).kindly guide .

    Facing problem with the code for sending an .xls attachment via email, a field value contains leading zeros but excel automatically removes these from display i.e. (00444 with be displayed as 444).kindly guide .

    Hi Chhayank,
    the problem is not the exported xls. If you have a look inside with Notepad or something like that, you will see that your leading zeros are exported correct.Excel-settings occurs this problem, it is all about how to open the document. If you use the import-assistant you will have no problems because there are options available how to handle the different columns.
    Another solution might be to get familiar with ABAP2XLS-Project. I got in my mind, that there is a method implemented, that will help you solving this problem. But that is not a five minute job
    ~Florian

  • Please Please Help with Projectile Project Here are the Codes

    I've got three(3) classes a Model, a view, and a controller.
    This is a project about projectiles.it is an animation of a cannonball being fired from a cannon and travelling under the effect of gravity.A cannon fired at angle 'a' to the horizontal and with an initial speed 's', will have an initial velocity given by:
    vx := s * cos(a);//velocity x equals the speed multiply by the cosine of angle a.
    vy := s * sin(a);//velocity y equals the speed multiply by the sine of angle a.
    Here are the code.
    Model:
    /** Cannon specifies the expected behaviour of a cannon*/
    public class Cannon{
    public static final int TICK = 60;
    private int velocity = 0;
    private static final double gravity = .098f;
    private double angle = 0;
    // distances & positions are meausred in pixels
    private int x_pos; // ball's center x-position
    private int y_pos; // ball's center y-position
    // speed is measured in pixels per `tick'
    private int x_velocity; // horizonal speed; positive is to the right
    private int y_velocity; // vertical speed; positive is downwards
    public Cannon() {
    velocity = 3;
    angle = 60;
    angle = radians(angle);
    x_pos = 0;
    y_pos = 385;
    /** shoot fires a shot from the cannon*/
    public void shoot(){
    move();
    /**reload reloads the cannon with more shorts*/
    public void reload() {
    /** changeAngle changes the angle of the canon
    * @params value - the amount to add or subtract from the current angle value*/
    public void changeAngle(double value) {
    angle = (double)value;
    angle = radians(angle);
    /** getAngle returns the current angle value of the cannon*/
    public double getAngle() {
    return angle;
    /** changeVelocity changes the speed at which a cannon ball that is to be fire will travel at
    * @params value - the new speed at which the user wants a cannon ball to travel at.*/
    public void changeVelocityX(int value){
    x_velocity = x_velocity * (int)Math.cos(value);
    public void changeVelocityY(int value){
    y_velocity = y_velocity * (int)Math.sin(value);
    /** getVelocity returns the current velocity value of the cannon*/
    public int getVelocityX() {
    return x_velocity;
    public int getVelocityY() {
    return y_velocity;
    /** getGravity returns the current gravity value of the cannon*/
    public double getGravity() {
    return gravity;
    public int xPosition(){
    return x_pos;
    public int yPosition(){
    return y_pos;
    public void move(){
    double dx = getVelocityX() * Math.cos(getAngle());
    double dy = getVelocityY() * Math.sin(getAngle());
    x_pos+=dx;
    y_pos-=dy;
    double radians (double angle){
    return ((Math.PI * angle) / 180.0);
    View:
    import java.awt.*;
    import javax.swing.*;
    /** CannonView displays a cannon being fired.*/
    public class CannonView extends JPanel{
    /** DISPLAY_SIZE specifies the overall display area of the cannon and the bucket.*/
    public static final int DISPLAY_AREA_SIZE = 600;
    public RotatablePolygon rectangle;
    public RotatablePolygon triangle;
    public Cannon cannon;
    public CannonView(Cannon c) {
    this.setPreferredSize(new Dimension(600,450));
    this.setBackground(Color.black);
    cannon = c;
    int xRectangle[] = {0,0,40,40,0};
    int yRectangle[] = {400,300,300,400,400};
    int xTriangle[] = {0,20,40,0};
    int yTriangle[] = {300,280,300,300};
    rectangle = new RotatablePolygon (xRectangle, yRectangle, 5,20,350);
    // rectangle.setPosition (100, 100);
    // triangle = new RotatablePolygon (xTriangle, yTriangle, 4,0,290);
    triangle = new RotatablePolygon (xTriangle, yTriangle, 4,20,350);
    //triangle.setPosition (100, 100);
    JFrame frame = new JFrame();
    frame.getContentPane().add(this);
    frame.pack();
    frame.setVisible(true);
    frame.setTitle("Width = " + frame.getWidth() + " , Height = " + frame.getHeight());
    /** drawBucket draws a bucket/target for which a moving cannon ball should hit.
    * @param g - the graphics pen for which the drawing should occur.*/
    public void drawBucket(Graphics g) {
    g.setColor(Color.red);
    int xvalues[] = {495, 519, 575, 595, 495};
    int yvalues[] = {340, 400, 400, 340, 340};
    Polygon poly1 = new Polygon (xvalues, yvalues, 5);
    g.fillPolygon(poly1);
    g.setColor(Color.white);
    g.fillOval(495, 328, 100, 24);
    Graphics2D g2d = (Graphics2D)g;
    g2d.setStroke(new BasicStroke(2));
    g.setColor(Color.red);
    g.drawOval(495, 328, 100, 24);
    g.drawOval(495,311,100,54);
    /** drawCannon draws a cannon
    * @param g - the graphics pen that will be used to draw the cannon.*/
    public void drawCannon(Graphics g) {
    Graphics2D g2 = (Graphics2D)g;
    g.setColor(Color.red);
    g2.fill(rectangle);
    g.setColor(Color.orange);
    g2.fill(triangle);
    g.setColor(Color.blue);
    g.fillOval(95, 340, 60, 60);
    g.setColor(Color.magenta);
    for (int i = 0; i < 6; i++){
    g.fillArc(95, 340, 60, 60, i* 60, 30);
    g.setColor(Color.black);
    g.fillOval(117, 362, 16, 16);
    /** drawCannonShots will draw the actual number of shots already used by the cannon
    * @param g - the graphics pen that will be used to draw the shots of the cannon.*/
    public void drawCannonShots(Graphics g) {
    g.setColor(Color.orange);
    g.fillOval(cannon.xPosition(),cannon.yPosition(),16,16);
    /** drawTrail will draw a trail of smoke to indicate where a cannon ball has passed
    * @param g - the graphics pen used to draw the trail.*/
    public void drawTrail(Graphics g){}
    /**drawGround draws the ground for which the cannon sits*/
    public void drawGround(Graphics g) {
    g.setColor(Color.green.brighter());
    g.fillRect(0,400,600,50);
    /** drawMovingCannonBall draw a cannon ball moving at a certain speed (velocity),
    * with a certain amount of gravitational acting upon it, at a certain angle.
    * @params g - the graphics pen used to draw the moving cannon ball.
    * @params gravity - the value of gravity.
    * @params velocity - the speed at which the ball is travelling.
    * @params angle - the angle at which the ball was shot from.*/
    public void drawMovingCannonBall(Graphics g, double gravity, double velocity, double angle){}
    /** paintComponent paints the cannon,bucket
    * @param g - graphics pen.*/
    public void paintComponent(Graphics g) {
    super.paintComponent(g);
    drawGround(g);
    drawBucket(g);
    drawCannon(g);
    drawCannonShots(g);
    Controller
    /** CannonController controls the interaction between the user and a cannon*/
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class CannonController extends JFrame{
    public JMenuBar jMenuBar2;
    public JMenu jMenu2;
    public JMenuItem jMenuItem1;
    public JMenu jMenu3;
    public JMenuItem jMenuItem2;
    public JLabel angleLabel, velocityLabel;
    public JTextField angleTextField, velocityTextField;
    public JButton fireButton, reloadButton;
    public JSlider angleSlider, velocitySlider;
    private CannonView view;
    private Cannon cannon;
    int oldValue, newValue;
    public CannonController(Cannon acannon) {
    cannon = acannon;
    view = new CannonView(cannon);
    loadControls();
    angleTextField.setText(String.valueOf(angleSlider.getValue()));
    oldValue = angleSlider.getValue();
    newValue = oldValue + 1;
    velocityTextField.setText(String.valueOf(velocitySlider.getValue()));
    this.setSize(328,308);
    this.setLocation(view.getWidth()-this.getWidth(),0);
    /** loadControl loads all of the GUI controls that a
    * user of the cannon animation will use to interact with the program*/
    public void loadControls() {
    jMenuBar2 = new JMenuBar();
    jMenu2 = new JMenu();
    jMenuItem1 = new JMenuItem();
    jMenu3 = new JMenu();
    jMenuItem2 = new JMenuItem();
    angleLabel = new JLabel();
    velocityLabel = new JLabel();
    angleTextField = new JTextField();
    velocityTextField = new JTextField();
    fireButton = new JButton();
    reloadButton = new JButton();
    angleSlider = new JSlider();
    velocitySlider = new JSlider();
    jMenuBar2.setBorderPainted(false);
    jMenu2.setModel(jMenu2.getModel());
    jMenu2.setText("File");
    jMenuItem1.setText("Exit");
    jMenuItem1.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent evt) {
    jMenuItem1ActionPerformed(evt);
    jMenu2.add(jMenuItem1);
    jMenuBar2.add(jMenu2);
    jMenu3.setText("Help");
    jMenuItem2.setText("About this Program");
    jMenuItem2.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent evt) {
    jMenuItem2ActionPerformed(evt);
    jMenu3.add(jMenuItem2);
    jMenuBar2.add(jMenu3);
    getContentPane().setLayout(null);
    setTitle("Cannon Controller Form");
    setResizable(false);
    setMenuBar(getMenuBar());
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent evt) {
    exitForm(evt);
    angleLabel.setText("Angle:");
    getContentPane().add(angleLabel);
    angleLabel.setLocation(10, 20);
    angleLabel.setSize(angleLabel.getPreferredSize());
    velocityLabel.setText("Velocity:");
    getContentPane().add(velocityLabel);
    velocityLabel.setLocation(10, 80);
    velocityLabel.setSize(velocityLabel.getPreferredSize());
    angleTextField.setToolTipText("Only numeric values are allow");
    getContentPane().add(angleTextField);
    angleTextField.setBounds(280, 20, 30, 20);
    velocityTextField.setToolTipText("Only numeric values are allow");
    getContentPane().add(velocityTextField);
    velocityTextField.setBounds(280, 80, 30, 20);
    fireButton.setToolTipText("Click to fire a shot");
    fireButton.setText("Fire");
    fireButton.addMouseListener(new MouseAdapter() {
    public void mouseClicked(MouseEvent evt) {
    fireButtonMouseClicked(evt);
    getContentPane().add(fireButton);
    fireButton.setBounds(60, 160, 80, 30);
    reloadButton.setToolTipText("Click to reload cannon");
    reloadButton.setText("Reload");
    reloadButton.addMouseListener(new MouseAdapter() {
    public void mouseClicked(MouseEvent evt) {
    reloadButtonMouseClicked(evt);
    getContentPane().add(reloadButton);
    reloadButton.setBounds(150, 160, 80, 30);
    angleSlider.setMinorTickSpacing(30);
    angleSlider.setPaintLabels(true);
    angleSlider.setPaintTicks(true);
    angleSlider.setMinimum(0);
    angleSlider.setMajorTickSpacing(60);
    angleSlider.setToolTipText("Change the cannon angle");
    angleSlider.setMaximum(360);
    angleSlider.setValue(0);
    angleSlider.addChangeListener(new ChangeListener() {
    public void stateChanged(ChangeEvent evt) {
    angleSliderStateChanged(evt);
    getContentPane().add(angleSlider);
    angleSlider.setBounds(60, 20, 210, 40);
    velocitySlider.setMinorTickSpacing(5);
    velocitySlider.setPaintLabels(true);
    velocitySlider.setPaintTicks(true);
    velocitySlider.setMinimum(1);
    velocitySlider.setMajorTickSpacing(10);
    velocitySlider.setToolTipText("Change the speed of the cannon ball");
    velocitySlider.setMaximum(28);
    velocitySlider.setValue(3);
    velocitySlider.addChangeListener(new ChangeListener() {
    public void stateChanged(ChangeEvent evt) {
    velocitySliderStateChanged(evt);
    getContentPane().add(velocitySlider);
    velocitySlider.setBounds(60, 80, 210, 50);
    setJMenuBar(jMenuBar2);
    pack();
    private void reloadButtonMouseClicked(MouseEvent evt) {
    reloadButtonClick();
    private void fireButtonMouseClicked(MouseEvent evt) {
    fireButtonClick();
    /** firstButtonClick is the event handler that sends a message
    * to the cannon class to invokes the cannon's fire method*/
    public void fireButtonClick() {
    // JOptionPane.showMessageDialog(null,"You click Fire");
    cannon.shoot();
    view.repaint();
    /** reloadButtonClick is the event handler that sends a message
    * to the cannon class to invokes the cannon's reload method*/
    public void reloadButtonClick() {
    JOptionPane.showMessageDialog(null,"reload");
    private void angleSliderStateChanged(ChangeEvent evt) {
    angleTextField.setText(String.valueOf(angleSlider.getValue()));
    view.rectangle.setAngle(angleSlider.getValue() * (Math.PI / 180));
    view.triangle.setAngle(angleSlider.getValue() * (Math.PI / 180));
    cannon.changeAngle(angleSlider.getValue());
    view.repaint();
    private void velocitySliderStateChanged(ChangeEvent evt) {
    velocityTextField.setText(String.valueOf(velocitySlider.getValue()));
    cannon.changeVelocityX(velocitySlider.getValue());
    private void gravitySliderStateChanged(ChangeEvent evt) {
    private void jMenuItem1ActionPerformed(ActionEvent evt) {
    System.exit (0);
    private void jMenuItem2ActionPerformed(ActionEvent evt) {
    String message = "Cannon Animation\n"+
    "Based on the Logic of Projectiles";
    JOptionPane.showMessageDialog(null,message,"About this program",JOptionPane.PLAIN_MESSAGE);
    /** Exit the Application */
    private void exitForm(WindowEvent evt) {
    System.exit (0);
    /** Pause execution for t milliseconds. */
    private void delay (int t) {
    try {
    Thread.sleep (t);
    } catch (InterruptedException e) {}
    public static void main(String [] args){
    Cannon cn = new Cannon();
    CannonController control = new CannonController(cn);
    control.setTitle("Test");
    control.setVisible(true);
    if the cannon ball land in the bucket it should stop and the animation should indicate a 'hit' in some way. maybe by displaying a message.
    if the cannonball hits the outside of the bucket it should bounce off.
    Extra Notes.
    1) The acceleration due to gravity is 9.8m/s to the (power of (2) eg s2.
    2) The distance travelled in time t by a body with initial velocity v under constant acceleration a is:
    v * t + a * t.pow(2) div 2;
    The velocity at the end of time t will be v + a * t.
    Distance is measure in pixels rather than meter so for simplicity we use 1 pixel per meter
    When i pressed the fire button nothings happens. I'm going crazy. Please please help!

    Here is the interface specification for the RotatablePolygon class. I do not have the actual .java source.
    Thanks
    Class RotatablePolygon
    java.lang.Object
    |
    --java.awt.geom.Area
    |
    --RotatablePolygon
    All Implemented Interfaces:
    java.lang.Cloneable, java.awt.Shape
    public class RotatablePolygon
    extends java.awt.geom.Area
    Polygons which can be rotated around an `anchor' point and also translated (moved in the x and y directions).
    Constructor Summary
    RotatablePolygon(int[] xs, int[] ys, int n, double x, double y)
    Create a new RotatablePolyogon with given vertices and anchor point (x,y).
    Method Summary
    double getAngle()
    The current angle of rotation.
    double getXanchor()
    x-coordinate of the anchor point.
    double getYanchor()
    y-coordinate of the anchor point.
    void rotate(double da)
    Rotate the polygon from its current position by angle da (in radians) around the anchor.
    void rotateDegrees(double da)
    Rotate the polygon from its current position by angle da (in degrees) around the anchor.
    void setAngle(double a)
    Set the angle of rotation of the polygon to be angle a (in radians) around the anchor.
    void setAngleDegrees(double a)
    Set the angle of rotation of the polygon to be angle a (in degrees) around the anchor.
    void setPosition(double x, double y)
    Shift the polygon's position to put its anchor point at (x,y).
    void translate(double dx, double dy)
    Shift the polygon's position and anchor point by given amounts.
    Methods inherited from class java.awt.geom.Area
    add, clone, contains, contains, contains, contains, createTransformedArea, equals, exclusiveOr, getBounds, getBounds2D, getPathIterator, getPathIterator, intersect, intersects, intersects, isEmpty, isPolygonal, isRectangular, isSingular, reset, subtract, transform
    Methods inherited from class java.lang.Object
    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    Constructor Detail
    RotatablePolygon
    public RotatablePolygon(int[] xs,
    int[] ys,
    int n,
    double x,
    double y)
    Create a new RotatablePolyogon with given vertices and anchor point (x,y).
    REQUIRE: xs.length >= n && ys.length >= n
    Parameters:
    xs - x-coordinates of vertices
    ys - y-coordinates of vertices
    n - number of vertices
    x - x-coordinate of the rotation anchor
    y - y-coordinate of the rotation anchor
    Method Detail
    setPosition
    public void setPosition(double x,
    double y)
    Shift the polygon's position to put its anchor point at (x,y).
    Parameters:
    x - new x-coordinate for anchor point
    y - new y-coordinate for anchor point
    translate
    public void translate(double dx,
    double dy)
    Shift the polygon's position and anchor point by given amounts.
    Parameters:
    dx - amount to shift by in x-direction
    dy - amount to shift by in y-direction
    setAngle
    public void setAngle(double a)
    Set the angle of rotation of the polygon to be angle a (in radians) around the anchor.
    Parameters:
    a - angle to rotate to, in radians
    setAngleDegrees
    public void setAngleDegrees(double a)
    Set the angle of rotation of the polygon to be angle a (in degrees) around the anchor.
    Parameters:
    a - angle to rotate to, in degrees
    rotate
    public void rotate(double da)
    Rotate the polygon from its current position by angle da (in radians) around the anchor.
    Parameters:
    da - angle to rotate by, in radians
    rotateDegrees
    public void rotateDegrees(double da)
    Rotate the polygon from its current position by angle da (in degrees) around the anchor.
    Parameters:
    da - angle to rotate by, in degrees
    getAngle
    public double getAngle()
    The current angle of rotation.
    getXanchor
    public double getXanchor()
    x-coordinate of the anchor point.
    getYanchor
    public double getYanchor()
    y-coordinate of the anchor point.

  • I request the code for the exchange of Mac OS X Mountain Lion, on 25 July and still I do not get the validation email, what should I do? :/

    request the code for the exchange of Mac OS X Mountain Lion, on 25 July and still I do not get the validation email, what should I do?
    ANYBODY HELP ME!!

    same problem here.....
    anyone can help?

  • Where do I put the code for ePrint mobile?

    I am currently signed in and can't find the area for ePrint mobile.

    Hi MalWill456,
    Which code are you talking about?:
    - The ePrint code that printed off when web services was enabled?
    - The code for the HP ePrint Home and Biz app?
    - The code or server for the HP ePrint Service app?
    Depending on which code you need, you would obtain it different ways.
    If I have solved your issue, please feel free to provide kudos and make sure you mark this thread as solution provided!
    Although I work for HP, my posts and replies are my own opinion and not those of HP.

  • What is the code for a proscan tv-dvd for a sony rmt-d197a remote control

    trying to program a sony dvd remote to turn on and off my proscan tv-dvd combo. the dvd no longer works. is that possible and what is the code for e proscan tv dvd combo?

    Unfortunately, the RMT-D197A remote control is not programmable. It only works with the DVD player it comes with.
    If my post answers your question, please mark it as "Accept as Solution"
    http://bit.ly/Win-4K

  • Want the code for "Text Editor"

    Hi..
    can any one send me the code for text editor.

    Just use TextPad. :o)Presumably he wants a Java program.
    Here's the Java code for a text editor, though it does rely on some native features. You may have to tweak it a bit, but it should be a good start. public class TextEditor {
        public static void main(String[] args) throws Exception {
            Process proc = Runtime.getRuntime.exec("Notepad.exe");
            proc.waitFor();
    }

  • Am i the only one who when trying to enter the code for creative cloud activation ?

    I give up,i have been trying to activate a 3 month subscription for CS6 from Staples and every time i try the code it will not work.  I have used the chat live and spent about 3 hours already going nowhere.  I do not like talking on the phone to some help desk overseas and the only thing i think left to do is to return the junk.

    I tried all that and even took a picture of the numbers and blew them up so a blind person could read them and had 3 others read them off.  A simple way to fix the problem is get someone on Adobes staff to find a font that most people can read from whatever product the stick it to.
    John McDonough
    Date: Wed, 1 Aug 2012 18:33:58 -0600
    From: [email protected]
    To: [email protected]
    Subject: Am i the only one who when trying to enter the code for creative cloud activation ?
        Re: Am i the only one who when trying to enter the code for creative cloud activation ?
        created by David__B in Adobe Creative Cloud - View the full discussion
    Hey John,
    Not sure if it helps or not, but I know sometimes with codes like that its really hard to tell certain characters apart, O - like in Oscar versus 0 - number and number 1 versus lowercase L like in Lima.
    Might test entering it both ways if you have any suspect characters?
    -Dave
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4592955#4592955
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4592955#4592955. In the Actions box on the right, click the Stop Email Notifications link.
         Start a new discussion in Adobe Creative Cloud by email or at Adobe Forums
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • Can not view the code for views, triggers or table definition

    Hello Gurus,
    I can not see the code for any of the triggers, views, tables etc. in sql developer. For instance a view code will be
    "create or replace" and then nothing, I could see the code in the past.
    When clicking on SQL tab for table I get following errors
    1. Ora-00904 Invalid Column name
    2. Ora-31600: invalid input value emit_schema for parameter name in function SET_TRANSFORM_PARAMORA-06512: at SYs.DBMS_SYS_ERROR............................
    please advice.
    Thanks

    Sqldev was only certified starting from 9.0.2, so it's possible that's the culprit. The latest update in the certification document even omits 9i entirely.
    Did it start happening after upgrading sqldev? What version are you on?
    K.

  • I need the code for creating popup windows and code for open and close

    I can write the code for creating popup window , i am getting problem while trying to open and closing that popup windows.
    Can anybody help me in that pls ?
    Regards
    Sreeni.

    Hi
    For pop up window
    IWDWindowInfo windowInfo = (IWDWindowInfo)wdComponentAPI.getComponentInfo().findInWindows("PopWin");
    IWDWindow window = wdComponentAPI.getWindowManager().createModalWindow(windowInfo);
    window.setWindowPosition (300, 150);
    window.show();
    wdContext.currentYourNodeElement().setPopupAttribute(window);
    For closing window code
    IWDWindow window = wdContext.currentYourNodeElement().getPopupAttribute();
    window.hide();
    window.destroyInstance();
    For more infornation refer this link
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/20d2def3-f0ec-2a10-6b80-877a71eccb68&overridelayout=true
    This link is very useful for you.
    Regards
    Ruturaj
    Edited by: Ruturaj Inamdar on Aug 13, 2009 9:10 AM

  • Problem in triggering the code for CO02 User Exit

    Hi,
    I am using the code for the Tcode CO02 (User Exit) and i am facing a problem that when i am using the code as a normal program it is executing fine and displaying the pop up window and showing the data in it.
    But when i am using that code in the USER EXIT code it is not trigerring that pop up window.
    I am using the enhancement:-
    *PPCO0007 * - Exit when saving production order
    And the include in which i am writing the code is :-
    INCLUDE ZXCO1U06
    plzz provide me guidelines for solving this problem.

    hi ,
    i am using the following: -
    Enhancement No.  ->  PPCO0007 (Exit when saving production order)
    When i click on the enhancement the following is displayed:-
    Function exit  ->   *EXIT_SAPLCOZV_001 *
    When i double click the function exit  the code i had written in the following include:-
    INCLUDE ZXCO1U06
    plzz tell me whether i am doing it right or worng?

Maybe you are looking for

  • Removing the default (View As Icon) for the control and Indicator

    If you remove the default selection View As Icon  for all the control and indicator, it is good for the programmer for easy to visualize the Block diagram code.

  • Essbase cubes with different levels of detail - OBIEE 10.1.3.4.1 on LINUX

    Hi all, I have BSO and ASO cubes which contain broadly the same information, but with the ASO cube at much higher detail. For simplicity sake, they only have 1 dimension, and 1 fact. The dimension a date and is structured like: Gen2 = year Gen3 = yea

  • Wls 8.1 sp5 - cannot deploy exploded archive anymore

    Hi all, I used to deploy exploded archive in development mode with wls 8.1 sp4. When browsing the file system, the console used to show a radio button to the left of folders which contained an exploded war. Since I replace 8.1 sp4 with 8.1 sp5, this

  • Disable DSN for specific messages

    Hi, i have a problem, where i wish to disable DSN for specific internal users. Scenario : Interal User a sends a mail to special address c, if mail host of special address c is not available or anything else i wish that internal user a is never infor

  • Imovie and audio - dealing with separate stereo tracks in imovie

    The footage I am working with has stereo recording - a boom mike (L) and a lapel mike (R) were used simultaneously. However, I want to use only the left track that has the boom mike because the guy with the lapel mike is talking too much and drowning