Can i put images on a button

Hi i have some omages which i need to put on a button can i do that in java. I cannot use swings cause i am using java 1.1.7. can i do something using awt.
Is there ImageButton in jdk 1.1.7 ???
Please help me in this.
Please post a sample code if any one can
Thanks
Ram

Hi This is my actual program.
I have some images posted and some buttons. But can i click on the images to open new files or can i put an image on a button. I donno how to use mouse click. or how do i map an image.
Can i also mouse click on a text string???
import java.awt.*;
import java.awt.event.*;
import java.awt.event.MouseEvent;
import java.applet.*;
import java.io.*;
import java.lang.String;
public class chemviz extends Frame implements ActionListener
     private Button offwaltz, nanocad;
     private Panel PagePanel, buttonPanel;
     private Image logo;
     private Image nanocadhome, waltzhome;
     //private TextArea TextArea1;
     private String About = "About";
     private String test= "This is a Test";
     //test.setFont(new Font("Arial",Font.BOLD,12));
     public String line1 = "ChemViz (Chemistry Visualization) is an interactive chemistry program which incorporates computational chemistry simulations ";
     public String line2 = "and visualizations for use in the high school chemistry classroom. The chemistry simulations support the chemistry principles ";
     public String line3 = "teachers are trying to convey, and the visualizations allow students to see how matter interacts at an atomic level.";
     public void loadPanel()
          //ImageIcon offwaltz = new ImageIcon("images/waltzhome.jpg");
          //offwaltz = new Button(offwaltz);
          offwaltz = new Button("OffWaltz");
          offwaltz.addActionListener(this);
          nanocad = new Button("Nanocad");
          nanocad.addActionListener(this);
          buttonPanel = new Panel(new FlowLayout(FlowLayout.CENTER));
          buttonPanel.add(offwaltz);
          buttonPanel.add(nanocad);
          //TextArea1 =new TextArea(text, 10, 100);
          MenuBar mb = new MenuBar();
          setMenuBar(mb);
          Menu fileMenu = new Menu("File");
          mb.add(fileMenu);
          MenuItem exitMenuItem = new MenuItem("Exit");
          fileMenu.add(exitMenuItem);
          exitMenuItem.addActionListener(this);     
          PagePanel = new Panel();
          PagePanel.setLayout(new GridBagLayout());
          GridBagConstraints c = new GridBagConstraints();
          c.anchor = GridBagConstraints.NORTH;
          c.gridwidth = 1;
          c.gridx = 0;
          c.gridy = GridBagConstraints.RELATIVE;
          c.weightx = 1;
          c.weighty = 1;
          c.insets = new Insets(0, 0, 0, 0);
          //PagePanel.add(TextArea1, c);
          //PagePanel.add(buttonPanel, c);
          setLayout(new GridBagLayout());
          add(PagePanel, c);
          PagePanel.setLocation(0, 100);
          //PagePanel.setSize(100, 100);
          setVisible(true);
     public void update(Graphics g)
          paint(g);
     public void paint (Graphics g)
          g.drawImage(logo, 0, 30, this);
          //g.drawString(About, 20,150);
          //setFont(new Font("Arial",Font.BOLD,12));
          g.drawString("About", 20,130);
          g.drawString("Tools", 70,130);
          g.drawString("Curriculum", 120,130);
          g.drawString("Resources", 200,130);
          //g.drawString("Test", 690,130);
          //g.drawString("This is a Test String", 20,130);
          g.drawString(line1, 50,175);
          g.drawString(line2, 20,200);
          g.drawString(line3, 20,225);
          g.drawRect(38,373,148,168);
          g.drawImage(nanocadhome, 40, 375, this);
          g.drawRect(248,373,148,168);
          g.drawImage(waltzhome, 250, 375, this);
          //System.out.println("Test is ending");
     public void imagePanel()
          logo = Toolkit.getDefaultToolkit().getImage("images/logo.jpg" );
          nanocadhome = Toolkit.getDefaultToolkit().getImage("images/nanocadhome.jpg" );
          waltzhome = Toolkit.getDefaultToolkit().getImage("images/waltzhome.jpg" );
     public void actionPerformed(ActionEvent e)
          String s = e.getActionCommand();
          String osCommand = "cmd /q /c start /w";
          if (e.getSource() instanceof MenuItem)
               String menuLabel = ((MenuItem)e.getSource()).getLabel();
               if(menuLabel.equals("Exit"))
                    dispose();
                    System.exit(0);
          if (e.getActionCommand().equals("OffWaltz"))
               try
                    Runtime.getRuntime().exec("cmd.exe /c java -jar offwaltz.jar ");
               catch (IOException ex)
                    System.out.println( ex.toString() );   
         if (e.getActionCommand().equals("Nanocad"))
          try
                    Runtime.getRuntime().exec("cmd.exe /c java -jar nanocad.jar ");
               catch (IOException ex)
                    System.out.println( ex.toString() );   
     public static void main(String args[])
          chemviz frame = new chemviz();
          frame.addWindowListener(new WindowAdapter()
               public void windowClosing(WindowEvent e)            
                    {               System.exit(0);        }});
               frame.setSize(800, 600);
               frame.imagePanel();
               frame.loadPanel();
               frame.setVisible(true);

Similar Messages

  • How can i put image in a button?

    I need to put an image ( .bmp ) in a button, but i don't know how.
    I need it because in web forms the icons ( files .ico) no show.
    How can i solve this problem?
    Thanks!!

    Hello Arun ,
    Thank you for your help. i tried it but it didn't work. i am sure that is my fault. i try to create a toolbar and i place a button in the toolbar. Then i set the property iconic to yes and i give to the iconfilename property the name of my bmp file. i suppose that the application cannot see the bmp file. i'll try to read some documentation , because as i can see it's little difficult.
    again thanx for your help Arun.

  • Can i put image on background of my menu..........

    plz help i have a nokia 5233 n i want to put images on background of my menus.....plz help

    Actually, you cant put images in the background of the menu. It was never possible on symbian phones. The only way you'll get the images there through a theme, and only the theme image can be seen there. You'll have to make your own theme if you want. Just google for carbide UI.
    If you find my post helpful please click the green star on the left under the avatar. Thanks.

  • Problems putting Images inside large buttons

    The problem below is using the Fireworks program to create a
    Button with an Image inside.
    Ok I have created a generic button , This button is not a
    fireworks button it was made from scratch, the size is roughly
    90x90 , what I want to do is place and Image inside this button and
    then to be able to move the image into the correct place, If I
    paste the image into the button it simply places the image where it
    wants I cannot move the image , I tried creating a Layer and Frame
    and using the marque tool but it pastes the image top left hand
    corner and the image cannot be moved.
    Where am I going wrong.?.
    SPECCY.

    do this in an image editor. It would be much simpler/easier
    and more
    reliable that using html.
    If you still want to do it in html, put the button image as a
    background.
    > Where am I going wrong.?.

  • In formscentral, can I put images in dropdowns

    I need to put images into drop-downs in the formcentral form design.  Am I able to do this?  How?

    Thanks, but it should be!
     Ken Banner
    0lllllll0
    home: 336-856-1461
    mobile: 336-895-8305

  • Can't put image into the body of Yahoo Email.

    Although easily done using I.E or Outlook, any attempt to paste an image into the body of a Yahoo Mail results in nothing happening when using Firefox. I do NOT want to use I.E.
    This is a major problem. Attachments are no solution. In many industries, including mine, we like to send flyers as images or IN-LINE documents via email.
    Will Firefox / Mozilla address this issue?
    Is there a solution already?

    I have 2 FF windows open. One to view my picture and one with Yahoo mail. If I click and drag the picture into my Yahoo mail body, it works. Can't do copy/paste like in IE.

  • How can i put image in table column

    Hii
    I have to make one application in which i m going through JTable but look shoud not be like that ....border of row and column should be invisiable and in the last column Image should be displayed....... i m unable to find this..
    can anybody help me ...
    Vaibhav Gupta

    Both of these question have been answered recently, like in the last 30 minutes. Check out other threads for you answers.
    Cheers
    DB

  • Can I put images in pop ups?

    My original iBA ebook that I plan to remake in InDesign epub contains many popups that include images as well as text. I see several references to making pop up "footnotes" in InDesign epub, but so far have found nothing about placing images in pop ups. Can it be done? The use of the word, "footnotes" worries me a bit, just in case it implies some kind of limitation on pop up use. My pop ups are not footnotes, but more like mini pages within pages...

    Thank you, Bob.
    With IBA being my full experience in making epub to date, I guess I got little spoiled on making things like pop ups and was hoping the process could be just as straight forward and easy in InDesign. Looks like I've got some real learning to do. Maybe after I get it all down, I will like InDesign better.

  • Put Image on label

    How can I put Image on label in flex can any one tel me

    import events.ToolbarEvent;
    import mx.events.FlexEvent;
    import mx.events.ItemClickEvent;
    import mx.events.SliderEvent;
    import mx.core.*;
    import spark.skins.spark.ImageSkin;
    import ui.presenters.MainPresentationModel;
                [Bindable]
                public var fileButtons:Array = [{label:"Open"},{label:"Save"}];
                [Bindable]
                public var navButtons:Array =
                    {label:"Adjust",state:MainPresentationModel.ADJUST_STATE},
                    {label:"Touchup",state:MainPresentationModel.TOUCHUP_STATE},
                    {label:"Effects",state:MainPresentationModel.EFFECT_STATE}
                [Bindable]
                public var historyButtons:Array = [{label:"Undo"},{label:"Redo"}];
                private function handleFileClick(e:ItemClickEvent):void
                    if (e.label == "Open")
                        dispatchEvent(new ToolbarEvent(ToolbarEvent.OPEN));
                    else if (e.label == "Save")
                        dispatchEvent(new ToolbarEvent(ToolbarEvent.SAVE));
                private function handleNavClick(e:ItemClickEvent):void
                    callLater(handleNavigation,[e.item.state]);
                private function handleNavigation(state:String):void
                    if (navBar.selectedIndex == -1)
                        dispatchEvent(new ToolbarEvent(ToolbarEvent.SHOW));
                    else
                        dispatchEvent(new ToolbarEvent(ToolbarEvent.SHOW,true,false,state));
                private function handleHistoryClick(e:ItemClickEvent):void
                    if (e.label == "Undo")
                        dispatchEvent(new ToolbarEvent(ToolbarEvent.UNDO));
                    else if (e.label == "Redo")
                        dispatchEvent(new ToolbarEvent(ToolbarEvent.REDO));
                private function handleZoomChange(e:SliderEvent):void
                    dispatchEvent(new ToolbarEvent(ToolbarEvent.ZOOM, true, false, null, e.value));
            ]]>
        </mx:Script>
        <mx:ButtonBar dataProvider="{fileButtons}" itemClick="handleFileClick(event)"   />
        <mx:ToggleButtonBar id="navBar" dataProvider="{navButtons}" toggleOnClick="true"
            creationComplete="event.target.selectedIndex=-1" itemClick="handleNavClick(event)"/>
        <mx:Button label="Show Source" click="dispatchEvent(new ToolbarEvent(ToolbarEvent.SRC))"  />
        <mx:Spacer width="100%" />
        <mx:ButtonBar dataProvider="{historyButtons}" itemClick="handleHistoryClick(event)"  />
        <mx:HSlider value="1.0" minimum="0.1" maximum="3.0" snapInterval="0.1" liveDragging="true" change="handleZoomChange(event)" />
    </mx:HBox>
    can u please tell me how can i add image on Button bar in this code???

  • Need advice. Is it necessary to put images in folders and subfolders with LR?

    It seems that the concept of spending hours putting files into folders, sub-folders and sub-sub-folders is not needed  with LR. Creating all these folders takes hours, especially if you are like me and need a major reorganization of image organization. My thought is that all images can go into one massive folder as long as they are properly tagged. I can then use LR Smart Collections to essentially virtually organize all my images. I can create many more sorting options using Smart Collections than I can by putting images into a folder. This flies in the face of everything I've learned about storing data on a computer so I'm nervouse to head this direction because it starts with unorganizing my folders and removing all tags so I can start fresh.
    I don't want to take this on only to learn I didn't think of a gotcha issue. One drawback is that you are now committed to find anything by using LR or tags only. What do you think?

    Lee Jay wrote:
    Okay, then be honest.  What would you do if you were me?....So - give me an honest recommendation on a go-forward path (no "coulda, woulda, shoulda's").
    Honestly, I always start off from assessing what you really need or what value you could get from keywording. I wouldn't advise you to add keywords for their own sake.
    Lee Jay wrote:
    Meanwhile, I can already find all my images efficiently in seconds in nearly all cases.  I estimate that there is about one situation per year where having a comprehensively keyworded image store would be helpful in saving me time - perhaps 15 minutes each time that happens.
    Let's pretend that this isn't quite as black and white as you always put it. Let's say we're mainly talking weddings - typically wedding photographers add few keywords, if any. And let's say you do need to find certain images more often - each time you go to meet prospective clients you want to put on your iPad (you?) a portfolio of your best work for their broad type of wedding. So you might have categories like indoors / outdoors / subaqua, particular venues, age groups, religions through humanist,  formal / weird. Let's assume you do judge it worthwhile to increase the number of keywords.
    Lee Jay wrote:
    I could start tagging images now as I collect them.  But then I'd have all those other images that aren't tagged and all the new ones that are.  That means using the smart-collection approach would mean all the new ones were in neat collections, and all the old ones were in a gigantic "untagged" collection with over 100,000 images in it.
    Actually, that is the way I would advise you to go. Don't let the perfect be the enemy of the possible. It's not at all uncommon that people are put off beginning doing some keywording by the scale of the complete task. But beginning with the images that you're currently working on isn't too much extra effort. Even if it turns out that you never eventually do go back and keyword the old stuff, in a year's time you'll have a whole year's worth tagged. While doing so you'll probably adopt ways to make keywording less of a chore. For example you might add metadata presets to slap on overall keywords for the typical shoot "Wedding, Ceremonies, Christian" and then one or more keyword sets if you can justify putting time into varying the keywords between images - eg Bride, Kids, Cake. I wouldn't waste any time building up a hierarchy (do if you want, or not if you don't).
    I simply wouldn't worry about the 100,000 remaining untagged - they'll be easier to tackle once you're you've got the experience / benefits from keywording new stuff. I'd advise you to do it only as and when you need - it's too big a task to do anything else. Let's say you need your best shots of Jewish weddings and - as you're currently keeping a lot of metadata in your head - you know some are in that untagged mass. Find them through the folder system as you do now, whack on some keywords like "Wedding, Jewish, Non-orthodox". All those shots are of the bride - whack on "Bride" (maybe from a keyword set). Hey, she's got an obvious tattoo - let's just add that keyword just in case it'll be useful. And quickly move on. Whatever seems worthwhile.
    Although scripting could help, where's the script? Worthwhile to write/adapt one yourself? Instead for folder names I'd just just smart collections to gather image - eg folder name contains "weddings" - and then slap on the keywords. Sure, there will be some duplication between the pseudo-metadata in the folder names and in keywords, but duplication happens with metadata. In fact, it'll be quicker to search by the keyword "Wedding" than search for images with the keyword "Wedding" and / or with the folder name containing "Wedding".
    So that's how I'd advise you - start with the new work, and deal with the older stuff ad hoc.
    John

  • Since update to 10.6.8 can't export images from powerpoint and also other programs

    Ever since I updated my software to 10.6.8 I can't export images from Powerpoint or from a graphing software GraphPad Prism.  It's really frustrating.  I had no problems at all until this update. Is there any way to revert my version to the old OS 10.6?
    I can't work when I can't put images into illustrator!
    Thanks, AOH

    I just contacted Final Draft and they helped me with it. If you have FD and are going to upgrade an OS, Deactivate Final Draft first then re-activate it once the new OS is installed.

  • TabbedPanels Tab - How can we put individual images on each tab button?

    Hi,
    How can we put individual propeties (like size, background images etc) in each tab button of TabbedPanels Tab?
    Thanks

    Wow ! Itz amazing !! .... This is what 'm exactly looking for
    Thanks a lot Gramps
    Alin

  • PUT IMAGE ON BUTTON BAR

    How could i put image on Buttonbar for all different buttons on it can u please help me thNK YOU

    answered in your other post...

  • On Firefox 4, how can I put one "new tab" on the "tab bar" (The + sign) and one next to the "back/forward" buttons (as in FF 3.6)?

    On Firefox 4, how can I put one "new tab" on the "tab bar" (The + sign) and one next to the "back/forward" buttons (as in FF 3.6)?
    In my current Firefox, the "new tab" icon/item from the "customize" pop-up window menu of items is placed next to my home, back, forward buttons near the top-left of my header (Button 1 for "new tab"). Then, the tab bar automatically come with a small tab (with a + sign) to the right of your last tab opened (so you click on + and a new tab opens. Button 2 for "new tab"). I like to have this "new tab" button twice (as a + mini tab, and next to my "home icon".
    When I upgraded to Firefox 4, I seemed to be only able to "customize" or use the "new tab" in one place. Either as an icon next to home button, or as a "+ minitab", but NOT both.
    What can I do to put this button in Firefox 4 on BOTH places???
    Your help is really appreciated. I want to upgrade, but I want my buttons on both places...
    I upgraded to FF 4, but downgraded again just because this feature... that's just me of coarse :-)

    *New tab toolbar button: https://addons.mozilla.org/firefox/addon/new-tab-toolbar-button/

  • The bookmarks toolbar is there but has no item buttons on it. How do I get the items back for this toolbar? Also would like to know if the toolbars can be put on the same line to make more room on the page (drag & drop) ??

    The bookmarks toolbar is there but has no item buttons on it. How do I get the items back for this toolbar?
    Also would like to know if the toolbar can be put on the same line to make more room on the page (drag & drop) ?? Like the menu & bookmarks toolbar could/should fit on same line. This would add more page view...
    Floyd Perry
    Thanks

    Check that you still have the "Bookmarks Toolbar items" placed on the Bookmarks Toolbar
    * Make sure that you have the "Bookmarks Toolbar" visible: "View > Toolbars"
    * Check in "View > Toolbars > Customize" that the "Bookmarks Toolbar items" is on the Bookmarks Toolbar
    * If the "Bookmarks Toolbar items" is not on the Bookmarks Toolbar then drag it back from the Customize window onto the Bookmarks Toolbar
    * If you do not see the "Bookmarks Toolbar items" then click the "Restore Default Set" button
    You can only move the content from a toolbar onto other toolbars if all toolbars support that feature. You need to check that in the options of each toolbar.

Maybe you are looking for