Help needed regarding buttons and action listeners!

Hey,
Im designing an applet and im trying to create it so that when a button is pressed a new Draw object is drawn, I have read up about action listeners but im not totally sure where they need to be inserted
Ive posted my code below so hopefully someone out there wll be able to see what im working with!
Thank you in advance
public class ImageWithMulti extends Applet {
    Image image;
    public void init () {
        image = getImage(getDocumentBase(),
            getParameter("Channel"));
    public void paint(Graphics g) {
        g.drawImage(image, 0, 0, this);
        drawMultiDown1
    (g, 0, 0, getSize().width, getSize().height, 25, new Color(0).white);   //2nd number changes left sided position up or down
        drawMultiUp1
    (g, 0, 0, getSize().width, getSize().height, 25, new Color(0).white);
        drawMultiUp2
    (g, 0, 0, getSize().width, getSize().height, 25, new Color(0).white);
        drawMultiDown2
    (g, 0, 0, getSize().width, getSize().height, 25, new Color(0).white); 
        drawMultiUp3
    (g, 0, 0, getSize().width, getSize().height, 25, new Color(0).white);   
       drawMultiDown3
    (g, 0, 0, getSize().width, getSize().height, 25, new Color(0).white);
       drawMultiUp4
    (g, 0, 0, getSize().width, getSize().height, 25, new Color(0).white);
       drawMultiDown4
    (g, 0, 0, getSize().width, getSize().height, 25, new Color(0).white);
       drawMultiUp5
    (g, 0, 0, getSize().width, getSize().height, 25, new Color(0).white);

hi,
i've modify your code. but i've commented your some original code because i was getting error...
please check the code...
import java.awt.event.*;
import java.applet.*;
import java.awt.*;
  <applet code="ImageWithMulti.class" width=100 height=140></applet>
public class ImageWithMulti extends Applet implements ActionListener {
    Image image;
    Button btnClick = null;
    public void init () {
        /*image = getImage(getDocumentBase(),
            getParameter("Channel"));*/
          btnClick = new Button("Click");
          add(btnClick);
          btnClick.addActionListener(this);
    public void paint(Graphics g) {
        g.drawImage(image, 0, 0, this);
       /* drawMultiDown1
    (g, 0, 0, getSize().width, getSize().height, 25, new Color(0).white);   //2nd number changes left sided position up or down
        drawMultiUp1
    (g, 0, 0, getSize().width, getSize().height, 25, new Color(0).white);
        drawMultiUp2
    (g, 0, 0, getSize().width, getSize().height, 25, new Color(0).white);
        drawMultiDown2
    (g, 0, 0, getSize().width, getSize().height, 25, new Color(0).white); 
        drawMultiUp3
    (g, 0, 0, getSize().width, getSize().height, 25, new Color(0).white);   
       drawMultiDown3
    (g, 0, 0, getSize().width, getSize().height, 25, new Color(0).white);
       drawMultiUp4
    (g, 0, 0, getSize().width, getSize().height, 25, new Color(0).white);
       drawMultiDown4
    (g, 0, 0, getSize().width, getSize().height, 25, new Color(0).white);
       drawMultiUp5
    (g, 0, 0, getSize().width, getSize().height, 25, new Color(0).white);*/
     public void actionPerformed(ActionEvent ae){
          if(ae.getSource() == btnClick){
               System.out.println("Hey");
}dhaval..

Similar Messages

  • Help needed regarding buttons :

    Hi,
    I am making an intro to my website & I keep getting this weird error although I did similar stuff without this annoying glitch !!
    Anyway, the error is:
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at second3_fla::mc_Home_Butt_16/frame22()
    I think it's a common error but I have no idea why did it occur, it occured twice and here is the full pic so u can get what I mean
    In my 1st scene I have the pre-loader and a movie clip that should act as a container
    then I have the intro animation in a movie clip, in the end of it I have an event listener that refers to the second movieclip in the container
    The second movieclip plays normally untill it stops at a frame where I have two event Listeners:
    One for movieclip (Base)  that waits for a mouse out event to go to other frame
    And one for each of the three buttons I have there : Here the error occurs saying I can't refer to a null object.
    I want to put all of the button in a movie clip and that movie clip waits for a mouse_out event instead of the (Base) movieclip, but when I do that, I also get that error
    I really hope someone would tell me what's wrong or what should I do to get this to work since it's driving me craaaazy
    here is the code of the two simple event listeners, which I know there is nothing wrong with them, it's just the structure I guess.
    stop();
    Base.addEventListener(MouseEvent.MOUSE_OUT,gone);
    function gone(eventMouseEvent):void{
                                          gotoAndPlay('HomeFade');
    Btn_home.addEventListener(MouseEvent.CLICK,url1);
    function url1(eventMouseEvent):void{
    navigateToURL(new URLRequest("http://www.yahoo.com"), "_self");
    Thanks :<

    To see if it might be what you think, name the objects in adjacent frames the same thing and that will resolve that issue.
    I don't know what you mean by "add a url to the buttons".
    You can add an event listener to any object that has an instance name.  If you have a movieclip that contains buttons and you assign some form of mouse interactive listeners to the movieclip, it will block the buttons from interacting with the mouse.

  • Little help needed regarding http and https

    Hi,
    I maintain a website for my organization. Recently, for a login page, I started using HTTPS. It works fine with HTTPS.
    The problem I face is : When a user goes to login page, he sees the login page via HTTPS. Now, if user doesn't submit the login form but chooses to browse some other link on the same page, that page will still be shown using HTTPS because links are relative. This increases unnecessary HTTPS traffic on the server.
    I need a solution that can help me to change protocol back to HTTP if the user doesn't submit login form. I have written small piece of java script that can check at the time of leaving the page. If submit button wasn't pressed, it should change the protocol back to HTTP. I have played around window.location object trying to change it's href property. But, no luck yet. Please help me.
    window.onunload = function()
    // if submit button wasn't pressed, change the protocol back to HTTP          
              if (!submitPressed)
                        window.location.protocol="http:";
                        alert(windows.location.href);
                     window.location.port = "80";
            }Please let me know if you know about some simple solution.
    Edited by: Di_Ke on Nov 13, 2007 2:12 PM
    Edited by: Di_Ke on Nov 13, 2007 2:14 PM

    Just to clarify, before anyone can answer: Do you have access to the web server settings, and are you looking for a server side solution for this problem? If the answer to any of those two question is no, and you are just looking for a javascript help, this forums is not the best source for answers.

  • Help needed with buttons and hit areas

    I have a very simple need. To give a button a roll over
    behavior, which I have done, and to set up a hit area which I have
    also done. Why is it that the buttons work great with "enable
    simple buttons" in effect, but when i test movie, the hit areas do
    not work (no roll over effect) or even change to a finger cursor
    like it ought to?

    Thanks for that, though I do not have text. I have managed a
    work around though it remains mysterious how it is now working, and
    maybe too long to explain. But thanks, and Peace!

  • Some help needed regarding Files and URLs on a server

    I don't get it - my applet works in a local directory, but not on a server. This has to do with the loading of files (I load an array of images to use, but when I attempt to use that array, it comes up with the error ArrayIndexOutOfBounds), but I can't understand what the problem is...
    I have a code that loads files (using File objects) from the current directory (a .jar file) into the program. I do not simply type in the file names - I set it so that the program searches for them based on a prefix in the file name. This works fine on my computer, and I never navigate to files outside of the .jar file. Why might this have a problem on a server? Would URL objects be more appropriate?
    Note: I alter the file base String in this way before loading it (this stands for the current directory)
    fileBase = applet.codeBase.toString().replace('\\', '/');codeBase is simply the applet's codeBase() method put into a URL variable. The replace statement is there so that there are no backslashes. And this works perfectly on my computer. Any help? Would it work if I used a URL instead? If so, how do I perform a search function with a URL (so that all the filenames within a certain directory are returned as Strings)?

    Thanks for the info, it helps a lot. You say there is no "practical" way to search for a file under a URL path. What I am trying to do is load a file that begins with a particular prefix. (eg. I wish to load a file called "funnyImage0011204924." However, the numbers after the prefix "funnyImage" are variable, and might require change in the future. Is it possible to load any file with the prefix "funnyImage," using URL methods? Would I need to create a new class? Is this impossible?)
    Please remember that I do not plan to go outside the .jar file, so there is no point in trying to get around server permissions and all that if it is unnecessary.

  • Help needed regarding JDeveloper and ADF

    Hi All,
    I am new to ADF customization in JDeveloper. Can any of the experts here, guide me how to start and get myself expertise in ADF. Actually i have been doing some experiments like creating trains,connecting to DB etc., from few days back. But the main thing is i could'nt able to figure out the usage of each and every component. So try to help me.
    Thanks in advance.

    Hi,
    check
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/index-101235.html - All samples
    http://download.oracle.com/docs/cd/E21764_01/apirefs.1111/e12419/toc.htm - new tag Doc 11.1.1.5
    http://download.oracle.com/docs/cd/E18196_01/11.1.2.0.0/main_11.1.2.0.0.html - new sample 11.1.2.0

  • Help needed with header and upload onto business catalyst

    Can someone help with a problem over a header please?
    I have inserted a rectangle with a jpeg image in  background, in the 'header' section, underneath the menu. It comes up fine on most pages when previsualised, going right to the side of the screen, but stops just before the edge on certain pages. I have double checked that I have placed it in the right place in relation to the guides on the page.
    That's one problem.
    The second problem is that I tried to upload onto business catalyst, which got to 60% and refused to go any further, saying it couldn't find the header picture, giving the title and then u4833-3.fr.png. The picture is in the right folder I have double checked. And it isn't a png. Does it have to be ?
    And the third problem is that I got an email following my upload from business catalyst in Swedish. I am living in France.
    Can anyone help ? Thanks.

    Thanks for replying,
    How can I check the preview in other browsers before I publish a provisional site with BC?
    The rectangle width issue happens on certain pages but not others. The Welecom page is fine when the menu is active, also the contact page, but others are slightly too narrow. Changing the menu spacing doesn’t help - I was already on uniform but tried changing to regular and back.
    In design mode the rectangle is set to the edge of the browser, that’s 100%browser width right?
    Re BC I have about 200 images on 24 different pages and it seems to be having difficulty uploading some of them. But it has managed a couple I named with spaces but not others I named with just one name.
    Is there an issue on size of pictures ? If I need to replace is there a quick way to rename and relink or do I have to insert the photos all over again?
    I’m a novice with Muse with an ambitious site !
    Thanks for your help.
    Mary Featherstone
    Envoyé depuis Courrier Windows
    De : Sanjit_Das
    Envoyé : vendredi 14 février 2014 22:15
    À : MFeatherstone
    Re: Help needed with header and upload onto business catalyst
    created by Sanjit_Das in Help with using Adobe Muse CC - View the full discussion 
    Hi
    Answering the questions :
    - Have you checked the preview in Muse and also in other browsers ?
    - Does the rectangle width issue happens when menu is active , or in any specific state , Try to change the menu with uniform spacing and then check.
    - In design view the rectangle is set to 100% browser width ?
    With publishing :
    - Please try to rename the image file and then relink
    - If it happens with other images as well , see if all the image names includes strange characters or spaces.
    - Try again to publish
    With e-mail from BC :
    - Under preferences , please check the country selected.
    - If you have previously created partner account in BC and selected country and language then it would follow that, please check that.
    Thanks,
    Sanjit
    Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/6121942#6121942
    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/6121942#6121942
    To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/6121942#6121942. In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in Help with using Adobe Muse CC at Adobe Community
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/thread/416458?tstart=0.

  • Moving buttons and their listeners to separate classes

    Hi
    I am trying to move out buttons and their listeners to separate classes, but when I do so, the program stops working. When I click on the button they dont react, probably the listeners doesent listens as the action performe prints out testprints.
    In other words, I have huge troubles with do my gui object oriented. I doesent seem to be able to move out relevant listener methods and their components to separate classes.
    Here is the code for one add button that I have tried to write in a separate class:
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.sql.SQLException;
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
    import javax.swing.JButton;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    import se.cs.DB.DBMovie;
    import se.cs.inputvalidation.PatternsMovie;
    import se.cs.main.Main;
    import se.cs.main.MessageArea;
    public class ButtonAddMovie {
         private DBMovie init = new DBMovie();
         private ComboBoxesMovie comboBoxesMovie = new ComboBoxesMovie();
         private TextFieldsMovie textFieldsMovie = new TextFieldsMovie();
         private PatternsMovie patternsMovie = new PatternsMovie();
         private MessageArea messageArea = new MessageArea();
         private Pattern patternYear;
         private Pattern patternSection;
         private Pattern patternExFields;
         private Matcher matcherYear;
         private Matcher matcherSection;
         private Matcher matcherTotalEx;
         private Matcher matcherExIn;
         private Matcher matcherExOut;
         private String genreString;
         // Initializes the button components
         private JButton addButton = new JButton("Add");
         public ButtonAddMovie() {
              listener();
         public void listener() {
              addButton.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        addButton(e);
         public void addButton(ActionEvent e) {
              genreString = comboBoxesMovie.convertGenreIndex();
              regex();
         public void regex() {
              patternYear = Pattern.compile(patternsMovie.getYEAR_FIELD());
              patternSection = Pattern.compile(patternsMovie.getSECTION_FIELD());
              patternExFields = Pattern.compile(patternsMovie.getExFields());
              matcherYear = patternYear.matcher(textFieldsMovie.getTextYear());
              matcherSection = patternSection.matcher(textFieldsMovie.getTextYear());
              matcherTotalEx = patternExFields.matcher(textFieldsMovie
                        .getTextTotalEx());
              matcherExIn = patternExFields.matcher(textFieldsMovie.getTextExIn());
              matcherExOut = patternExFields.matcher(textFieldsMovie.getTextExOut());
              if (matcherYear.matches() && matcherSection.matches()
                        && matcherTotalEx.matches() && matcherExIn.matches()
                        && matcherExOut.matches()) {
                   messageArea.getMessageArea().setText("");
                   callInsertStatement();
                   JOptionPane.showMessageDialog(null, this.messageDialog(),
                             "Movie added", JOptionPane.INFORMATION_MESSAGE);
              else if (!matcherYear.matches()) {
                   messageArea.getMessageArea().setText(
                             "The input for year field does not match.\n"
                                       + "You have to enter 4 digits.");
              else if (!matcherSection.matches()) {
                   messageArea.getMessageArea().setText(
                             "The input for section field does not match.\n"
                                       + "You have to enter 1-4 digits.");
              else if (!matcherTotalEx.matches()) {
                   messageArea.getMessageArea().setText(
                             "The input for total ex field does not match.\n"
                                       + "You have to enter 1.");
              else if (!matcherExIn.matches()) {
                   messageArea.getMessageArea().setText(
                             "The input for ex in does not match.\n"
                                       + "You have to enter 1 digit.");
              else if (!matcherExOut.matches()) {
                   messageArea.getMessageArea().setText(
                             "The input  for ex out does not match.\n"
                                       + "You have to enter 1 digits.");
         public void callInsertStatement() {
              try {
                   init.insertStatement(textFieldsMovie.getTextTitle(),
                             textFieldsMovie.getTextYear(), genreString, comboBoxesMovie
                                       .convertGradeIndex(), textFieldsMovie
                                       .getTextSection(),
                             textFieldsMovie.getTextTotalEx(), textFieldsMovie
                                       .getTextExIn(), textFieldsMovie.getTextExOut());
              } catch (SQLException ex) {
                   ex.printStackTrace();
         public String messageDialog() {
              int grade = comboBoxesMovie.getGradeBox().getSelectedIndex() + 1;
              String title = textFieldsMovie.getTitleField().getText();
              String year = textFieldsMovie.getYearField().getText();
              String section = textFieldsMovie.getSectionField().getText();
              String totalEx = textFieldsMovie.getTotalExField().getText();
              String exIn = textFieldsMovie.getExInField().getText();
              String exOut = textFieldsMovie.getExOutField().getText();
              return "\n" + "Title: " + title + "\n" + "Year: " + year + "\n"
                        + "Genre: " + comboBoxesMovie.convertGenreIndex() + "\n"
                        + "Grade: " + grade + "\n" + "Section: " + section + "\n"
                        + "Total ex.: " + totalEx + "\n" + "Ex. in: " + exIn + "\n"
                        + "Ex. out: " + exOut + "\n";
          * Gets the addButton
          * @return addButton
         public JButton getAddButton() {
              return addButton;
         }

    I said "don't" cross-post and that the discussion has already been started in the "New To Java" forum.
    If you have two discussions going on then people waste time answering because they don't know what has already been suggested.

  • Why is the decline button for phone calls not available when the phone is locked? I need that button and it shows only when the phone is not locked on iOS 7

    Why is the decline button for phone calls not available when the phone is locked? I need that button and it shows only when the phone is not locked on iOS 7

    Yep. You need to touch the sleep/power button once to silence the ring, and twice in order for the call to go directly to Voicemail.
    Personally, I dont understand why Apple eliminated this. If you wish to give Apple feedback, do it here:
    www.apple.com/feedback

  • Dynamic Creation of Buttons and Actions HELP

    Hi there,
    I have got a problem (or maybe even two) with the dynamic Creation of buttons. The code below creates the buttons.
    My main problem is, that the parameter created for the button's action isn't propagated to the assigned event handler. I get a null, though the name of the parameter in the event handler and the name of the parameter added to the action are the same.
    Could it also be that I'm always using the same action? I.e. does wdThis.wdGetAddElementAction() always return the same action instance? If yes, how can I create individual actions for each button?
    Any help is appreciated!
    Cheers,
    Heiko
    "    for(int i=rootContainer.getChildren().length; i<wdContext.nodeFeature().size();i++)
                   IPrivateVCT_Feature.IFeatureElement featureElement = wdContext.nodeFeature().getFeatureElementAt(i);
                   IWDTray featureTray = (IWDTray) view.createElement(IWDTray.class, featureElement.getName());
                   IWDCaption header = (IWDCaption) view.createElement(IWDCaption.class, featureElement.getName()+"_Header");
                   header.setText(featureElement.getName());
                   featureTray.setHeader(header);
                   featureTray.setExpanded(false);
                   rootContainer.addChild(featureTray);
                   IWDButton button = (IWDButton) view.createElement(IWDButton.class, featureElement.getName()+"_Button_AddElement");
                   IWDAction actionAddElement = wdThis.wdGetAddElementAction();
                   actionAddElement.getActionParameters().addParameter("featureIndex", new Integer(i).toString());
                   button.setOnAction(actionAddElement);
                   button.setText("Add Element");
                   featureTray.addChild(button);

    Hi Heiko,
    You have done everything correctly....except for 1 line
    in the code...
    Replace the following line in your code:
    actionAddElement.getActionParameters().addParameter("featureIndex", new Integer(i).toString());
    Replace the above line with this code:
    button.mappingOfOnAction().addParameter("featureIndex",i);
    Actually in your code, you are not associating the parameter with the button...
    Note that addParameter(...) comes with two signatures: addParameter(String param, String value) and addParameter(String param, int value). You can use any of them based on yuor need.
    Hope it helps,
    Thanks and Regards,
    Vishnu Prasad Hegde

  • Help needed with Button action performed

    Hi,
    I am new to AWT prgramming .
    I have created a menu called " Menu System Test window " and it contains toplevel menu items of "File" and "Help" and File Menu contains subitems "Product Evaluation" and "Exit".
    When i click File->Product Evaluation it displays a new Frame named "ProductEvaluationMeasurementTool" with some check boxes ,radiobuttons, buttons and text fields. So when i select some checkboxes in that new frame and click the button labeled "Metricslevel" it displays some resultin textField1 , similarly when i click Button labeled "Measurementlevel" it displays some result in textField2.
    My question is i have another button in Frame Called "Reset". When i click the Reset button all the check boxes which have been checked previously should be unchecked and moreover the result in both the textfield should be cleared.
    I am sending my code. Kindly help me.
    Thanks in advance.
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.Component;
    import java.awt.Checkbox;
    import javax.swing.*;
    // Make a main window with two top-level menus: File and Help.
    // Help has a submenu and demonstrates a few interesting menu items.
    public class MainWindow extends Frame {
      public MainWindow() {
        super("Menu System Test Window");
        setSize(500, 500);
        // make a top level File menu
        FileMenu fileMenu = new FileMenu(this);
        // make a top level Help menu
        HelpMenu helpMenu = new HelpMenu(this);
        // make a menu bar for this frame 
        // and add top level menus File and Menu
        MenuBar mb = new MenuBar();
        mb.add(fileMenu);
        mb.add(helpMenu);
        setMenuBar(mb);
        addWindowListener(new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            exit();
      public void exit() {
        setVisible(false); // hide the Frame
        dispose(); // tell windowing system to free resources
        System.exit(0); // exit
      public static void main(String args[]) {
        MainWindow w = new MainWindow();
        w.setVisible(true);
    // Encapsulate the look and behavior of the File menu
    class FileMenu extends Menu implements ActionListener {
      MainWindow mw;  // who owns us?
      public FileMenu(MainWindow m) {
        super("File");
        mw = m;
        MenuItem mi;
        add(mi = new MenuItem("ProductEvaluation"));
        mi.addActionListener(this);
        add(mi = new MenuItem("Exit"));
        mi.addActionListener(this);
      // respond to the Exit menu choice
      public void actionPerformed(ActionEvent e) { String item = e.getActionCommand();
        if (item.equals("ProductEvaluation"))
         Frame f = new Frame("ProductMeasurementEvaluationTool");
         f.setSize(1290,1290);
         f.setLayout(null);
         TextField t1 = new TextField("textField1");
         t1.setBounds(230, 630, 50, 24);
         f.add(t1);
         TextField t2 = new TextField("textField2");
         t2.setBounds(430, 630, 50, 24);
         f.add(t2);
         ActionListener al = new MyActionListener(f, t1);
         ActionListener a2 = new MyActionListener(f, t2);
         Label l1 = new Label("Select the appropriate metrics for Measurement Process Evaluation");
         l1.setBounds(380, 50, 380, 20);
         f.add(l1);
         Label l2 = new Label("Architecture Metrics");
         l2.setBounds(170, 100, 110, 20);
         f.add(l2);
         Label l3 = new Label("RunTime Metrics");
         l3.setBounds(500, 100, 110, 20);
         f.add(l3);
         Label l4 = new Label("Documentation Metrics");
         l4.setBounds(840, 100, 130, 20);
         f.add(l4);
         JRadioButton rb1 = new JRadioButton("Componenent Metrics",false);
         rb1.setBounds(190, 140, 133, 20);
         f.add(rb1);
         JRadioButton rb2 = new JRadioButton("Task Metrics",false);
         rb2.setBounds(540, 140, 95, 20);
         f.add(rb2);
         JRadioButton rb3 = new JRadioButton("Manual Metrics",false);
         rb3.setBounds(870, 140, 108, 20);
         f.add(rb3);
         JRadioButton rb4 = new JRadioButton("Configuration Metrics",false);
         rb4.setBounds(190, 270, 142, 20);
         f.add(rb4);
         JRadioButton rb5 = new JRadioButton("DataBase Metrics",false);
         rb5.setBounds(190, 420, 122, 20);
         f.add(rb5);
         JRadioButton rb6 = new JRadioButton("DataHandling Metrics",false);
         rb6.setBounds(540, 270, 142, 20);
         f.add(rb6);
         JRadioButton rb7= new JRadioButton("HumanInterface Metrics",false);
         rb7.setBounds(540, 420, 156, 20);
         f.add(rb7);
         JRadioButton rb8 = new JRadioButton("Development Metrics",false);
         rb8.setBounds(870, 270, 141, 20);
         f.add(rb8);
         JRadioButton rb9= new JRadioButton("Marketing Metrics",false);
         rb9.setBounds(870, 420, 121, 20);
         f.add(rb9);
         Checkbox  c10 = new Checkbox("Size");
         c10.setBounds(220, 170, 49, 20);
         f.add(c10);
         Checkbox c11 = new Checkbox("Structure");
         c11.setBounds(220, 190, 75, 20);
         f.add(c11);
         Checkbox c12 = new Checkbox("Complexity");
         c12.setBounds(220, 210, 86, 20);
         f.add(c12);
         Checkbox c13 = new Checkbox("Size");
         c13.setBounds(220, 300, 49, 20);
         f.add(c13);
         Checkbox c14 = new Checkbox("Structure");
         c14.setBounds(220, 320, 75, 20);
         f.add(c14);
         Checkbox c15 = new Checkbox("Complexity");
         c15.setBounds(220, 340, 86, 20);
         f.add(c15);
         Checkbox c16 = new Checkbox("Size");
         c16.setBounds(220, 460, 49, 20);
         f.add(c16);
         Checkbox c17 = new Checkbox("Structure");
         c17.setBounds(220, 480, 75, 20);
         f.add(c17);
         Checkbox c18 = new Checkbox("Complexity");
         c18.setBounds(220, 500, 86, 20);
         f.add(c18);
         Checkbox c19 = new Checkbox("Size");
         c19.setBounds(580, 170, 49, 20);
         f.add(c19);
         Checkbox c20 = new Checkbox("Structure");
         c20.setBounds(580, 190, 75, 20);
         f.add(c20);
         Checkbox c21 = new Checkbox("Complexity");
         c21.setBounds(580, 210, 86, 20);
         f.add(c21);
         Checkbox c22 = new Checkbox("Size");
         c22.setBounds(580, 300, 49, 20);
         f.add(c22);
         Checkbox c23 = new Checkbox("Structure");
         c23.setBounds(580, 320, 75, 20);
         f.add(c23);
         Checkbox c24 = new Checkbox("Complexity");
         c24.setBounds(580, 340, 86, 20);
         f.add(c24);
         Checkbox c25 = new Checkbox("Size");
         c25.setBounds(590, 460, 49, 20);
         f.add(c25);
         Checkbox c26 = new Checkbox("Structure");
         c26.setBounds(590, 480, 75, 20);
         f.add(c26);
         Checkbox c27 = new Checkbox("Complexity");
         c27.setBounds(590, 500, 86, 20);
         f.add(c27);
         Checkbox c28 = new Checkbox("Size");
         c28.setBounds(920, 170, 49, 20);
         f.add(c28);
         Checkbox c29 = new Checkbox("Structure");
         c29.setBounds(920, 190, 75, 20);
         f.add(c29);
         Checkbox c30 = new Checkbox("Complexity");
         c30.setBounds(920, 210, 86, 20);
         f.add(c30);
         Checkbox c31 = new Checkbox("Size");
         c31.setBounds(920, 300, 49, 20);
         f.add(c31);
         Checkbox c32 = new Checkbox("Structure");
         c32.setBounds(920, 320, 75, 20);
         f.add(c32);
         Checkbox c33 = new Checkbox("Complexity");
         c33.setBounds(920, 340, 86, 20);
         f.add(c33);
         Checkbox c34 = new Checkbox("Size");
         c34.setBounds(930, 450, 49, 20);
         f.add(c34);
         Checkbox c35 = new Checkbox("Structure");
         c35.setBounds(930, 470, 75, 20);
         f.add(c35);
         Checkbox c36 = new Checkbox("Complexity");
         c36.setBounds(930, 490, 86, 20);
         f.add(c36);
         Button b1  = new Button("MetricsLevel");
         b1.setBounds(230, 600, 120, 24);
         f.add(b1);
         b1.addActionListener(al);
         Button b2  = new Button("MeasurementLevel");
         b2.setBounds(430, 600, 120, 24);
         f.add(b2);
         b2.addActionListener(a2);
         Button b3  = new Button("Reset");
         b3.setBounds(630, 600, 120, 24);
         f.add(b3);
         f.show();
        else
       { mw.exit();}
    class MyActionListener implements ActionListener
        Frame f;
        TextField textField1;
        TextField textField2;
        public MyActionListener(Frame f, TextField tf)
            this.f = f;
            textField1 = tf;
            textField2 = tf;
        public void actionPerformed(ActionEvent e)
           String s = e.getActionCommand();
        if (s.equals("MetricsLevel"))
            Component[] components = f.getComponents();
      int numOfCheckBoxes = 81;
      int numChecked = 0;
      for ( int i = 0; i < components.length; i++ )
       if ( components[i] instanceof Checkbox )
        Checkbox checkBox = (Checkbox) components;
    if ( checkBox.getState() )
    numChecked++;
    double ratio = (double) numChecked / (double) numOfCheckBoxes;
    textField1.setText( Double.toString( ratio ) );
    else
    if (s.equals("MeasurementLevel"))
    Component[] components = f.getComponents();
    int numOfCheckBoxes = 81;
    int numChecked = 0;
    for ( int i = 0; i < components.length; i++ )
    if ( components[i] instanceof Checkbox )
    Checkbox checkBox = (Checkbox) components[i];
    if ( checkBox.getState() )
    numChecked++;
    double ratio = (double) numChecked / (double) numOfCheckBoxes;
    textField2.setText( Double.toString( ratio ) );
    else
    if (s.equals("Reset"))
    Code for Reset Button action performed.
    // Encapsulate the look and behavior of the Help menu
    class HelpMenu extends Menu implements ActionListener {
    MainWindow mw; // who owns us?
    public HelpMenu(MainWindow m) {
    super("Help");
    mw = m;
    MenuItem mi;
    add(mi = new MenuItem("Description"));
    mi.addActionListener(this);
    // respond to a few menu items
    public void actionPerformed(ActionEvent e) {
    String item = e.getActionCommand();
    if (item.equals("Description"))
    System.out.println("You can get description at our website");

    import java.awt.*;
    import java.awt.event.*;
    // Make a main window with two top-level menus: File and Help.
    // Help has a submenu and demonstrates a few interesting menu items.
    public class MainWindow extends Frame
      public static void main(String args[])
        new MainWindow();
      public MainWindow()
        super("Menu System Test Window");
        setSize(500, 500);
        // Why not make 1 menubar class that you can add with
        // this.setMenuBar(new MyMenuBar(this)); ?
        // make a top level File menu
        FileMenu fileMenu = new FileMenu(this);
        // make a top level Help menu
        HelpMenu helpMenu = new HelpMenu(this);
        // make a menu bar for this frame
        // and add top level menus File and Menu
        MenuBar mb = new MenuBar();
        mb.add(fileMenu);
        mb.add(helpMenu);
        this.setMenuBar(mb);
        this.setVisible(true);
        this.addWindowListener(new WindowAdapter()
          public void windowClosing(WindowEvent e)
            System.exit(0);
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.JRadioButton;
    //Encapsulate the look and behavior of the File menu
    public class FileMenu extends Menu implements ActionListener
      private MainWindow mw; // who owns us?
      private MenuItem itmPE   = new MenuItem("ProductEvaluation");
      private MenuItem itmExit = new MenuItem("Exit");
      public FileMenu(MainWindow main)
        super("File");
        this.mw = main;
        this.itmPE.addActionListener(this);
        this.itmExit.addActionListener(this);
        this.add(this.itmPE);
        this.add(this.itmExit);
      // respond to the Exit menu choice
      public void actionPerformed(ActionEvent e)
        if (e.getSource() == this.itmPE)
          Frame f = new Frame("ProductMeasurementEvaluationTool");
          f.setSize(1290, 1290);
          f.setLayout(null);
          TextField t1 = new TextField("textField1");
          t1.setBounds(230, 630, 50, 24);
          f.add(t1);
          TextField t2 = new TextField("textField2");
          t2.setBounds(430, 630, 50, 24);
          f.add(t2);
          // Way to ugly..
          // ActionListener al = new MyActionListener(f, t1);
          // ActionListener a2 = new MyActionListener(f, t2);
          // see below...
          Label l1 = new Label("Select the appropriate metrics for Measurement Process Evaluation");
          l1.setBounds(380, 50, 380, 20);
          f.add(l1);
          Label l2 = new Label("Architecture Metrics");
          l2.setBounds(170, 100, 110, 20);
          f.add(l2);
          Label l3 = new Label("RunTime Metrics");
          l3.setBounds(500, 100, 110, 20);
          f.add(l3);
          Label l4 = new Label("Documentation Metrics");
          l4.setBounds(840, 100, 130, 20);
          f.add(l4);
          JRadioButton rb1 = new JRadioButton("Componenent Metrics", false);
          rb1.setBounds(190, 140, 133, 20);
          f.add(rb1);
          // Please do not use AWT and Swing components in the same frame.
          JRadioButton rb2 = new JRadioButton("Task Metrics", false);
          rb2.setBounds(540, 140, 95, 20);
          f.add(rb2);
          JRadioButton rb3 = new JRadioButton("Manual Metrics", false);
          rb3.setBounds(870, 140, 108, 20);
          f.add(rb3);
          JRadioButton rb4 = new JRadioButton("Configuration Metrics", false);
          rb4.setBounds(190, 270, 142, 20);
          f.add(rb4);
          JRadioButton rb5 = new JRadioButton("DataBase Metrics", false);
          rb5.setBounds(190, 420, 122, 20);
          f.add(rb5);
          JRadioButton rb6 = new JRadioButton("DataHandling Metrics", false);
          rb6.setBounds(540, 270, 142, 20);
          f.add(rb6);
          JRadioButton rb7 = new JRadioButton("HumanInterface Metrics", false);
          rb7.setBounds(540, 420, 156, 20);
          f.add(rb7);
          JRadioButton rb8 = new JRadioButton("Development Metrics", false);
          rb8.setBounds(870, 270, 141, 20);
          f.add(rb8);
          JRadioButton rb9 = new JRadioButton("Marketing Metrics", false);
          rb9.setBounds(870, 420, 121, 20);
          f.add(rb9);
          Checkbox c10 = new Checkbox("Size");
          c10.setBounds(220, 170, 49, 20);
          f.add(c10);
          Checkbox c11 = new Checkbox("Structure");
          c11.setBounds(220, 190, 75, 20);
          f.add(c11);
          Checkbox c12 = new Checkbox("Complexity");
          c12.setBounds(220, 210, 86, 20);
          f.add(c12);
          Checkbox c13 = new Checkbox("Size");
          c13.setBounds(220, 300, 49, 20);
          f.add(c13);
          Checkbox c14 = new Checkbox("Structure");
          c14.setBounds(220, 320, 75, 20);
          f.add(c14);
          Checkbox c15 = new Checkbox("Complexity");
          c15.setBounds(220, 340, 86, 20);
          f.add(c15);
          Checkbox c16 = new Checkbox("Size");
          c16.setBounds(220, 460, 49, 20);
          f.add(c16);
          Checkbox c17 = new Checkbox("Structure");
          c17.setBounds(220, 480, 75, 20);
          f.add(c17);
          Checkbox c18 = new Checkbox("Complexity");
          c18.setBounds(220, 500, 86, 20);
          f.add(c18);
          Checkbox c19 = new Checkbox("Size");
          c19.setBounds(580, 170, 49, 20);
          f.add(c19);
          Checkbox c20 = new Checkbox("Structure");
          c20.setBounds(580, 190, 75, 20);
          f.add(c20);
          Checkbox c21 = new Checkbox("Complexity");
          c21.setBounds(580, 210, 86, 20);
          f.add(c21);
          Checkbox c22 = new Checkbox("Size");
          c22.setBounds(580, 300, 49, 20);
          f.add(c22);
          Checkbox c23 = new Checkbox("Structure");
          c23.setBounds(580, 320, 75, 20);
          f.add(c23);
          Checkbox c24 = new Checkbox("Complexity");
          c24.setBounds(580, 340, 86, 20);
          f.add(c24);
          Checkbox c25 = new Checkbox("Size");
          c25.setBounds(590, 460, 49, 20);
          f.add(c25);
          Checkbox c26 = new Checkbox("Structure");
          c26.setBounds(590, 480, 75, 20);
          f.add(c26);
          Checkbox c27 = new Checkbox("Complexity");
          c27.setBounds(590, 500, 86, 20);
          f.add(c27);
          Checkbox c28 = new Checkbox("Size");
          c28.setBounds(920, 170, 49, 20);
          f.add(c28);
          Checkbox c29 = new Checkbox("Structure");
          c29.setBounds(920, 190, 75, 20);
          f.add(c29);
          Checkbox c30 = new Checkbox("Complexity");
          c30.setBounds(920, 210, 86, 20);
          f.add(c30);
          Checkbox c31 = new Checkbox("Size");
          c31.setBounds(920, 300, 49, 20);
          f.add(c31);
          Checkbox c32 = new Checkbox("Structure");
          c32.setBounds(920, 320, 75, 20);
          f.add(c32);
          Checkbox c33 = new Checkbox("Complexity");
          c33.setBounds(920, 340, 86, 20);
          f.add(c33);
          Checkbox c34 = new Checkbox("Size");
          c34.setBounds(930, 450, 49, 20);
          f.add(c34);
          Checkbox c35 = new Checkbox("Structure");
          c35.setBounds(930, 470, 75, 20);
          f.add(c35);
          Checkbox c36 = new Checkbox("Complexity");
          c36.setBounds(930, 490, 86, 20);
          f.add(c36);
          ActionListener action = new MyActionListener(f, t1, t2);
          Button b1 = new Button("MetricsLevel");
          b1.setBounds(230, 600, 120, 24);
          b1.addActionListener(action);
          f.add(b1);
          Button b2 = new Button("MeasurementLevel");
          b2.setBounds(430, 600, 120, 24);
          b2.addActionListener(action);
          f.add(b2);
          Button b3 = new Button("Reset");
          b3.setBounds(630, 600, 120, 24);
          b3.addActionListener(action);
          f.add(b3);
          f.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e)
              System.exit(0);
          f.show();
        else if (e.getSource() == this.itmExit)
          System.exit(0);
    import java.awt.*;
    import java.awt.event.*;
    //Encapsulate the look and behavior of the Help menu
    public class HelpMenu extends Menu implements ActionListener
      private MainWindow main; // who owns us?
      private MenuItem itmDescription = new MenuItem("Description");
      public HelpMenu(MainWindow main)
        super("Help");
        this.main = main;   
        this.itmDescription.addActionListener(this);
        this.add(this.itmDescription);
      // respond to a few menu items
      public void actionPerformed(ActionEvent e)
        if (e.getSource() == this.itmDescription)
          System.out.println("You can get description at our website");
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.JRadioButton;
    public class MyActionListener implements ActionListener
      private Frame     frame;
      private TextField textField1;
      private TextField textField2;
      public MyActionListener(Frame frame, TextField tf1, TextField tf2)
        this.frame = frame;
        this.textField1 = tf1;
        this.textField2 = tf2;
      public void actionPerformed(ActionEvent e)
        String s = e.getActionCommand();
        if (s.equals("MetricsLevel"))
          Component[] components = this.frame.getComponents();
          int numOfCheckBoxes = 81;
          int numChecked = 0;
          for (int i = 0; i < components.length; i++)
            if (components[i] instanceof Checkbox)
              if (((Checkbox)components).getState())
    numChecked++;
    double ratio = (double) numChecked / (double) numOfCheckBoxes;
    this.textField1.setText(Double.toString(ratio));
    else if (s.equals("MeasurementLevel"))
    Component[] components = frame.getComponents();
    int numOfCheckBoxes = 81;
    int numChecked = 0;
    for (int i = 0; i < components.length; i++)
    if (components[i] instanceof Checkbox)
    if (((Checkbox)components[i]).getState())
    numChecked++;
    double ratio = (double) numChecked / (double) numOfCheckBoxes;
    this.textField2.setText(Double.toString(ratio));
    else if (s.equals("Reset"))
    this.textField1.setText("");
    this.textField2.setText("");
    for (int i = 0; i < this.frame.getComponentCount(); i++)
    Component c = this.frame.getComponent(i);
    if (c instanceof JRadioButton)
    ((JRadioButton)c).setSelected(false);
    else if (c instanceof Checkbox)
    ((Checkbox)c).setState(false);

  • Re: Satellite A500 - need some help with FN button and Toshiba programs

    Hi,
    The FN button, Eco button and other specialized buttons such as the one which opens Windows Media Player have stopped responding on my A500 PSAM3A-03P00E which runs Windows Vista. I can still change screen brightness with the FN button but no menu appears at the top of the screen.
    Also the Toshiba programs which are meant to run at start up such as PC Health Monitor are not auto starting, even though they are selected in System Configuration (msconfig).
    Bluetooth manager is however running at start up.
    I have previously had blue screen errors however they are not a problem since I updated the BIOS to 1.5 and uninstalled Zonealarms.
    Cheers

    Thanks all,
    All problems have been fixed after downloads of Toshiba value added package and the new version of PC Health Monitor (V1.3.2.0).

  • Help needed to implement both Action and TextListener

    This my code. How can i use ActionListener for the conv button and yet retrive the values from my textFields like TextListener. You may adjust the code so I can relly learn whats the trick. Try to add the difference in between the spaces so I can see the difference Thank you!!
    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    public class project extends Applet implements ActionListener {
    TextField TT,UNIT,unit,PVmax,PVmin,max,min,Table;
    Button conv;
    String UNIT1 = null;
    String unit1 = null;
    double PVmax1 = 0;
    double PVmin1 = 0;
    double max1 = 0;
    double min1 = 0;
    double PV1 = 0;
    public void init() {
         TT=new TextField();
         UNIT=new TextField();
         unit=new TextField();
         PVmax=new TextField();
         PVmin=new TextField();
         max=new TextField();
         min=new TextField();
         Table= new TextField();
              Panel p = new Panel();
    p.setLayout(new GridLayout(9,2,5,5));
    p.add( new Label("Enter transmitter type"));
    p.add( new Label());
    p.add( new Label("(e.g. Pressure,Level,Flow etc.) :"));
    p.add(TT);
    p.add( new Label("Enter PV unit:"));
    p.add(UNIT);
    p.add( new Label("Enter Max. Sensing PV value:"));
    p.add(PVmax);
    p.add( new Label("Enter Min. Sensing PV value:"));
    p.add(PVmin);
    p.add( new Label("Enter transmitter Output Unit:"));
    p.add(unit);
    p.add( new Label("Enter transmitter max. Output:"));
    p.add(max);
    p.add( new Label("Enter transmitter min. Output:"));
    p.add(min);
    p.add( new Label("Enter table length :"));
    p.add(Table);
    add(p);
    conv = new Button ("Start Conversion");
    add(conv);
    conv.addActionListener(this);
    public void actionPerformed (ActionEvent event) {
    PV1 = PVmax1-PVmin1;
    repaint();
    public void paint (Graphics g) {
    PV1 = PVmax1-PVmin1;
    g.drawString(" Pressure Transmitter Conversion Table " ,10,320);
    g.drawString(" Transmitter Input (" + UNIT1 + ")" ,10,350);
    g.drawString(" Transmitter Output (" + unit1 + ")" ,200,350);
    g.drawString("PV value " + PV1 , 1,360);

    public void actionPerformed (ActionEvent event) {
        Unit1=Char.parseChar(unit.getText());
        max1=Integer.parseInt(max.getText());
        PV1 = PVmax1-PVmin1;
    }not sure whether it will work u must try.....

  • Help needed Regarding Project Server - 2013 Workflow

    Hi All,
    I am new to Project server 2013 Workflow, hence please help me regarding this. Pardon me if this question is too trivial. 
    I have created a project type associated with a workflow and my workflow is as follows :
    So I am not doing anything here, I am just testing the workflow as mentioned by technet site : http://technet.microsoft.com/en-us/library/dn458865(v=office.15).aspx
    But it is mentioned that, after a minute or 2, the workflow state will change, also they have mentioned to press the Submit button.
    But in my case, the workflow is not moving to next stage [It just says 'The workflow is still processing - which never changes after hours] or I am getting the submit button (Submit button is disabled on the ribbon). Below is the state of my workflow :
    PS : I have made the user added to Portfolio managers group as well. But still I am having this same issue. 
    The Workflow manager is installed properly, and it is working fine in case of List workflow. I am facing the issue only wrt Site workflow for Project server 2013.
    Please help me to solve this issue.
    Thanks,
    shanky

    Hi Kiran,
    I am now facing issue while assigning a task to a person in the workflow.
    I am having a person named say 'John' , who is included in Project Manager as well as Portfolio Manager.
    And I am using a workflow as :
    Stage : Conceptual
    Assign a task to John (Task outcome to Variable: Outcome5 | Task ID to Variable: TaskID3 )
    Transition to stage
    Go to Approval
    But this is again giving issue as :
    Workflow Internal status : Cancelled
    Details: System.ApplicationException: HTTP 401 {"error":{"code":"-2147024891, System.UnauthorizedAccessException","message":{"lang":"en-US","value":"Access denied. You do not have
    permission to perform this action or access this resource."}}}
    PS : I have used the same Sharepoint admin account for 'Account Name' in ‘User Profile Sync' , Is this causing the issue? Please let me know.
    Thanks,
    Shanky

  • Is there a way to trigger button's action listeners from key events?

    I rarely do GUI programming, especially not in Java. But now I am working on a GUI app and would like to get some help.
    Say I have a simple GUI consists of a JFrame, and a bunch of buttons on its JToolBar. The buttons on the JToolBar are for navigation of a set of documents, first, prev, next, last etc. All buttons are assigned action command strings, and their all trigger the same instance of action listener. inside of the action listener, it does the correct navigation based on the action command from the event.
    but some users want to be able to use the keyboard to do the navigation, because they think clicking the buttons are too slow.
    So is there a graceful way to receive the different key press events and trigger corresponding navigation actions (hopefully it reuses the code that is already there, e.g. the action listener)? thanks.
    -- Jim

    but some users want to be able to use the keyboard to do the navigation, because they think clicking the buttons are too slow. That is always the case in any GUI. Any application should be designed to use either the mouse or the keyboard.
    All buttons are assigned action command strings,That is not the way the GUI should be designed.
    Instead you should be creating Actions. Then you can add the Action to a button and you can associate the Action with a KeyStroke which is called "Key Binding". This is the way all Swing components work. You can read the [url http://download.oracle.com/javase/tutorial/uiswing/TOC.html]Swing tutorial for more information and examples. Start with the section on:
    a) How to Use Actions
    b) How to Use Key Bindings

Maybe you are looking for