JPanel won't display my custome component

Hi,
I made a custome component class that in its paint method at this stage is suppose to paint a white rectangle on screen. However the when I add this custome component to my JPanel it doesn't show up. Does anybody have a solution for this?
My code for the custome component is,
public spaceMediaDisplayObject(mediaObject mo){
     x = mo.getSpaceX();
     y = mo.getSpaceY();
     height = mo.getHeight();
     width = mo.getWidth();
     name = mo.getName();
     System.out.println("Constructor");
     this.repaint();
public void paint(Graphics g){
     System.out.println("Draw");
     g.setColor(Color.white);
     g.drawRect(x, y, height, width);
And the fragment of code I am using to try and display in on the panel is as follows,
spaceMediaDisplayObject smdo = new spaceMediaDisplayObject(toDisplay);
     spaceBodyPanel.add(smdo);
Please help if able.

If it's null then you need to set the size of each component explicitly:
JPanel panel = new JPanel(null);
Component customComponent = new CustomComponent();
panel.add(customComponent);
customComponent.setBounds(0, 0, 100, 100); // For exampleA simple layout manager could be used to make the component fill the panel, for example:
JPanel panel = new JPanel(new GridLayout(1, 1));
panel.add(new CustomComponent());Hope this helps.

Similar Messages

  • Custom JPanel won't display

    I am building a GUI in NetBeans and am running into some trouble. I have created a class that extends JPanel that I wish to display in a tabbed pane. When I add it to the tabbed pane in the GUI Builder, it adds, although it doesn't display its elements. When I run it, it doesn't display at all. I have stepped through it in the debugger, and the constructor is executed just fine. I don't want to post a bunch of code just yet, because I imagine my problem is something simple. What is the best way to create a custom JPanel like this and add it to another JPanel?

    JPanel jp = new JPanel();
    myJPanel mp = new myJPanel();
    mp.add(mp);The first thing I'll tell you is to check your code for empty catch's.

  • JPanel won't display in BoxLayout when adding components in different order

    For some reason when I run this code, the topPanel (made up of two panels which are all JLabels, JButtons, and JTextFields) does not display on the screen, but the investmentPanel (JTable within a JScrollPane) does. But when I add them in the reverse order, they both show up, but not in the order I want them to. The JPanel I am adding to is maximized so that shouldn't be an issue. Any thoughts of why this is happening?
    this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    JPanel topPanel = new JPanel();
    topPanel.setLayout(new BoxLayout(topPanel, BoxLayout.X_AXIS));
    topPanel.add(companyInfoPanel);
    topPanel.add(tradePanel);
    add(topPanel);
    add(investmentPanel);

    Your best bet here is to show us your code. We don't want to see all of it, but rather you should condense your code into the smallest bit that still compiles, has no extra code that's not relevant to your problem, but still demonstrates your problem, in other words, an SSCCE (Short, Self Contained, Correct (Compilable), Example). For more info on SSCCEs please look here:
    http://homepage1.nifty.com/algafield/sscce.html

  • How to handle value change events of select list in custom component?

    My HelloUIComp code...How to handle events for "Select"...if i choose option1 from select then one text box is to be displayed in custom component and if i choose another option then some other text box is to be displayed in custom components...
    public class HelloUIComp extends UIComponentBase {
        public static final String account="custom.account";
        public static final String RENDERER_TYPE = null;
        HtmlCommandButton button = createButton();
        //HtmlSelectOneMenu select=createSelect();
        public void processDecodes(FacesContext context) {
             Calling the lifecycle method "processDecodes" on the
             internal button is absolutely critical to create action events
             button.processDecodes(context);
             super.processDecodes(context);
        private HtmlCommandButton createButton() {
             FacesContext context = FacesContext.getCurrentInstance();
             HtmlCommandButton newButton = new HtmlCommandButton();
             newButton.setId("Add");
             newButton.setValue("Add");
             newButton.setType("submit");
             //newButton.setOnclick("return func_1(this,event);");
             MethodBinding binding = context.getApplication().createMethodBinding("#{pc_MyProjectView.go}", null);
             newButton.setAction(binding);
                  newButton.setParent(this);
             return newButton;
      /*  private HtmlSelectOneMenu createSelect()
             HtmlSelectOneMenu selectCategory=createSelect();
             return selectCategory;
         public void encodeBegin(FacesContext context) throws IOException {
              String style = (String)getAttributes().get("style");
              String startdate = (String)getAttributes().get("startdate");
              String enddate = (String)getAttributes().get("enddate");
              //String add=(String)getAttributes().get("add");
              ResponseWriter writer = context.getResponseWriter();
             writer.startElement("table", this);
            writer.writeAttribute("border","2","2");
            writer.startElement("tbody", this);
            writer.startElement("tr", this);
            writer.startElement("td", this);
            writer.writeText("Account Category", null);
            writer.endElement("td");
              writer.startElement("td", this);
              writer.writeText("Reg-No", null);
              writer.endElement("td");
              writer.startElement("td", this);
            writer.writeText("Account-No", null);
              writer.endElement("td");
              writer.startElement("td", this);
            writer.writeText("", null);
              writer.endElement("td");
              writer.startElement("td", this);
            writer.writeText("Start-Date", null);
              writer.endElement("td");
              writer.startElement("td", this);
            writer.writeText("End-Date", null);
              writer.endElement("td");
              writer.endElement("tr");
              writer.startElement("tr",this);          
              writer.startElement("td", this);
              writer.startElement("select", this);
            if (style!=null)
                   writer.writeAttribute("style", style, null);
            writer.writeAttribute("name","category","category");
            writer.startElement("option", this);
              writer.writeText("Select", null);
              writer.endElement("option");
              //to access data
              Account accountObj;
              AccountData accountDataobj;
              List listOfAccounts;
              int noOfAccounts;
              accountDataobj=new AccountData();
              listOfAccounts=accountDataobj.getAccounts();
              noOfAccounts=listOfAccounts.size();
              for(int i=0;i<noOfAccounts;i++)
              writer.startElement("option", this);     
              accountObj=(Account) listOfAccounts.get(i);
              writer.writeText(accountObj.getCategory(), null);
              writer.endElement("option");
              //System.out.println(accountObj.getRegNo());
              //System.out.println(accountObj.getAccountNo());
              writer.endElement("select");
              writer.endElement("td");
            writer.startElement("td", this);
              writer.startElement("select", this);
              if (style!=null)
                   writer.writeAttribute("style", style, null);
              writer.writeAttribute("name","regno","regno");
              writer.startElement("option", this);
              writer.writeText("Select", null);
              writer.endElement("option");
              for(int i=0;i<noOfAccounts;i++)
              accountObj=(Account) listOfAccounts.get(i);     
              writer.startElement("option", this);
              writer.writeText(""+accountObj.getRegNo(), null);
              writer.endElement("option");
              writer.endElement("select");
              writer.endElement("td");
              writer.startElement("td", this);
              writer.startElement("select", this);
              if (style!=null)
                   writer.writeAttribute("style", style, null);
              writer.writeAttribute("name","accno","accno");
              writer.startElement("option", this);
              writer.writeText("Select", null);
              writer.endElement("option");
              for(int i=0;i<noOfAccounts;i++)
              accountObj=(Account) listOfAccounts.get(i);
              writer.startElement("option", this);
              writer.writeText(accountObj.getAccountNo(), null);
              writer.endElement("option");
              //writer.startElement("option", this);
              //writer.writeText("00200155", null);
              //writer.endElement("option");
              writer.endElement("select");
              writer.endElement("td");
              writer.startElement("td", this);
              button.encodeBegin(context);
             button.encodeChildren(context);
             button.encodeEnd(context);
            writer.endElement("td");
              writer.startElement("td", this);
              writer.startElement("input", this);
              if (style!=null)
                   writer.writeAttribute("style", style, null);
              writer.writeAttribute("type","text","text");
              writer.writeAttribute("name","startdate","startdate");
              writer.writeAttribute("value",startdate,startdate);
              writer.writeAttribute("readonly", "","");
              //writer.endElement("input");
              writer.endElement("td");
              writer.startElement("td", this);
              writer.startElement("input", this);
              if (style!=null)
                   writer.writeAttribute("style", style, null);
              writer.writeAttribute("type","text","text");
              writer.writeAttribute("name","enddate","enddate");
              writer.writeAttribute("value",enddate,enddate);
              writer.writeAttribute("readonly", "","");
              writer.endElement("td");
              writer.endElement("tr");
              writer.endElement("tbody");
              writer.endElement("table");
         public String getFamily() {
              return "HelloFamily";
         }

    NewEclipseCoder wrote:
    How to handle events for "Select"...if i choose option1 from select then one text box is to be displayed in custom component and if i choose another option then some other text box is to be displayed in custom components...Two ways:
    1) submit the form to the server and render the desired textbox depending on the option.
    or
    2) render all textboxes and use Javascript/DOM to display/hide them depending on the option.

  • Custom Component UI not displaying in 11G

    Hi All,
       We have a custom component in 10G where we have added new link in the UCM Home Page, it will be displayed beside Administration tab with name Edit Tables, under this we have sub links Alldistr_RVS, Distprod, Distuser, Prdstate, Products_RVS, State_RVS, Stateusr. When we deployed this code in 11G it is not working. Could any one please provide me code to make it work in 11G instace. Appreciate your help on this.
    Below is the code used in 10G in resource file
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>
    ampfRVSEditTables htmlIncludeOrString
    </title>
    </head>
    <body>
    <@dynamichtml custom_finish_layout_init@>
    <$include super.custom_finish_layout_init$>
      <$include how_to_components_menu$>
      <$include vbis_edit_tables_link$>
    <@end@>
      <@dynamichtml how_to_components_menu@>
      <$if not how_to_components_menu_included$>
      //add a drop-down menu, or a tray to the UI
      navBuilder.addChildNodeTo('NAVTREE', 'collection', 'id==EDIT_Tables', 'label==Edit Tables');
      if (navBuilder.menuB)
      navBuilder.menuB.addTopLevelNode("EDIT_Tables");
      else if (navBuilder.trayA)
      navBuilder.trayA.addTopLevelNode("EDIT_Tables");
      <$EDIT_Tables_menu_included=1$>
      <$endif$>
      <@end@>
    <@dynamichtml vbis_edit_tables_link@>
    navBuilder.addChildNodeTo('EDIT_Tables', 'item', 'id==ALLDISTR_RVS',
    'label==Alldistr_RVS', 'url==<$HttpCgiPath$>?IdcService=GET_ALLDISTR_RVS_PAGE');
    navBuilder.addChildNodeTo('EDIT_Tables', 'item', 'id==DISTPROD',
    'label==Distprod', 'url==<$HttpCgiPath$>?IdcService=GET_DISTPROD_PAGE');
    navBuilder.addChildNodeTo('EDIT_Tables', 'item', 'id==DISTUSER',
    'label==Distuser', 'url==<$HttpCgiPath$>?IdcService=GET_DISTUSER_PAGE');
    navBuilder.addChildNodeTo('EDIT_Tables', 'item', 'id==PRDSTATE',
    'label==Prdstate', 'url==<$HttpCgiPath$>?IdcService=GET_PRDSTATE_PAGE');
    navBuilder.addChildNodeTo('EDIT_Tables', 'item', 'id==PRODUCTS_RVS',
    'label==Products_RVS', 'url==<$HttpCgiPath$>?IdcService=GET_PRODUCTS_RVS_PAGE');
    navBuilder.addChildNodeTo('EDIT_Tables', 'item', 'id==STATE_RVS',
    'label==State_RVS', 'url==<$HttpCgiPath$>?IdcService=GET_STATE_RVS_PAGE');
    navBuilder.addChildNodeTo('EDIT_Tables', 'item', 'id==STATEUSR',
    'label==Stateusr', 'url==<$HttpCgiPath$>?IdcService=GET_STATEUSR_PAGE');
    <@end@>
    </body>
      </html>
    Thanks.
    Ashok

    Hi Jiri,
       I from the sample example I tried to develop component to display HOW_TO_COMPONENTS as Menu item under which there is sub item Annuity_Dispname_Mapping, but it is not displaying. I am afraid where it went wrong. Below is the code i used, please help me to fix this. Thank you
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>
    MenuExample htmlIncludeOrString
    </title>
    </head>
    <body>
    <@dynamicdata CoreMenuItems@>
    id,           label,       linkType, linkData
    HOW_TO_COMPONENTS, How To Components, YuiDev,
    ANNUITY_DISPNAME_MAPPING, Annuity_Dispname_Mapping, YuiDev, <$HttpCgiPath$>?IdcService=GET_DATA_ACCESS_PAGE
    <@end@>
    <@dynamicdata CoreMenuItemRelationships@>
    <?commatable mergeKey="primaryKey"?>
    parentId,    id,           loadOrder
    MENU_A,      HOW_TO_COMPONENTS,  1000
    HOW_TO_COMPONENTS, ANNUITY_DISPNAME_MAPPING, 10
    <@end@>
    <@dynamicdata CoreMenuItemsFlags@>
    id,           flags
    HOW_TO_COMPONENTS, isLoggedIn
    ANNUITY_DISPNAME_MAPPING, isLoggedIn
    <@end@>
    <@dynamicdata CoreMenuItemsImages@>
    id,           image,                imageOpen
    HOW_TO_COMPONENTS,     ScsPageItem.gif,
    ANNUITY_DISPNAME_MAPPING,     ScsPageItem.gif,
    <@end@>
    <@dynamicdata ampcustom_menu_items_template_data@>
    <?commatable indexedColumns="id"?>
    id,                  parentId,    linkType,        flags
    HOW_TO_COMPONENTS_LINK_TEMPLATE, HOW_TO_COMPONENTS, external,
    <@end@>
    <@dynamichtml custom_navigation_menu_items@>
    <$include super.custom_navigation_menu_items$>
      <$urlCount = 0$>
      <$if utLoadResultSet("pne_portal", "PersonalURLS")$>
      <$if rsFirst("PersonalURLS")$>
      <$loop PersonalURLS$>
      <$ddAppendIndexedColumnResultSet("ampcustom_menu_items_template_data", "NavigationMenuItems", "id", "HOW_TO_COMPONENTS_LINK_TEMPLATE")$>
      <$rsLast("NavigationMenuItems")$>
      <$NavigationMenuItems.id = "HOW_TO_COMPONENTS_" & urlCount$>
      <$NavigationMenuItems.label = js(title)$>
      <$NavigationMenuItems.linkData = js(website)$>
      <$NavigationMenuItems.loadOrder = urlCount$>
      <$urlCount = urlCount + 1$>
      <$endloop$>
      <$endif$>
    <$endif$>
    <@end@>
    </body>
    </html>
    Thanks

  • Scrolling a custom Component (e.g. JPanel) with overridden paint(Graphic g)

    Hi.
    I&#8217;m creating an application for modelling advanced electrical systems in a house. Until now I have focused on the custom canvas using Java2D to draw my model. I can move the model components around, draw lines between them, and so on.
    But now I want to implement a JScrollPane to be able to scroll a large model. I&#8217;m currently using a custom JPanel with a complete override of the paint(Graphic g) method.
    Screen-shot of what I want to scroll:
    http://pchome.grm.hia.no/~aalbre99/ScreenShot.png
    Just adding my custom JPanel to a JScrollPane will obviously not work, since the paint(Graphic g) method for the JPanel would not be used any more, since the JScrollPane now has to analyze which components inside the container (JPanel) to paint.
    So my question is therefore: How do you scroll a custom Component (e.g. JPanel) where the paint(Graphic g) method is totally overridden.
    I believe the I have to paint on a JViewport instructing the JScrollPane my self, but how? Or is there another solution to the problem?
    Thanks in advance for any suggestions.
    Aleksander.

    I�m currently using a custom JPanel with a complete override of the paint(Graphic g) method. Althought this isn't your problem, you should be overriding the paintComponent(..) method, not the paint(..) method.
    But now I want to implement a JScrollPane to be able to scroll a large model.When you create a custom component to do custom painting then you are responsible for determining the preferredSize of the component. So, you need to override the getPreferredSize(...) method to return the preferredSize of your component. Then scrolling will happen automatically when the component is added to a scrollPane.

  • Drag and drop custom component

    I have a custom component that is a JPanel with a JTextField and a JButton. The component is a display and chooser for an address. I want to be able to copy the address from one to another with drag and drop.
    Here's what I have so far. The drag starts, but it won't allow to drop on another instance of the same class. MyTransferHandler is a simple subclass of TransferHandler that logs everything so I can watch what is happening. The canImport() method of TransferHandler is never getting called. Any ideas?
    transferHandler = new MyTransferHandler("address");
    setTransferHandler(transferHandler);
    dragListener = new MouseMotionListener() {
    public void mouseDragged(MouseEvent a_evt) {
    if (address != null) {
    TransferHandler l_h = getTransferHandler();
    l_h.exportAsDrag(PanelAddress.this, a_evt, TransferHandler.COPY);
    public void mouseMoved(MouseEvent e) {
    addMouseMotionListener(dragListener);
    txtAddress.addMouseMotionListener(dragListener);

    Figured it out while creating the SSCCE. Needed to set the TransferHandler on the text field and button because they were "hiding" the panel.
    {noformat} MyTransferHandler l_transfer_handler = new MyTransferHandler("address");{noformat}{noformat} setTransferHandler(l_transfer_handler);{noformat}{noformat} txtAddress.setTransferHandler(l_transfer_handler);{noformat}{noformat} btnChoose.setTransferHandler(l_transfer_handler);{noformat}{noformat}{noformat}

  • Best strategy for variable aggregate custom component in dataTable

    Hey group, I've got a question.
    I'd like to write a custom component to display a series of editable Things in a datatable, but the structure of each Thing will vary depending on what type of Thing it is. So, some Things will display radio button groups (with each radio button selecting a small set of additional input elements, so we have a vertical array radio buttons and beside each radio button, a small number of additional input elements), some will display text-entry fields, and so on.
    I'm wondering what the best strategy for tackling this sort of thing is. I'm sort of thinking I'll need to do something like dynamically add to the component tree in my custom component's encodeBegin(), and purge the extra (sub-) components in encodeEnd().
    Decoding will be a bit of a challenge, maybe.
    Or do I simply instantiate (via constructor calls, not createComponent()) the components I want and explicitly call their encode*() and decode() methods, without adding them to the view tree?
    To add to the fun of all this, I'm only just learning Faces (having gone through the Dudney book, Mastering JSF, and writing some simpler custom components) and I don't have experience with anything other than plain vanilla JSP. (No EJB, no Struts, no Tapestry, no spiffy VisualDevStudioWysiwyg++ [bah humbug, I'm an emacs user]). I'm using JSP 2.0, JSF 1.1_01, JBoss 4.0.1 and JDK 1.4.2. No, I won't upgrade to 1.5 (yet).
    Any hints, pointers to good sample code? I've looked at some of the sample code that came with the RI and I've tried to navigate the JSF Blueprints stuff, but I haven't really found anything on aggregating components into a custom component. Did I miss something obvious?
    If this isn't a good question, please let me know how I can sharpen it up a bit.
    Thanks.
    John.

    Hi,
    We're doing something very similar. I had a look at the Tomahawk Date component, and it seems to dynamically created InputText components in the encodeEnd(). However, it doesn't decode this directly (it only expects a single textual value). I expect you may have to check the request yourself in decode().
    Other ideas would be appreciated, though - I'm still new to JSF.

  • Using nullLayout for custom component

    I am writing an AccordianPanel as a custom component that can be dropped into a JPanel and behave as expected. I am using a null layout in the outer container (JPanel) as the accordian dividers need to move as told and not be managed by a layout manager. When I resize a window or another container that the custom component sits in, it doesn't resize anything - I understand this is the behavior I would expect as that is how I coded it.
    Now, I want to have the custom component resize its internal stuff when the container it resides in (i.e. JFrame or most likely another JPanel) gets moved, but I don't know how to do this. The outer most component in my custom components hierarchy is a JPanel whose layout is set to null and I stuff everything else inside there.
    I believe I need to add a componentListener to my JPanel whose layout is set to null, but I am not sure. Could someone send me in the right direction.
    thanks

    the best approach might be to implement your own LayoutManager (which is simple enough) and use it rather than absolute positioning....
    If you read postings in the forum you will find most people recommend using LayoutManagers and not a null layout so you don't have problems like this.Hello sarcommand , camickr, and anyone interested,
    I've tried to bring this discussion up again just a few days ago, and was disappointed I got no feedback - must be a dull read :o(
    Here is the [link to the thread|http://forums.sun.com/thread.jspa?messageID=10723670&#10723670], would you mind having an eye on it?
    I'm sorry to hijack this thread (seems slightly less rude than bumping my own former thread up), but I've read several discussions on this subject too, and still I can't decide whether I should follow the CustomLayoutmanager track.
    Although most of the writing there is specific to my current problem, it highlights 3 points I think are general enough:
    - A custom layout (whatever the way it is implemented, I discuss 4 approaches in the thread) is generally used to display custom components, or at least, components that represent custom application-specific entities or input points. -> Is is worth the trouble to abstract the positioning logic when this "custom layout" has only one, at best two, use cases (a couple of specific screens in your specific app that represents your specific entities)?
    - A custom (app-specific) layout manager is likely to require more knowledge about the things being layed out than the default min/max/pref sizes. In particular it may require to know data of the underlying model objects represented by the children components. How is that best designed? I tentatively think it's by way of custom Constraint classes which have to be abstract enough yet should be easily mapped from the app-specific data.
    - The CustomLayoutManager integrates natively with regular graphical events (hiding, resizing,...), but how to integrate app-specific events (such as, when the underlying data change in such a way that should be reflected by a change in the layout, how/when to force the re-layout)?
    Thank you for your help.

  • Complex custom component

    I'm tring to create a custom component that implements browse control.
    the component is composed of a input box that holds the browse result a dialog with data table and a button that cause the dialog to open.
    I have some implementation issuses :
    1. the datatable needs to get it's input from the database, normally I would create a value binding to a managed bean but I don't know where to put it in this case. (there can be more then component in a page so managed bean won't work)
    2. when the browse button is pressed I need to change the dialog display property so it would appear. how can I get hold of it's backing bean in the decode() method ? getting it through the context.getViewRoot().getChildren();isn't good enough since the component hierarchy changes from one page to another.

    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

  • Parts of applet won't display until later

    I have this very simple applet (a clock) and everything is working the way is should except that the image of my clock won't display until I press one of the buttons.
    here's part of the code:
    public class horlogeVue extends JApplet{
    public void init(){
    Container c = getContentPane();
    c.setLayout(new FlowLayout());
         hourPlus = new JButton("h+");
    ... (more buttons)
    hour = new JLabel("heure");
    minute = new JLabel("minute");
    seconde = new JLabel("seconde");
    c.add(hour);
    hModele = new horlogeModele(this);
    hControle = new horlogeControle(hModele);
    hourPlus.addActionListener(hControle.new hourP());
    public void display(int timeH, int timeM, int timeS){
    time = "heure="+timeH+", minute="+timeM+", seconde="+timeS;
    repaint();
    public void paint(Graphics g){
    super.paint(g);
    g.drawString(time, 100, 75);
    g.drawArc(xcenter-50, ycenter-50, 100, 100, 0, 360);
    g.drawString("9", xcenter-45, ycenter+3);
    g.drawString("3", xcenter+40, ycenter+3);
    g.drawString("12", xcenter-5, ycenter-37);
    g.drawString("6", xcenter-3, ycenter+45);
    xs = (int) (Math.cos(timeS * Math.PI / 30 - Math.PI / 2) * 45 + xcenter);
    ys = (int) (Math.sin(timeS * Math.PI / 30 - Math.PI / 2) * 45 + ycenter);
    xm = (int) (Math.cos(timeM * Math.PI / 30 - Math.PI / 2) * 40 + xcenter);
    ym = (int) (Math.sin(timeM * Math.PI / 30 - Math.PI / 2) * 40 + ycenter);
    xh = (int) (Math.cos((timeH *30 + timeM / 2) * Math.PI / 180 - Math.PI / 2) * 30 + xcenter);
    yh = (int) (Math.sin((timeH *30 + timeM / 2) * Math.PI / 180 - Math.PI / 2) * 30 + ycenter);
    g.drawLine(xcenter, ycenter, xh, yh);
    g.drawLine(xcenter, ycenter, xm, ym);
    g.drawLine(xcenter, ycenter, xs, ys);
    So, yeah, basically how do I display all the stuff in paint as soon as I open my applet?

    To get best help with any problem, I recommend posting an SSCCE rather than 'part of the code'.
    <http://www.physci.org/codes/sscce.html>
    Also, when posting code, using a little indent and [src][src] elements around it (where you would change 'src' to 'code' to show any text between the two as formatted source code) makes it a lot more readable as well.
    But as a general comment on the code. It is not usually a good idea to override the paint() of a root level component, I would recommend a JComponent/JPanel instead.
    The JPanel(JComponent) can then be used in the JApplet, JFrame, JDialog, JOptionPane, JWindow.. as needed.

  • Custom component data binding

    Hey people,
    I'm trying to write a custom component which extends from JPanel (has a List<?>). It will basically display some sub-panels on itself by considering the underlying data (database table rows). I want to have the same functionality with JTable binding. I'm having difficulty listening changes occur on the list. How can I listen to changes inside the list in my JPanel component? Should I write a custom model? or Should I use a ObservableList? any suggestions are welcome..

    Actually, it's not a JList. My component is a custom JPanel which has an underlying collection to hold data. I'm binding this underlying collection to an ObservableList which is filled with the result set fetched from the database. It's a standart ArrayList<?> and I want to listen to the changed that made to this list.
    MyPanel extends JPanel {
        private List<Person> list = new ArrayList<Person>();
    }I'd like to see any changes made to the list inside MyPanel class.

  • My iPhone 5 won't display smart text options.

    My iPhone 5 won't display smart text. It did when I initially downloaded the new OS, now those options don't appear at all. Did I click something to make them disappear?
    I went into Settings to see if there was a component of it within Messages. I don't see anything.
    Thoughts please.....
    Thanks much
    Ginger

    Awwww......that's it....the dash! I tapped it. Tried to drag it up/down and it didn't move. Now I swiped and it's back!
    So I need to remember to drag up/down and now swipe.....
    Thanks much!
    Ginger

  • How do you reference a valueObject located in main to a custom component created in Catalyst?

    Hello,
    I have been working with the Catalyst Beta 2 / Flash Builder beta trying to create a photogallery and have hit a little bit of a snag, try as I might I can't seem to find the answer anywhere. I am still new to Flex so please excuse me if this is a basic question, I have been trying to understand more about Flex to make my designs in Catalyst better.
    I found this video on Adobe TV: http://tv.adobe.com/watch/rich-internet-applications-101/ria-stepbystep-16-binding-a-data- service-to-flash-builder-components/
    It's wonderful and I have the datalist I created in Catalyst working with the XML file I generated but I designed my little photogallery a bit diffrent, I created a Custom Component in Catalyst so that when you click an item on the DataList it pop's up a little screen with a larger photo in on it, rather then having an image in the main application. Now my problem seems to be that I can't refrence the valueObject I created with the wizard as it's in my Main.mxml file, is there a way to refrence it from my Custom Component so the larger image will display? Is there a way to let the component know which item on the dataList in the main application is selected and display the correct image?
    I should also say I really enjoy working with the Beta for both Flash Builder / Catalyst, thanks for the hard work!
    Thanks for the help,
    Chris

    I am afraid you cannot bind to static properties in Windows Store Apps. It is simply not supported.
    You could create a proxy class that exposes the static command property and bind to this property of an instance of the proxy object:
    http://stackoverflow.com/questions/14186175/bind-to-a-static-field-in-windows-8-xaml
    http://stackoverflow.com/questions/4708711/how-can-i-use-the-xstatic-extension-for-phone7-silverlight-apps
    You will of course have to create an instance of the proxy object. There is no way around this.
    Please remember to mark helpful posts as answer to close your threads and then start a new thread if you have a new question.

  • How to handle custom component data on overviewset save button CRM UI

    Hi,
    I have added a custom component to a standard view which is enchanted.
    I can handle any data with my buttons on the component but after editing data
    i need the save the data when the save button on the overview(top) is pressed.
    I have redefined save button of overview but i cant get my data.
    My node name is Root. I think i couldnt bind it to overview.
    How can i do that?
    Thank you

    Probably it can be done by
    http://wiki.sdn.sap.com/wiki/display/CRM/CRMWebUITechnical-CreatingTableViewInWebUI
    i am trying
    Thank you

Maybe you are looking for

  • Tables of f-02

    Vipin, Find the config below 1.Activate the New General Ledger Accounting by a single click on the clock icon 2.You will reach to change view "activation of New GL A/cg" detail screen and tick the checkbox and save. 3. After activation of New General

  • Problem in Sending data to Backend.

    Hi All, Thanks for all who is answering all my quations. Now i am unable to send data to backend. Model and Cardinalities are fine ( I am getting data from backend). I created new element in comp controller and method(executing model). I am calling t

  • WITHHOLDING TAXES ON PROVISION

    Hi Gurus I have configured 4 witholding tax codes (1 for basic, 1 for surcharge, 1 for HE cess & 1 for SHE cess). When I'm using tcode J1INUT for calcuclating WTH tax on provisions, i have option to enter only 2 tax codes. Now please guide me on how

  • Referencing condition values when creating return order is wrong...

    Hello Experts, Lets say I have a billing document that has 3 line items namely material A, B and C. Now, I created a return order for material A with 2 separate line items because of different storage locations. Now, is there a user-exit that lets my

  • Why won't iTunes open up?

    What is it with iTunes 6? I don't understand. Why, out of nowhere, does this version fail to work? All other versions worked fine for me. I regret upgrading to iTunes 6. I've looked around the different posts that related to my problem and I've tried