Create my own Component ???

When I try to create my own component, I have alway the problem that the components do not resize with setBounds() or something similar. My Component is always shown at the position 4/23 (which depends on the Microsoft Windows Frame-Border-Size with title) and the size of my component is always the full size of the owner-frame.
import java.awt.*;
import java.awt.event.*;
public class MyComponent extends Component implements MouseListener
    public MyComponent()
        setBounds(30, 30, 64, 64);      //this line was ignored
        setBackground(Color.white);
    public void paint(Graphics g)
        g.setColor(Color.black);
        g.drawRect(0, 0, 64, 64);
// Mouselistener interface implementation
    public void mouseClicked(MouseEvent e) {}
    public void mouseEntered(MouseEvent e) {}
    public void mouseExited(MouseEvent e) {}
    public void mousePressed(MouseEvent e) {}
    public void mouseReleased(MouseEvent e) {}
import java.awt.*;
import java.awt.event.*;
class Test extends Frame
    public Test()
        addWindowListener(new WindowAdapter()
                public void windowClosing(WindowEvent e)
                    dispose();
                    System.exit(0);
        MyComponent m = new MyComponent();
        m.setBounds(60, 60, 128, 128);       //this line was ignored, too
        add(m);
    public static void main(String args[])
        Test mainFrame = new Test();
        mainFrame.setSize(400, 400);
        mainFrame.setTitle("Test");
        mainFrame.setVisible(true);

Well, I believe the setBounds method is used when using Absolute Positioning. See the Swing tutorial on "Using Layout Managers":
http://java.sun.com/docs/books/tutorial/uiswing/layout/index.html
I don't use Frames but I know the default LayoutManager for a JFrame is the BorderLayout. By default any component added to a BorderLayout is placed in the CENTER of the layout and will resize to fill the available size of its container. Again, this information is contained in the above link.

Similar Messages

  • How can i create my own component

    hello all,
    how can i create my own componet,
    say for example i want to create my own JTextField.
    give me links, or give me a examples
    thanks
    daya

    http://www.onjava.com/pub/a/onjava/2004/08/11/desktop.html

  • How to create a new component using SPICE?

    People, I don't know how to create a new component using SPICE.
    I know that it's possible to create a new component and use a SPICE code, but I don't know how to do this very well, and I need the TI ISO124 (Isolation Amplifier), and I have no idea on how to do that. Can somebody help me? I need to develop a layout.
    Thank you!!

    Hi,
    Here is a tutorial that explains in details how to create your own component in Multisim using a SPICE model.
    Hope you find it helpful,
    Mahmoud W
    National Instruments

  • How to create a custom component in Integrator

    Hi everybody, I'm trying to develop a custom componente for Endeca Integrator, following this guide:
    http://www.cloveretl.com/blog/creating-your-own-component-in-cloveretl-step-by-step/
    but, even if I installed Plug-in Development Environment (PDE), I can't see plug-in options in File->New->Others section, so I can't follow guide steps.
    Is there any problem with my configuration of Integrator? Why can't I see plug-in development/deployment options anywhere in Integrator?
    Is there eventually another way to implement a custom component in Integrator?
    Thanks for your replies!

    No, it doesn't. It's like PDE has never been installed, but I try to reinstall it through "Help"->"Install new software" I receive an error because the plug-in is installed.

  • Component integration: Control framework / create your own gui controls

    Hi,
    Does anyone know where to find documentation about creating your own gui controls, like cl_gui_picture.
    For example we would like to make a zcl_gui_movie !!!
    Kind regards
    Keld Gregersen

    Hi Keld,
    Check out /people/thomas.jung3/blog/2004/09/01/using-net-windows-controls-in-the-abap-control-framework
    And
    /people/thomas.jung3/blog/2005/05/11/using-classic-activex-controls-in-the-abap-control-framework
    I have been able to create and use my own control in the SAP GUI - but I'm still trying to figure out how to handle any events raised by that control.
    If all you need to do is use the control to display something (like a movie!) it should work...
    If you can get some form of event processing working PLEASE let me know!!!
    Cheers,
    N

  • How to create new SW component for custome development?

    We are looking to develop custom webdynpros and need to create our own SW components. 
    I've tried to define them in the SLD that the NWDI is connected to and when creating the tracks for the custom development, I do not see our new defined SW when trying to add the SW component to the track.
    Any ideas?  Are we going about this the wrong direction?
    Thanks!!

    Once you add component in SLD if you want to add that component to your track ,there will be a button Update CMS in domain data or track data .click that and it will refresh and fetch your newly created component.then go ahead and add component to your track
    reward points if helpful

  • Creating custom jsp component - Finding the jsp tag descriptor htmlb.tld

    Hi,
    I want to create my own TabStrip component by extending the SAP Standard HTMLB components TabStrip and TabStripItem. I've found the classes that I need to extend under the jar below, but I can't find the htmlb.tld file. I need to make a copy of this file to create a tag descriptor for my new components in order to use them in my JSP.
    The classes I am using are in the com.sapportals.htmlb package, located in the file
    ECLIPSE_HOME/plugins/com.sap.tc.ap_2.0.0/comp/SAP_JTECHS/DCs/sap.com/com.sapportals.htmlb/_comp/gen/default/public/default/lib/java/htmlb.jar
    I've searched the jars in the "plugins" directory of NWDI but can't find it (although I did find some other tld files). I'm guessing it must be somewhere on the poertal, but where?
    Please help
    Thanks
    Any help would be greatly appreciated.

    If you have access to your portal's installation box - then you can get this TLD at the following paths:
    <Installation Drive>:\usr\sap\<SID>\<instance no>\j2ee\cluster\server0\apps\sap.com\com.sapportals.htmlb.ear\servlet_jsp\htmlb\root\WEB-INF
    OR
    <Installation Drive>:\usr\sap\<SID>\<instance no>\j2ee\cluster\server0\apps\sap.com\com.sapportals.htmlb.ear\servlet_jsp\htmlb\root
    OR
    <Installation Drive>:\usr\sap\<SID>\<instance no>\j2ee\cluster\server0\apps\sap.com\com.sap.engine.services.webservices.tool\servlet_jsp\uddiclient\root\WEB-INF
    Hope this helps!!!
    Shubhadip

  • No Access to SLD so cant create my own scenario

    Hi All,
    I dont have the access to SLD so cant create my own business system.
    Can anyone guide me how to check what all the business system and component available available.
    I also want to create a simple RFC to SOAP scenario.Do we have any standard RFC which I can use and create my scenario.
    Not Spcific just a general RFC I want to use to built a scenario.
    Thanks,
    Babu

    HI Sudheer
    If you dont have access to create a new B system , then you will have to use existing Bsystem.
    I think you should be knowing which system the RFC belongs to , or if its a Proof of concept that you are trying to do , you can use any existing Bsystem that you can find in ID under communication Component.If you dont have any B system, you will have to check with Admin to get one created for you.
    Below blogs should help
    RFC -> XI -> WebService - A Complete Walkthrough (Part 1)
    Regards
    Srinivas

  • Create complex custom component

    Hi everyone!
    I'm trying to create my own custom component in JSF. However I have several questions :
    - It is not mandatory to create a renderer class, right ? the component can draw itself ?
    - How can I create a custom component which would have several "values" inside ? for example let us supppose I want to create a custom JSF component to enter a IBAN. The IBAN is divided into several parts : BBAN, country code, key, Bank adresse,... but any tutorial I've found explain how to create a input component with only one simple value (for example the classical "CreditCardInputComponent").
    Josselin

    Hi,
    did you find a solution for your "composite" component problem?
    I am also trying to create a custom component that contains several standard jsf components such as HtmlCommandLink and HtmlInputText.
    I build all the standard components within my component programmatically using things like:
    HtmlCommandLink link = (HtmlCommandLink) application.createComponent(HtmlCommandLink.COMPONENT_TYPE);
    Also at the beginning of the encodeBegin I clear all children from my custom component using getChildren().clear()
    and rerender the component based on my new internal model which I updated during the previous decoding of my component.
    As a simple jsf custom tag it works ok, however, I am facing deep problems with action events as soon as I use the component within a jsf HtmlDataTable tag.
    Am I missing something here?
    Any ideas? Help is really really appreciated. This different behavior in different contexts is slowly but constantly driving me nuts.
    cheers
    hans

  • Tooltip doesn't show with own component

    Hello,
    I have my own component that paints some rectangles to a
    canvas. Now the problem is that I can't see the tooltip over my
    object. Here is wat I do
    var record:SessionRecord = new SessionRecord();
    record.height = TIMELINEHEIGHT;
    record.width = data.SESSION_TIME*TIMELINE_SECOND;
    record.x =
    ((data.SESSION_START_SEC*TIMELINE_SECOND)+MARGINLEFT)/2;
    record.y = yCanvasPointer/2;
    record.toolTip = "blabjdsqodhqhjiouqh";
    record.enabled = true;
    canvas.addChild(record);
    I've implemented the get/set method of the tooltip in my
    component class (actionscript class).
    public override function get toolTip():String
    return this.tooltipText;
    public override function set toolTip(value:String):void
    this.tooltipText = value;
    Anybody any idea ?
    Thanks!
    Ward

    quote:
    Originally posted by:
    Greg Lafrance
    The FB3 help topic "About creating advanced components"
    mentions the following about Flex components implemtning the
    IToolTipManagerClient interface:
    IToolTipManagerClient - Indicates that a component has a
    toolTip property, and therefore is monitored by the ToolTipManager.
    So maybe if you implement this interface you will have
    tooptip support.
    This is the interface I implemented (specifying the get/set
    tooltip methode)...

  • Create my own bib schema

    Hi,
    I followed the bi_beans demo installation guide. It worked well and I have been able to run the JDeveloper demos.
    Then I've tried to create my own dimensions/cubes/catalogs using OEnterprise Manager.
    I executed cwm2_olap_metadata_refresh and it told it was refreshed.
    Then things begin not working anymore:
    - In jdeveloper, the bi_beans demos don't work anymore
    - I used the bi_checkconfig program and it outputs:
    JDEV_ORACLE_HOME ............................. = c:\jdev
    JAVA_HOME .................................... = c:\jdev\jdk
    JDeveloper version ........................... = 9.0.3.1.1107
    BI Beans version ............................. = 9.0.3.6.0
    BI Beans internal version .................... = 2.7.0.13.1
    Connect to database .......................... = Successful
    JDBC driver version .......................... = 9.2.0.3.0
    JDBC JAR file location ....................... = c:\jdev\jdbc\lib
    Database version ............................. = 9.2.0.2.1
    OLAP Catalog version ......................... = N/A
    OLAP AW Engine version ....................... = N/A
    OLAP API Server version ...................... = N/A
    BI Beans Catalog version ..................... = 2.7.0.13.1
    OLAP API JAR file version .................... = 9.2
    OLAP API JAR file location ................... = c:\jdev\jdev\lib\ext
    Load OLAP API metadata ....................... = Successful
    Number of metadata folders ................... = 3
    Number of metadata measures .................. = 0
    Number of metadata dimensions ................ = 0
    Metadata output location ..................... = C:\Documents and Settings\rwout
    ers.DEVELOP\Desktop\BI Check\bi_metadata.txt
    Which is nearly perfect but the last 4 lines: Number of metadata dimensions which is now 0 (should be more)
    ==============================================================================
    Type Name (S=Schema, C=Cube, M=Measure, D=Dimension)
    ========= ====================================================================
    Folder... ROOT
    Folder... Financial data
    Folder... Sales Performance data
    Folder... TIMING_CAT
    So it sees the new catalog I created (TIMING_CAT) and the previous ones but It doesn't see anymore the cubes/.. from bibdemo and the mines as well.
    What should I do ? What did I wrong ?
    Rodolphe -

    Well, I believe the setBounds method is used when using Absolute Positioning. See the Swing tutorial on "Using Layout Managers":
    http://java.sun.com/docs/books/tutorial/uiswing/layout/index.html
    I don't use Frames but I know the default LayoutManager for a JFrame is the BorderLayout. By default any component added to a BorderLayout is placed in the CENTER of the layout and will resize to fill the available size of its container. Again, this information is contained in the above link.

  • Help,Help me!   I want to create  a custom component

    The first, I'm a chinese,my English is very poor.Maybe I make so many mistakes.so
    I say sorry for you.
    I want to create a custom component so I research the Java.awt.Component .but I don't understand that the class has a method-------dispatchEvent(AWTEvent e).I want to know what invoke this method and when invoke?
    thank u

    I believe ( believe mind you )
    that the method:
    public final void dispatchEvent(AWTEvent e)
    Dispatches an event to this component or one of its sub components. Calls processEvent before returning for 1.1-style events which have been enabled for
    the Component.
    Parameters: e - the event
    Is used to send an Event message to This component from another
    like :
    Say you have 'MyComponent1' sending Events to MyComponent2
    AWTEvent e = new AWTEvent( blah whatever.......);
    MyComponent2.dispatchEvent( e );
    and then the Event Handlers on MyComponent2 if any will recieve 'e'
    You Probably don't need to modify this behaviour
    I assume you are doing something like
    public class TestComponent extends Component
    private int MySpecialExtraValue;
      public TestComponent()
         super();  // like : new Component()
         MySpecialValue = 5;  // Just an example
      // Override a Method in Component just as an example.
    public String getName()
       String S = "I am a Custom Component";
        return S;
      //Another override example
      public void repaint()
         System.out.println("repaint() was called");
         super.repaint();  // use the original Component Method
         // blah do own stuff
    }Override any methods that you need to get the required behaviour that you want...
    I hope this is a help........

  • How to create an own desgin for JTabbedPane

    Hello,
    I have a very simple question: I want to create my own JTabbedPane-Style, like this picture.
    How do I do this?
    picard90

    Can't recall ever having used it, but see this excerpt from the [Javadoc for JTabbedPane|http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html]:
    The tab title can be rendered by a Component. For example, the following produce similar results:
    // In this case the look and feel renders the title for the tab.
    tabbedPane.addTab("Tab", myComponent);
    // In this case the custom component is responsible for rendering the
    // title of the tab.
    tabbedPane.addTab(null, myComponent);
    tabbedPane.setTabComponentAt(0, new JLabel("Tab"));
    The latter is typically used when you want a more complex user interaction that requires custom components on the tab. For example, you could provide a custom > component that animates or one that has widgets for closing the tab. If you want something more elaborate, write a custom UI delegate. Or see this: Synth (never used it myself).

  • When one or more family members who have been sharing one iTunes account wants to create their own iTunes account can they each upload the music/apps from the shared iTunes on their devices to the new iTunes account?

    When one or more family members who have been sharing one iTunes account wants to create their own iTunes account can they each upload the music/apps from the shared iTunes on their devices to the new iTunes account? 

    Yes. I would clarify your statement about the "shared" iTunes Library though. If you want each iOS device to have its own music library, you should create separate user accounts for them. Read:
    iTunes: How to share music between different accounts on a single computer
    How to use multiple iPods, iPads, or iPhones with one computer

  • How do I create my own favorite template for DVD slideshows? I used to be able to select this from pulldown menu, but cannot now do so. I am directed straight to templates, which take more memory. I have a large slideshow, and need all the space I can get

    First, how do I create my own favorite theme template for DVD slideshows? I used to be able to select this from pulldown menu, but cannot now do so. I am directed straight to already existing themes, which take more memory. I have a large slideshow, and need all the space I can get. I just want to use a picture as my DVD cover, and then insert a slideshow. Also, when I try to burn my 8.5gb double sided slideshow, all that burns is the music. It is a large slideshow, a memorial on the life of my now deceased brother. This means a lot to me and to my family, and I am having so much trouble trying to burn it. I have gone into Project View and selected appropriately. The bar shows I have room to burn this DVD, but it does not burn.  I have burned so many DVDs in the past, but this one just will not burn. I am so confused at this point. I will say this is the first 8.5gb I have attempted to create and burn. My specs list a 7.7gb or 4.7gb as operable....but there are no 7.7gb dvds. I had to purchase 8.5gb. Help? What am I doing wrong? I have spent so much time on this, and just cannot figure it out.

    Final Cut is a separate, higher end video editor.  The pro version of iMovie.
    Give iPhoto a look at for creating the slideshow.  It's easy to assemble the photos in an album in iPhoto, put them in the order you want and then make a slideshow of them.  You can select from various themes and transitions between slides and add music from your iTunes library.
    When you have the slidshow as you want use the Export button at the bottom of the iPhoto window and export with Size = Medium or Large.
    Save the resulting Quicktime movie file in your Movies folder.
    Next, open iDVD, choose your theme and drag the QT movie file into the menu window being careful to avoid any drop zones.
    Then follow this workflow to help assure the best qualty video DVD:
    Once you have the project as you want it save it as a disk image via the File ➙ Save as Disk Image  menu option. This will separate the encoding process from the burn process. 
    To check the encoding mount the disk image, launch DVD Player and play it.  If it plays OK with DVD Player the encoding is good.
    Then burn to disk with Disk Utility or Toast at the slowest speed available (2x-4x) to assure the best burn quality.  Always use top quality media:  Verbatim, Maxell or Taiyo Yuden DVD-R are the most recommended in these forums.
    The reason I suggest iPhoto is that I find it much easier to use than iMovie (except for the older iMovie 6 HD version).  Personal preferences showing here.

Maybe you are looking for