First Event Help

Here is the java code:import java.awt.*;           
import java.applet.Applet;      
import java.awt.event.*;
public class FirstEvent extends Applet{
implements AdjustmentListener{
private Scrollbar slider;
private int sliderValue=0;
public void init(){
slider= new Scrollbar(Scrollbar.HORIZONTAL,0,1,0,100);
add(slider);
slider.addAdjustmentListener(this);
public void paint (Grpahics g){
g.drawString("Current Value is " +sliderValue,100,100);
public void adjustmentValueChanged (AdjustmentEvent e){
sliderValue=slider.getValue();
repaint();
the error is under the word implement i and says type expected?

with corrections
import java.applet.Applet;
import java.awt.event.*;
import java.awt.*;
public class FirstEvent extends Applet implements AdjustmentListener{
private Scrollbar slider;
private int sliderValue=0;
                             public void init(){
                     resize(400,400);
                             slider= new Scrollbar(Scrollbar.HORIZONTAL,0,1,0,100);
                             add(slider);
                             slider.addAdjustmentListener(this);
                             public void paint (Graphics g){
                             g.drawString("Current Value is " +sliderValue,100,100);
                             public void adjustmentValueChanged (AdjustmentEvent e){
                             sliderValue=slider.getValue();
repaint();
}

Similar Messages

  • First event fired to event structure

    Hi all,
       Does anyone know what's the first event being fired to the event structure on VI startup? I set a breakpoint on the event structure and it breaks. However i wasn't able to capture whats the event.
    My intention was simple; i have a table which list all the IO names and values. So during VI startup, i wan to populate the IO names first. Then in a timed-loop, the values are updated respectively. In this case, i don't need to "refresh" the table every time which waste time and resources.
    It something like the OnLoad event.
    Another way out is to register an user event, and have this event fired during application startup. But i wonder if anyone has a better way?
    Many thanks!

    j3r3mi wrote:
    My intention was simple; i have a table which list all the IO names and values. So during VI startup, i wan to populate the IO names first. Then in a timed-loop, the values are updated respectively. In this case, i don't need to "refresh" the table every time which waste time and resources.
    Why don't you show us some code.
    Are the IO name static for the duration of the program? Are you using a regular table column or the "row header strings []" property for the IO names?
    If you want to write the row headers at the start of the program, place the code before the main loop containing the event structure. No event case needed. If you have a specific event to update the table headers if needed, fire the event once at startup using a signaling value property, again with the property node placed before the main loop.
    LabVIEW Champion . Do more with less code and in less time .

  • Which is first event triggred in interactive report

    pls let me know

    <b>The event are triggered depended on the way the output is generated . </b>
    for eg:
    "Initialization :
    triggered when the report is loaded in memory.
    "At selection-screen output :
    triggered when the selection screen is loaded in memory before being displayed.
    "At selection-screen / <field> :
    before leaving the selection screen.
    "start-of-selection :
    the first event for displaying the report.
    "end-of-selection :
    after the start-of-selection is completed.
    "classiscal report events.
    "top-of-page :
    every time a new page is started in the list.
    "end-of-page :
    every time the list data reaches the footer region of the page.
    "interactive report events.
    "top of page during line selection :
    top of page event for secondary list.
    "at line-selection :
    evey time user dbl-clicks(F2) on the list data.
    "at pF<key> :
    function key from F5 to F12 to perform interactive action on the list.
    reward  points if it is   usefull ....
    Girish

  • Can u please tell me events trigaring and first event in report

    hi experts,
    can u please tell me events trigaring and first event in report

    actually first event triggering in a report is intialization
    but before that there is one more event get triggered that is load of program.....This is the very first event which is trigger in a report program. Really I have never needed a reason to use this. But I would assume that it can be used when you want to do something before the INITIALIZATION event.
    Classical Reports can have these events, in the given order :
    initialization
    at selection-screen
    start-of-selection
    end-of-selection
    top-of-page
    end-of-page
    In addition o the above, the following events are possible in case of Interactive Reports -
    at line-selection
    at user-command
    at PFnn.

  • First event

    what is the first event that trigger in an abap program and what is the order of other events which usually trigger in an report

    First event -
    Initialization : triggered when the report is loaded in memory.
    At selection-screen output : triggered when the selection screen is loaded in memory before being displayed.
    At selection-screen : before leaving the selection screen.
    start-of-selection : the first event for displaying the report.
    This event keyword defines an event block whose event is triggered by the ABAP runtime environment
    when calling the executable program selection screen processing of a selection screen.
    In an executable program, all statements that are not declarations,
    and are listed before the first explicit processing block, are assigned to this event block.
    If the program does not contain an explicitly defined event block START-OF-SELECTION,
    these statements form the complete event block START-OF-SELECTION.
    If a program contains an explicitly defined event block START-OF-SELECTION,
    these statements are added to the beginning of the event block.
    If the program contains no explicitly defined event blocks,
    these statements form the entire event block START-OF-SELECTION.
    end-of-selection : after the start-of-selection is completed.
    classiscal report events.
    top-of-page : every time a new page is started in the list.
    end-of-page : every time the list data reaches the footer region of the page.
    interactive report events.
    top of page during line selection : top of page event for secondary list.
    at line-selection : evey time user dbl-clicks(F2) on the list data.
    at pF<key> : function key from F5 to F12 to perform interactive action on the list.
    at user-command

  • Event Structure Freezes Vi After Capturing The First Event

    My Event structure catches the first instance of my button press but then it freezes my Vi.  The reason is because of the while loop but I need the while loop to constantly read from a serial port and send data to a serial port. The vi included is stripped down to be just a while loop that does nothing.  I have also tryed putting the event structure in the while loop, but the same thing is happening.
    Any ideas?
    Thanks,
    Cason Clagg
    SwRI
    LabView 7.1, Windows XP

    Also, put the button inside the event structure where it is acted upon, from LV help (suggest you read the entire events section of help):
    When you trigger an event on a Boolean control configured with a latching mechanical action, the Boolean control does not reset to its default value until the block diagram reads the terminal on the Boolean control. You must read the terminal inside the event case for the mechanical action to work correctly. As a reminder, a note appears in the Edit Events dialog box when you configure a Value Change event on a latched Boolean control.
    Refer to the Handling a Latched Stop Boolean Control in an Event Structure caveat for information about how to handle a latched Boolean control.
    When you trigger an event on a Boolean control configured with a latching mechanical action, the Boolean control does not reset to its default value until the block diagram reads the terminal on the Boolean control. You must read the terminal inside the event case for the mechanical action to work correctly. As a reminder, a note appears in the Edit Events dialog box when you configure a Value Change event on a latched Boolean control.
    Refer to the Handling a Latched Stop Boolean Control in an Event Structure caveat for information about how to handle a latched Boolean control.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
    "It’s the questions that drive us.”
    ~~~~~~~~~~~~~~~~~~~~~~~~~~

  • Every sync gets "You are about to synchroniz​e your calendar for the first time" - Help !!!

    I am on a MBP with the Tour and was able to successfully sync iCal and Address Book with BB. But everytime I try to sync, I get the " You are about to synchronize our Calendar data for the first time." with the options to "Replace Device Data", "Merge Data" or Cancel. Has anyone seen this and know how to fix? Replacing data makes it impossible to update Mac with changes on BB.  
    Please help! 

    Create a backup of your iCal and your BlackBerry.
    Then create a test Calendar event on the BlackBerry, in iCal then test another synchronization once again.
    The first time sync prompt usually occurs when it does not detect entries in either the BlackBerry or iCal Calendar.
    -FB
    Come follow your BlackBerry Technical Team on Twitter! @BlackBerryHelp
    Be sure to click Kudos! for those who have helped you.
    Click "Accept as a Solution" for posts that have solved your issue(s)!

  • JComboBox Event help

    sir
    i have three JComboBoxes .
    firstcombobox will be loaded on start up .
    basing on the First combobox item selected the second combo box is filled up.
    basing on the second the third one will be filled up.
    based on the third combobox the text feild beside it should be locked or unlocked
    i have the problem with the comboboxes events in which events i have to write all the three please help me

    in the following link there is a code example it will help u and u have to make combobox model to all stuff
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=688505

  • My parents ended up with my contacts on their Iphone when updating their Iphone for the first time, help?!

    Ok, my family uses one Apple Account and we share music and stuff but when me and my sibling got Iphones like my parents, it got confusing. I was the first to sync my Iphone 4s into the computer and the Apple ID is put under my name. All of my Apps, contacts etc are on the account. But my parents decided to update their phone. Theirs is an Iphone 4s, like mine but they haven't updated it to IOS 7 since they got it so they plugged their phone into the computer syncing my information while deleting THEIR information. I think the computer thought it was MY phone and kicked out my parents information in the process. I don't know what to do, they have my contacts, pictures, apps, games, email accounts and TEXT MESSAGES. We have different phone numbers but how is that possible? I don't get it. Anyway, it would be nice to solve this problem because my sibling wants to update his own phone. If you guys have the answer, just post it up on here That would help alot!! Thank you!
    <Email Edited by Host>

    Go to Settings>General>Passcode Lock>tap Turn Passcode Lock Off, enter your "pin".
    Edit:  Are you saying you are getting a prompt for your email pin, or are you talking about the passcode lock that appears when you turn the phone on?

  • Opening dbs thru button events, help, i`m a newbie..

    i have the following fn for opening the db
    public static void main(String args[]) throws Exception
    new login(new javax.swing.JFrame(), true).show();
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    open();
    select();
    static void open() throws SQLException
    // ODBC data source name
    String dsn = "jdbc:odbc:dslogin";
    String user = "";
    String password = "";
    // Connect to the database
    con = DriverManager.getConnection(dsn, user, password);
    // Shut off autocommit
    con.setAutoCommit(false);
    static void select() throws SQLException
    Statement stmt; // SQL statement object
    String query; // SQL select string
    ResultSet rs; // SQL query results
    boolean more; // "more rows found" switch
    query = "select user,password from dblogin";
    stmt = con.createStatement();
    rs = stmt.executeQuery(query);
    // Check to see if any rows were read
    more = rs.next();
    if (!more) {
    System.out.println("No rows found.");
    return;
    // Loop through the rows retrieved from the query
    while (more)
    // System.out.println("kkkk");
    System.out.println("umm" + rs.getString("user"));
    System.out.println("ummmm" + rs.getString("password"));
    more = rs.next();
    rs.close();
    stmt.close();
    now my problem is this..while the above open and select fns work fine in void main, i`m trying to open the db upon clicking a button..heres what i tried to do :
    cmdsubmit.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    cmdsubmitActionPerformed(evt);
    private void cmdsubmitActionPerformed(java.awt.event.ActionEvent evt) {
    open();
    seelct();
    when i try it i get the error message exceptions must be caught or throw or sumthing like that and i`m new to java so i`ve no idea how to go about doing it..help please..

    On JDBC:
    You only need to register a driver with the DriverManager once, and this is done (by JDBC conform drivers) when the driverclass is loaded. You may want to do this in a static initializer:
    import java.sql.*;
    class MyClass{
        static {
            try {
                // load driver class, which automatically registers itself
                Class.forName("sun.jdbc....");
            } catch(Exception ex) { /* handle it, throw error */ }
        // later
        Connection con = DriverManager.getConnection(...);
    }Even better is NOT to hard-code the driver at all. Use
    java -Djdbc.drivers=sun.jdbc.odbc.JdbcOdbcDriver;oracle.jdbc.OracleDriver MyClassinstead.
    Fritz

  • Broken on the first day HELP

    hello have just bought a iphone 5 and in the first day the lock button has jammed down what can i do please HELP  many thanks declan

    It's under warranty. Take it back.

  • Event help please!!!

    Hello
    In a game I am currently making I have had some problems with The keyPressed() and keyReleased() methods. If i press spacebar to fire (its in keyReleased()) while i'm moving, my ship will stop (since the moving is controlled with keyPressed()). Also, on my computer I can move diagonally (ie hold two keys at once) but on my friends computer he can't. Third, my high score screen glitches if SHIFT is held down. So here are my questions:
    Is there any way to use keyPressed() and keyReleased() at the same time, or do they always conflict?
    Why is my friend's computer not registering two keyPressed()s at the same time, and is there any way i can fix this?
    Is there any way to check if a key pressed/released/hit is a key that gives a valid ASCII character?
    Any help is truly appreciated!!!

    You need another thread I am betting. You should not do any work in the event thread. just get the data out of the event thread but your work should all be done in another thread, or else just what you are talking about will happen. when the event thread is interrupted, your app will stop.

  • JAX-WS contract first solution help needed

    Hi,
    I am trying to create a bunch of web services using jax-ws which I will deploy on Jboss. I would like to create xml schemas and wsdl files before I create my solution because I want a clearer contract betweent client and server that is not defined by the server code.
    I have managed to create an xml schema and generated the message files. I also created a wsdl file and implemented a service endpoint which refers to the wsdl file.
    My problem now is that I cannot seem to get the mapping (marshalling) to the Java objects to work correctly. When I create a simple client that calls the service defined in the wsdl file I have managed to get the request to map to the webmethod in my endpoint. But I cannot seem to figure out how to get my message validated against the schema, which means that I can call the method with any type of request without getting an error message. This is also true for the return object. The solution doesn't seem to care whether I return a string or the object defined in the wsdl file.
    I created my solution as a "regular" jar which I deploy on Jboss.
    @Stateless
    @WebService(name = "Test", portName = "TestPort", targetNamespace = "http://www.company.com/test-service/", wsdlLocation = "META-INF/wsdl/test-service.wsdl")
    @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
    public class TestBean {
         @WebMethod(operationName = "PerformOperation")
         public Response newOperation(Request request) {
              return response;
    }Could you give me some tips and advice to help me finish my solution. It would also good if anyone could tell me how to turn message validation on.
    Regards,
    Leo

    Hi Nico,
    In multithreading, all the threads are independent. Here the threads miao and bau are independent.
    There is no guarantee which thread executes first. In your program for miao you explisitly called sleep and hence bau thread executed.
    Explanation:
    ========
    When you start both the threads miao and bau both are in runnable start. Only one thread can go to running. Lets consider miao goes to running state. Because you called sleep miao goes to sleeping and bau goes to running state and once the sleep completed for miao it goes to runnable state and as bau is in running and once bau completes miao again goes to running state and then it also completes.
    Thanks & Regards,
    Murali.
    ===========

  • XML Gurus -My first request -Help needed urgently

    Hi XML gurus,
    I have a requirement to convert the following XML into two oracle tables.This is the first time I am looking at an XML script this closely....Could any of the gurus study the pattern of the xml and convert this into oracle tables with the constraints and post the script.After some thorough look I am able to conclude that the data has to be pushed into two tables.Appreciate your help!!
    XML file is as below
    - <Batch BatchCreated="633479274856698434" TransType="EISendCATProfile">
    - <SiebelMessage>
    - <CATProfiles>
    - <CATProfile Id="1-6XCMTV3">
    <CATCode>SE0</CATCode>
    <LegacyHandled>N</LegacyHandled>
    <DOLStart>05/31/2008</DOLStart>
    <DOLEnd>06/02/2008</DOLEnd>
    <Status>New</Status>
    <TransStatus>Pending</TransStatus>
    <Description>CAT SE0 MN Auto Wind and Hail Prop Wind, Hail and Other Weather 5/31 - 6/2</Description>
    <GMTCreated>06/01/2008 14:23:26</GMTCreated>
    <GMTUpdated>06/01/2008 14:31:21</GMTUpdated>
    - <Details>
    - <Detail Id="1-6XCMTV5">
    <State>MN</State>
    <PolicyType>Auto</PolicyType>
    <ClaimType>Comprehensive</ClaimType>
    <CauseOfLoss>Hail</CauseOfLoss>
    <Status>New</Status>
    <GMTCreated>06/01/2008 14:23:47</GMTCreated>
    <GMTUpdated>06/01/2008 14:24:11</GMTUpdated>
    </Detail>
    - <Detail Id="1-6XCMTV9">
    <State>MN</State>
    <PolicyType>Auto</PolicyType>
    <ClaimType>Comprehensive</ClaimType>
    <CauseOfLoss>Wind</CauseOfLoss>
    <Status>New</Status>
    <GMTCreated>06/01/2008 14:24:11</GMTCreated>
    <GMTUpdated>06/01/2008 14:24:28</GMTUpdated>
    </Detail>
    - <Detail Id="1-6XCMTVC">
    <State>MN</State>
    <PolicyType>Commercial Auto</PolicyType>
    <ClaimType>Comprehensive</ClaimType>
    <CauseOfLoss>Hail</CauseOfLoss>
    <Status>New</Status>
    <GMTCreated>06/01/2008 14:24:29</GMTCreated>
    <GMTUpdated>06/01/2008 14:24:45</GMTUpdated>
    </Detail>
    - <Detail Id="1-6XCMTVF">
    <State>MN</State>
    <PolicyType>Commercial Auto</PolicyType>
    <ClaimType>Comprehensive</ClaimType>
    <CauseOfLoss>Wind</CauseOfLoss>
    <Status>New</Status>
    <GMTCreated>06/01/2008 14:24:47</GMTCreated>
    <GMTUpdated>06/01/2008 14:25:10</GMTUpdated>
    </Detail>
    - <Detail Id="1-6XCMTVI">
    <State>MN</State>
    <PolicyType>Commercial Property</PolicyType>
    <ClaimType>Commercial Property</ClaimType>
    <CauseOfLoss>Windstorm & Hail</CauseOfLoss>
    <Status>New</Status>
    <GMTCreated>06/01/2008 14:25:13</GMTCreated>
    <GMTUpdated>06/01/2008 14:25:55</GMTUpdated>
    </Detail>
    - <Detail Id="1-6XCMTVL">
    <State>MN</State>
    <PolicyType>Homeowners</PolicyType>
    <ClaimType>Property</ClaimType>
    <CauseOfLoss>Hail</CauseOfLoss>
    <Status>New</Status>
    <GMTCreated>06/01/2008 14:25:57</GMTCreated>
    <GMTUpdated>06/01/2008 14:26:14</GMTUpdated>
    </Detail>
    - <Detail Id="1-6XCMTVO">
    <State>MN</State>
    <PolicyType>Homeowners</PolicyType>
    <ClaimType>Property</ClaimType>
    <CauseOfLoss>Wind</CauseOfLoss>
    <Status>New</Status>
    <GMTCreated>06/01/2008 14:26:16</GMTCreated>
    <GMTUpdated>06/01/2008 14:27:06</GMTUpdated>
    </Detail>
    - <Detail Id="1-6XCMTVU">
    <State>MN</State>
    <PolicyType>Homeowners</PolicyType>
    <ClaimType>Property</ClaimType>
    <CauseOfLoss>Other Weather Related</CauseOfLoss>
    <Status>New</Status>
    <GMTCreated>06/01/2008 14:29:35</GMTCreated>
    <GMTUpdated>06/01/2008 14:29:52</GMTUpdated>
    </Detail>
    </Details>
    </CATProfile>
    </CATProfiles>
    </SiebelMessage>
    </Batch>
    Thanks Much!
    Sridhar

    I tried what you told AnanSmriti.
    But still Server cannot find the page .
    I have saved JSP pages in DefaultWebApp and Java class files in WEB-INF /classes under DefaultWebApp dir.
    Also I have given the same URl in web.xml as in my first page.
    Please tell me where am I going wrong.
    Thanx in advance for any help.

  • Button Event Help

    Hi, I have created a Frame that the user can draw in. It is a separate class that I call in my main program from a different file. I have a button on my frame that I want to run a method to save the graphical contents of the frame as a type Image. This works fine, and I have created the image. Now I need to return the image to my main program somehow. I want it only to return to my main when the button is pressed. The actionPerformed cannot contain a return statement, and I cannot call a getImage (from the frame) in my main anyway, because I want it to be initiated by the button push, which is located in the Frame file and not in the main. Can anyone help me? I will post the code. Ignore the Picture and InterruptedException in my actionPerformed class, they just convert the image in other classes, but they're not important. An explanation to return the image would be perfect.
    Here is my main:
    class LoadPictures
        public static void main (String [] args) throws IOException, InterruptedException, AWTException
            PaintArea pa = new PaintArea ();
            pa.loadArea (pa);
    Picture pic= pa.getPic() //<---false method. This is what I want to happen when you click the button in the frame.
        }}Here is my frame, entitled PaintArea:
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    class PaintArea extends Frame
        static int x, y;
        static Graphics g;
        PaintArea ()
            addWindowListener (new WindowAdapter ()
                public void windowClosing (WindowEvent e)
                    hide ();
            setSize (400, 400);
            setVisible (true);
            g = getGraphics ();
        public void loadArea (PaintArea pa)
            Button button = new Button ("Save");
            // pa.add (button);
            button.setSize (2, 2);
            pa.show ();
            final PaintArea pa2 = pa;
            button.addActionListener (new ActionListener ()
                public void actionPerformed (ActionEvent ae)
                    try
                        Image image = pa2.saveScreen (pa2);
                        //Picture pic = new Picture (pa2);
                    catch (AWTException e)
                        System.err.println (e);
                        System.exit (1);
                    // catch (InterruptedException ie)
                    //     System.err.println (ie);
                    //     System.exit (1);
            pa.addMouseListener (new MouseAdapter ()
                public void mousePressed (MouseEvent me)
                    x = me.getX ();
                    y = me.getY ();
                    g.fillOval (x - 5, y - 5, 10, 10);
            pa.addMouseMotionListener (new MouseMotionAdapter ()
                public void mouseDragged (MouseEvent me)
                    x = me.getX ();
                    y = me.getY ();
                    g.fillOval (x - 5, y - 5, 10, 10);
        public Image saveScreen (PaintArea pa) throws AWTException
            Image image = createImage (new Robot ().createScreenCapture (pa.getBounds ()).getSource ());
            return image;
    }Thank you very much, everyone!!

    When you open the frame, use wait() to suspend action in the main program. When the button is pressed, call notify() on the same object. Then the focus is back in the main program's code.

Maybe you are looking for

  • Just updated my iPhone 4S to iOS 7.0.4 --I should have known better!  Wifi & Bluetooth are now dead!!  (And so is my trust in Apple updates)

    So, I've always considered myself a guy in the know for all things Apple.  People are always coming to me for help with things as it relates to thier iPhones/ iPods/ iPads/ iOS and generally I can help them.  I am an Amercan living abroad in Ghana, s

  • Osx lion on macbook Pro

    I want to move my home folder to an external drive, I have read some posts, went into the user account, i am there as admin, for the life of me I cant find the advanced table to direct the home folder to the external folder, where I have a copy of my

  • SQL QUERY IN ABAP

    Dear ABAP Experts, Is there any possibility to see the SQL statement for the query which are designed by the SQVI queries.? Like SQL Server, we design the query in query designer and sql statements  are also shown in it . Regards, Aneel

  • Esb instances execute fine, but are delayed in esb instances view

    when executing esb processes the instances are executing fine, and responding as expected. But when trying to investigate in esb instances view there are no instances shown. Only old instances. It seems like the instances view (and esb_activity table

  • Piece of crap iMac!!

    suddenly I can't burn a CD or get my favorite POGO game to load! Was burning 3 CD's in a row - 2 burned fine and the 3rd wouldn't saying speed too fast - so I went all the way to 1 X and it just checks media and then shuts off, even with a playlist o