How to Add AWT Frame to JMenubar....

I was using AWT Frame for my project ... Now I want to add Menubar ... I was added AWT Menubar ... but its not looking fine .... So i want to add JMenubar ....
What i will do....
Thnaks in Advance...

if you must
import java.awt.*;
import java.awt.event.*;
class Testing
  public void buildGUI()
    javax.swing.JMenuItem open = new javax.swing.JMenuItem("Open");
    javax.swing.JMenuItem exit = new javax.swing.JMenuItem("Exit");
    javax.swing.JMenu menu = new javax.swing.JMenu("File");
    menu.add(open);
    menu.add(exit);
    javax.swing.JMenuBar menuBar = new javax.swing.JMenuBar();
    menuBar.add(menu);
    Frame f = new Frame();
    f.add(menuBar,BorderLayout.PAGE_START);
    f.setSize(200,100);
    f.setLocationRelativeTo(null);
    f.setVisible(true);
    f.addWindowListener(new WindowAdapter(){
      public void windowClosing(WindowEvent we){
        System.exit(0);
  public static void main(String[] args)
    EventQueue.invokeLater(new Runnable(){
      public void run(){
        new Testing().buildGUI();
}

Similar Messages

  • How to add a frame dynamically in a jsp page.

    Hai all,
    In my application, in a particular jsp page i had the 3 links namely add.edit and delete. When click on add button, it is pointing to another jsp page where i can enter user details. But what i want now is when i click add button, the form in which we fill the user details should be added to the current page itself dynamically i.e., it should not go to another page when i click add button and that form should be displayed in the current page in a new frame dynamically.
    The same should happen when i click n edit or delete options. everything should be diaplayed in the same page in different frames.
    Can anyone suggest me about how to add a frame dynamically.

    You create a frameset with two frames. One frame you give 100% of the rows and run the JSP in this frame. The other frame you give 0% of the row so that it is hidden. In the JSP you use a JavaScript funtion to submit the form. This function will call the parent frameset to reset the row values to 50%/50% which will make the bottom frame visible and then submit the form request with the bottom frame as teh target.
    It is not so much as creating frames as using JavaScript to hide and display frames.

  • How to add key frames in CC

    I'm just trying out CC and can hardly get past get-go :-(
    I surfed for help for 45 minutes and found nothing useful.
    Sadly after telling people people for at least 15 years that Adobe has great products but the worst help files of probably any major company, it's still true.
    Adobe help still assumes that you know the answer that your looking for :-(  Whenever I surf for help I try anything before a URL marked Adobe.
    Anyway that's why I"m here ;-)
    I'm staring at the CC timeline and I wan't to fade in both picture and sound; so how do I add key frames?
    Thanks,
    Michael

    @Shooternz
    Firstly, I really do appreciate your help and thanks to it I now know how to add the key frames.
    But to give you an example of Adobe type help and to show that I'm not just being a grouch ;-)
    I followed your link which took me to - Premiere Pro / Adding, navigating, and setting keyframes.
    Great!
    But does the article start with "How to add key frames"? 
    No it doesn't :-(
    The article is presented in this order,
    View keyframes and graphs
    Move the current-time indicator to a keyframe
    Add, select, and delete keyframes
    Modify keyframe values
    Why?
    Why doesn't it start with Add, select, and delete keyframes which would be logical?
    Thanks to you I also managed to find http://helpx.adobe.com/pdf/premiere_pro_reference.pdf
    Michael

  • NEW to pse and to forum, how to add a frame?

    I have never used Photoshop. I would like to add a white frame around  a photo. can anyone share how to do this? I hope i can figure out how to get back here to read the answer! LOL

    If you hit the F1 key to open the online Help, in the upper right corner there's an icon to "View as PDF".  Click on it and you can save the PDF to your hard drive.  That's a very good thing to do because then you can search the PDF, which you can't do with the online help.
    I learned PSE by reading that help file and watching the Adobe TV tutorials (some of which have sample files for downloading so you can practice with the same images used in the tutorial).
    Others will have to jump in with recommendations for books, since I haven't looked at any of the books.
    Ken

  • How to add SWC frame work to flex 2

    hi,
    i Want to use flexmdi framework for one of mine project. how
    to do this?. i know simple one that just adding the *.SWC to flex
    ADD SWC. i did it and it is not working. is there steps to do
    this?.. this is not question for only flexmdi, i dont know how to
    use other component frameworks also.
    So plesae let me know the steps to work with SWC component
    frameworks in flex 2.
    thanks in Advance
    shrikant

    In Flex Builder, select your project and open its Properties.
    Select the Flex Build Path. On the window, select the Library tab.
    Pick the Add SWC button and browse to the SWC and pick OK. It will
    be added to the search path.
    If you are using the command line compiler (mxmlc or compc)
    use the library-path option.

  • How to add checkboxes to frame

    So I have two classes in my package. I am having trouble adding the checkbox group to my frame. I got it to add to my applet but I can not figure out how to add it to my frame. Here is what I have so far. When I run this program it puts the checkboxes in my applet and not in my frame.
    this is my painter class:
    package pt;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2006</p>
    * <p>Company: </p>
    * @author unascribed
    * @version 1.0
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    public class painter extends Applet {
    private int xValue=-10, yValue=-10;
    MyFrame x;
    Checkbox Red, Black, Magenta, Blue, Green, Yellow;
    CheckboxGroup cbg;
    public void init()
    x= new MyFrame("Christie's Window");
    x.show();
    x.resize(250,100);
    cbg = new CheckboxGroup();
           Red = new Checkbox("Red", cbg,true);
           Black = new Checkbox("Black", cbg,false);
           Magenta = new Checkbox("Magenta",cbg,false);
           Blue = new Checkbox("Blue", cbg, false);
           Green = new Checkbox("Green", cbg, false);
           Yellow = new Checkbox("Yellow", cbg, false);
           add(Red);
           add(Black);
           add(Magenta);
           add(Blue);
           add(Green);
           add(Yellow);
         addMouseMotionListener(new MotionHandler(this));
    public void paint(Graphics g)
    g.drawString("Drag the mouse to draw", 10, 20);
    g.fillOval(xValue, yValue, 4,4);
    //Override Component class update method to allow all ovals
    // to remain on the screen by not clearing the background
    public void update(Graphics g)   { paint(g); }
    // set the drawing coordinates and repaint
    public void setCoordinates(int x, int y)
      xValue = x;
      yValue = y;
      repaint();
    // Class to handle only mouse drag events for the Drag applet
    class MotionHandler extends MouseMotionAdapter {
      private painter dragger;
      public MotionHandler(painter d)  { dragger = d; }
      public void mouseDragged( MouseEvent e)
        { dragger.setCoordinates( e.getX(), e.getY() );   }
        } and here is MyFrame class:
    package pt;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2006</p>
    * <p>Company: </p>
    * @author unascribed
    * @version 1.0
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    public class MyFrame extends Frame {
    MyFrame(String x){
       super(x);
        public boolean handleEvent(Event evtObj) {
          if(evtObj.id==Event.WINDOW_DESTROY) {
            hide();
            return true;
          return super.handleEvent(evtObj);
    }

    here's your conversion, with listeners to change the color
    //import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    //public class painter extends Applet {
    class painter extends Frame {
    Color color = Color.RED;
    private int xValue=-10, yValue=-10;
    //MyFrame x;
    Checkbox Red, Black, Magenta, Blue, Green, Yellow;
    CheckboxGroup cbg;
    //public void init()
    public painter()
    //x= new MyFrame("Christie's Window");
    setTitle("Christie's Window");
    //x.show();
    //x.resize(250,100);
    setSize(600,400);
    setLocation(200,100);
    cbg = new CheckboxGroup();
           Red = new Checkbox("Red", cbg,true);
           Red.addItemListener(new ItemListener(){
            public void itemStateChanged(ItemEvent ie){
              if(Red.getState()) color = Color.RED;}});
           Black = new Checkbox("Black", cbg,false);
           Black.addItemListener(new ItemListener(){
            public void itemStateChanged(ItemEvent ie){
              if(Black.getState()) color = Color.BLACK;}});
           Magenta = new Checkbox("Magenta",cbg,false);
           Magenta.addItemListener(new ItemListener(){
            public void itemStateChanged(ItemEvent ie){
              if(Magenta.getState()) color = Color.MAGENTA;}});
           Blue = new Checkbox("Blue", cbg, false);
           Blue.addItemListener(new ItemListener(){
            public void itemStateChanged(ItemEvent ie){
              if(Blue.getState()) color = Color.BLUE;}});
           Green = new Checkbox("Green", cbg, false);
           Green.addItemListener(new ItemListener(){
            public void itemStateChanged(ItemEvent ie){
              if(Green.getState()) color = Color.GREEN;}});
           Yellow = new Checkbox("Yellow", cbg, false);
           Yellow.addItemListener(new ItemListener(){
            public void itemStateChanged(ItemEvent ie){
              if(Yellow.getState()) color = Color.YELLOW;}});
    Panel p = new Panel();
           p.add(Red);
           p.add(Black);
           p.add(Magenta);
           p.add(Blue);
           p.add(Green);
           p.add(Yellow);
    add(p,BorderLayout.NORTH);
         addMouseMotionListener(new MotionHandler(this));
    addWindowListener(new WindowAdapter(){
          public void windowClosing(WindowEvent we) { System.exit(0); }});
    public void paint(Graphics g)
    super.paint(g);
    g.setColor(color);
    g.drawString("Drag the mouse to draw", 10, 75);
    g.fillOval(xValue, yValue, 4,4);
    //Override Component class update method to allow all ovals
    // to remain on the screen by not clearing the background
    public void update(Graphics g)   { paint(g); }
    // set the drawing coordinates and repaint
    public void setCoordinates(int x, int y)
      xValue = x;
      yValue = y;
      repaint();
    // Class to handle only mouse drag events for the Drag applet
    class MotionHandler extends MouseMotionAdapter {
      private painter dragger;
      public MotionHandler(painter d)  { dragger = d; }
      public void mouseDragged( MouseEvent e)
        { dragger.setCoordinates( e.getX(), e.getY() );   }
      public static void main(String[] args){new painter().setVisible(true);}
    }

  • Does anyone know how to add multiple pictures to a single frame in iMovie?

    Does anyone know how to add multiple pictures to a single frame in iMovie?

    Maybe you would be better off posting this in the iPhoto or iDVD categories of the forums.
    http://discussions.apple.com/category.jspa?categoryID=143
    http://discussions.apple.com/category.jspa?categoryID=128
    The answer to your question depends on what you ant to do with the DVD.
    Do you want a DVD menu, slide show etc.
    iPhoto will allow you to burn straight to a DVD. Just select the album you want to burn then go to share in the tool bar and select Burn.

  • How to add HTTP Header Response X-Frame-Options:SAMEORIGIN from OWA published via Forefront TMG 2010 to stop Clickjacking

    How to add HTTP Header Response X-Frame-Options:SAMEORIGIN from OWA published via Forefront TMG 2010 to stop Clickjacking. I have put the IIS setting X-Frame-Options:SAMEORIGIN  on my Internal CAS Server. However as the OWA page is published through
    Forefront TMG 2010, the iFrame tag is not blocked when the page is first opened. Only when you login with your credentials to the OWA page inside the frame and the page reaches IIS on the Internal CAS it gets blocked. I want to block it in the first
    instance when it is opened from TMG.

    Hi,
    Thank you for the post.
    To modify the http header, please refer to this blog:
    http://tmgblog.richardhicks.com/2009/03/27/using-the-isa-http-filter-to-modify-via-headers-and-prevent-information-disclosure/
    Regards,
    Nick Gu - MSFT

  • How to remove title bar in awt frame?

    how can i remove the title bar of frame and make it fullscreen so as to cover all the desktop?

    how can i remove the title bar of frame and make it
    fullscreen so as to cover all the desktop?foll should suffice in a simple situation
    import java.awt.Window;
    import java.awt.Frame;
    import java.awt.Toolkit;
    public class BigWindow extends Frame
         public BigWindow()
              //get screen size
              int height = (int)Toolkit.getDefaultToolkit().getScreenSize().getHeight();
              int width = (int)Toolkit.getDefaultToolkit().getScreenSize().getWidth();
              //make parent frame invisible
              this.setVisible(false);
              //create a new window without borders and titlebar
              Window window = new Window(this);
              window.setSize(width,height);
              window.setVisible(true);
         public static void main(String args[])
              new BigWindow();
    }

  • How To open applet inside AWT Frame

    Hi there !
    I want to open my applet directly inside a AWT Frame window from a hyper link...
    That is when a user clicks a hyper link i want to open my applet inside a AWT Frame...I do not want my applet to be opened inside a browser window is there any possibility to do this ...pls help me
    -Priya

    hi,
    i see one way, but i really do not know it works or not.
    Try the following:
    An applet is nothing more then a panel. So you can intanciate the applet:Class class1=new Class.forName(nameOfApplet);
    Applet a=(Applet)class1.newInstance(//maybe a parameter);
    frame.add(a);
    a.init(); //calling the init-method of the appletJust try, but I really can't commit you the workability.
    regards

  • How to prevent the automatic full-white repainting of an AWT Frame?

    Using Java 1.6.0, Windows XP, 1.6.0-b105 Client VM I have the following problem:
    I made a double buffered AWT frame. But it still flashes sometimes. It gives one flash about 6 seconds after start of application. There seems to be an incoming event "for no discernible reason". I have overridden all paint/repaint/update methods in my Frame sub class.
    These unwanted flashes are caused by the AWT painting the frame in white and then calling paint.
    I may have caught these weird calls:
    The good/normal case looks like:
    java.lang.Exception: Stack trace
    at java.lang.Thread.dumpStack(Thread.java:1206)
    at xed.xed_Frame.paint(xed_Frame.java:125)
    at xed.xed_Frame.update(xed_Frame.java:119)
    at sun.awt.RepaintArea.updateComponent(RepaintArea.java:239)
    at sun.awt.RepaintArea.paint(RepaintArea.java:216)
    at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:301)
    at java.awt.Component.dispatchEventImpl(Component.java:4486)
    at java.awt.Container.dispatchEventImpl(Container.java:2116)
    at java.awt.Window.dispatchEventImpl(Window.java:2429)
    at java.awt.Component.dispatchEvent(Component.java:4240)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
    The differences in the bad case: (Not all traces of this kind cause the flashing. But after all flashes there seems to be such a trace.)
    at xed.xed_Frame.paint(xed_Frame.java:125)
    at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)
    at sun.awt.RepaintArea.paint(RepaintArea.java:224)
    at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:301)
    So how do I stop these unwanted white redraws of the Frame?

    Accidentally found the answer:
    System.setProperty("sun.awt.noerasebackground", "true");

  • How to add scrollbar to the JInternal Frame

    How to add scrollbar to JInternal Frame?
    I have One JInternal frame i want it should have a scrollbar when we reduces its size.

    [url http://java.sun.com/docs/books/tutorial/uiswing/components/scrollpane.html]How to Use Scroll Panes

  • How can I add a frame around a photo?

    Can I add a frame to a photo in iPhoto without creating a book, calendar, or card?
    If not what other - simple - application can I use to do that?

    If you've looked through Themes and don't like them or the process of getting to them, there are a bunch of applications which will allow you to add borders or frames to images. Some are even free.
    I like GraphicConverter, which is about $35 in the Mac App Store. Also in the Mac App Store and free is SketchBookExpress.
    Remember to export the photos you wish to work with from iPhoto in order to access them with other applications.

  • How to remove the title bar of a frame(java.awt.Frame)?

    How to get a frame without any TitleBar?

    setUndecorated(true);
    This also gets rid of the minimize, normalize, and close buttons from the upper right corner of the screen--so have a way to close and resize if you need it.
    btw: do you know how to bring up the API docs?

  • FInvoice How to add the SOAP frame thru XSLT transform

    Dear All,
    i have the following problem i have implemented as xslt codeto send data from SAP Idoc invoic to WS Finvoic .
    the coding looking as following :
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <xsl:output encoding="ISO-8859-1"/>
         <xsl:template match="/">
              <!-- Create SOAP-Envelope -->
              <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:eb="http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd">
                   <!-- Create Header Container -->
                   <SOAP-ENV:Header>
                        <eb:MessageHeader xmlns:eb="http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd" SOAP-ENV:mustUnderstand="1" eb:id="">
                             <eb:From>
                                  <eb:PartyId>
                                       <xsl:value-of select="Finvoice/SellerOrganisationUnitNumber"/>
                                  </eb:PartyId>
                                  <eb:Role>Sender</eb:Role>
                             </eb:From>
                             <eb:From>
                                  <eb:PartyId>
                                       <xsl:value-of select="Finvoice//SellerBic"/>
                                  </eb:PartyId>
                                  <eb:Role>Intermediator</eb:Role>
                             </eb:From>
                             <eb:To>
                                  <eb:PartyId>
                                       <xsl:value-of select="Finvoice//InvoiceRecipientAddress"/>
                                  </eb:PartyId>
                                  <eb:Role>Receiver</eb:Role>
                             </eb:To>
                             <eb:To>
                                  <eb:PartyId>
                                       <xsl:value-of select="Finvoice//InvoiceRecipientIntermediatorAddress"/>
                                  </eb:PartyId>
                                  <eb:Role>Intermediator</eb:Role>
                             </eb:To>
                             <eb:CPAId>yoursandmycpa</eb:CPAId>
                             <eb:Service>Routing</eb:Service>
                             <eb:Action>ProcessInvoice</eb:Action>
                             <eb:MessageData>
                                  <eb:MessageId>
                                       <xsl:value-of select="Finvoice//SellerReferenceIdentifier"/>
                                  </eb:MessageId>
                                  <eb:Timestamp>
                                       <xsl:value-of select="Finvoice//InvoiceDate"/>
                                  </eb:Timestamp>
                             </eb:MessageData>
                        </eb:MessageHeader>
                   </SOAP-ENV:Header>
                   <!-- Create Body -->
                   <SOAP-ENV:Body>
                        <eb:Manifest eb:id="Manifest" eb:version="2.0">
                             <eb:Reference eb:id="Finvoice" xlink:href="1009">
                                  <eb:schema eb:location="http://www.finvoice.info/yrityksen_verkkolasku/ladattavat/Tekniset tiedostot/schemat/Finvoice.xsd"/>
                             </eb:Reference>
                        </eb:Manifest>
                   </SOAP-ENV:Body>
              </SOAP-ENV:Envelope>
              <!-- Add Finvoice msg. as Payload Container-->
              <xsl:text disable-output-escaping="yes">
         <?xml version="1.0" encoding="ISO-8859-15"?>
         </xsl:text>
    <xsl:text disable-output-escaping="yes">
    <!DOCTYPE Finvoice SYSTEM "Finvoice.dtd">
    </xsl:text>
    <xsl:processing-instruction name="xml-stylesheet">type="text/xsl" href="Finvoice.xsl"</xsl:processing-instruction>
    <xsl:copy-of select="*"/>
    </xsl:template>
    </xsl:stylesheet
    My problem is that I don't know how to add the doctype part via xslt:
    <?xml version="1.0" encoding="ISO-8859-15"?>
    <!DOCTYPE Finvoice SYSTEM "Finvoice.dtd">
    could sombody give me input concerning this
    Thank in advace.
    Best regards !

    Hi,
    I don't know if I completely understand your requirements,
    however, if you have the field DocType in your Idoc Structure Message, like follow:
    <EDI34243 doctype="XXX"/>
    You can use:
    <xsl:value-of select="@doctype"/>

Maybe you are looking for

  • Word wrap seems to expand.

    I have noticed for quite a while now that with some emails I reply to that my written txt goes off the page ie is does not stop at the edge of the screen and wraps, it carries on for several words and then comes back. its as if the word wrap feature

  • Stop auto recharge

    Please stop auto-recharge for my account. I didn't select any auto recharge option but Skype keeps recharging once the program expired. This is DECEPTION. I am considering raise a sue against Skype. So please stop any auto-recharge for my account.

  • Freehand keeps crashing in Snow Leopard

    Hi guys... Suddenly Freehand started crashing everytime I opened... Here is the log: Process:         FreeHand MX [640] Path:            /Applications/Macromedia FreeHand MXa/FreeHand MX.app/Contents/MacOS/FreeHand MX Identifier:      com.macromedia.

  • How to set integer type property using um:setProperty

    Using WLP 8.1 . Can anyone help to set integer type property programmatically. i tried <um:setProperty> . but it can send only string or object type not Integer. tia Mahesh

  • Interrupt at Level 6 not serviced

    Hi All, We have out in house developed pci card in a v240. When we start running the card through the driver I am getting the following prints in the messages file. we can see from the driver debug that the messages on the queue have already been pro