Extend UI components

Am I correct that it not currently possible to extend existing UI components and add new properties/behavior. Are there any plans to support this in the <b>near</b> future. I mean, the whole concept of components is a bit useless if you're completely tied to the ones provided by SAP.

Hi ,
Yes its true !
Abt extending UI components.. is there any development framework which supports UI component extension ? I doubt that  part !
Not exactly an analogy.. but can u extend say , a html dropdown to do something else other than the standard ? (like add a label in front of dropdown)
If you are talking abt taglibs..
Its probably to bring a standard then going back to  a mix of HTML tags /HTMLB and lots other...
Regards
Bharathwaj..

Similar Messages

  • Extended Swing Components into Custom Component Palette

    Hi
    As part of my swing application I have a number of GUI components created as an extension of a normal swing component.
    As example is below.
    package com.myapp
    import java.awt.Font;
    import javax.swing.JLabel;
    public class MLabel extends JLabel
    public MLabel()
    this.setFont(new Font("Tohoma",0,10));
    this.setFocusable(false);
    As you can see this simple sets some default attributes. How can I add this custom component into a palette for each access when using the GUI builder.
    I've created a new page in the palette, but am unable to add my components.
    Thanks for your help.
    Nick.

    Hi,
    - create a JAR file with your component(s) in it
    - Create a custom Library in JDeveloper (Tools--> Managed Libraries)
    - Select the JAR file
    - On the component palette (the page you created), select the properties option of the context menu
    - Your library now shows up in the drop down list to choose the component to add
    Frank

  • Extending UIX components

    Hi everybody,
    I've started to investigate the UIX extension possibilites, and I have some doubts.
    Here goes some questions:
    1) How can I use the new defined components at design time? (I haven't found it in the docs)
    2) The documentation talks about the possibility of extend components developed by someone else. And there is an example of adding a new property to an existing component, but the fact is that the new behavior doesn't affect rendering. It's possible to modify the renderization of an existing component in an easy way? For instance, add a new property to a MessageTextInput which lets us decide where goes the promp (left or right of the text box). It's not a great change, but it's needed to modify the renderization.
    Thank you,
    Carles Biosca

    You should take a look into templates. Templates provide an easy way to customize components (to some extent) and to combine existing components into new ones. So if it can be done with a template then that is probably the way you should go.
    In your case, you could create a new template consisting of a messagePrompt and a textInput in a layout. As base type you should use the textInput.
    The position of the prompt you could then control based on an additional template attribute.
    The templating stuff should also be in the "Extending UIX" chapter.
    Sascha

  • Extending Swing Components

    I would like to create my own Swing components that I wish to use in my Java GUI programs. I would like to create my own lightweight components and also to create things such as:
    Round buttons
    Sliders
    etc
    I also need to know how to create metallic skins for my Swing application.
    Please can someone give me any simple examples of how to create custom components and also how to create skins of interfaces or give me some URLs that teach you.
    Thanks in advance
    Riz

    I think your best bet is to look at the source of the LookAndFeel's provided with the swing download, mac/windows/motif/metal/basic and figure it all out. I don't know of any detailed sites to help make look and feels.

  • How to Extend ATG10 Multisite's SiteContext or SiteSession components.

    Can anyone let me know if you have come across extending Multisite's SiteContext or SiteSession components? We want to extend these components to hold custom values but i do not find anything related in the documentation. Thanks in Advance.
    -PR

    SiteSession isn't a Nucleus component. The component that instantiates SiteSessions does not provide a way for you to specify an alternate class. SiteContext and SiteSession both have an attributes property that is a Set of name/value pairs. Names are Strings and values are Objects. Once your code gets access to a SiteContext or SiteSession, you can call setAttribute and getAttribute to manipulate your custom properties. Both classes also have a getAttributeNames method you can use to iterate through whatever attributes you've set.

  • Flex Data Services does not see remote methods in extended ColdFusion component.

    I have created a remote service base component as a AModelService.cfc file. I extend that file to make my ModelService.cfc. When I configure the ColdFusion data service and point to ModelService.cfc and click next, I don't see any remote methods (there are none explicitly defined in the component) in the Service Operations window.
    If I go back and point to AModelServide.cfc, the parent component, and hit next, I see all the remote methods that are defined in the parent component. So, either I am doing something wrong, or Data Services does not look at methods up the cfc prototype chain, which from an OOP standpoint means that instead of say creating one restful base class and being nice and DRY you can't. I.e. not OOP for data services. Is this a bug, or what?
    Anybody get data services to work with extended service components?
    Mark

    Thanks for the reply. Yes, I did compile all the Java and it
    works OK with a simple Java program. It just will not work in a
    Flex application.
    The java classes are:
    RRA:
    package blah.myPackage;
    import java.util.List;
    import java.util.Collection;
    import flex.data.DataSyncException;
    import flex.data.assemblers.AbstractAssembler;
    class RRA extends AbstractAssembler
    public Collection fill( List fillParameters )
    RRS service = new RRS();
    return service.getSome();
    RRS:
    package blah.myPackage;
    import java.util.ArrayList;
    import java.util.List;
    import java.sql.*;
    import flex.EORS.*;
    class RRS
    public List getSome()
    ArrayList list = new ArrayList();
    String str = "bob";
    RR rr = new RR(str);
    list.add(rr);
    return list;
    RR:
    package blah.myPackage;
    class RR
    private String name;
    public RR() { }
    public RR(String name)
    this.name = name;
    public String getName()
    return this.name;
    public void setName(String name)
    this.name = name;
    I started with something that retrieved data from a database
    but watered it down just to try and get some kind of communication
    between Flex and Java.

  • Configuring Swing components from a database

    Hi All
    I'd like to be able to configure Swing components with information from a database e.g. text, color, editability etc. One approach I'm considering is extending existing components such a JTextField and adding a configure() method which takes as a parameter the primary key of the database record containing the config info.
    Has anyone comes across alternative design patterns for solving this?
    Regards
    Terry Child

    that is what I would do

  • How to extend af:chooseDate component

    I need to build a custom adf component which will be in extended form of af:chooseDate component.
    How to extend adf components ?
    any documentation or links will help me out ?
    I need to enhance some features for the af:chooseDate component. How to do that ?
    Is there any good links which will help me to develop custom adf components ?
    Regards,
    Hoque

    You can create a custom declarative component that uses af:chooseDate component and expose additional properties/attributes.
    For more details, read the following forum post:
    how to "extend" an ADF faces component
    Thanks,
    Navaneeth

  • Where to get info on foundation components like "foundation/components/userinfo"

    Where can I obtain detailed APIs for the foundation components?
    It's hard to find in-depth information on CQ5's components.  E.g. in the Geometrixx example, this component is referenced in the header.jsp, but I can't find any reference to it online:
    <cq:include path="userinfo" resourceType="foundation/components/userinfo"/>
    There are these, but the usage details are incomplete:
    http://dev.day.com/docs/en/cq/current/developing/components.html#Default%20Components%20wi thin%20CQ%20WCM
    http://dev.day.com/docs/en/cq/5-3/wcm/default_components.html
    I also found these docs but they're more advanced, as I don't want to write the Java to extend these components yet, I just want the information on using the components as tags and includes.
    http://dev.day.com/docs/en/cq/current/widgets-api/index.html
    http://dev.day.com/docs/en/cq/current/javadoc/index.html
    Thanks for any pointers you can provide.

    The component foundation/components/userinfo shows information about the currently logged in user (In publish mode display name of non anonymous users & in author mode link to cc) .  In order to find the information missing in docs go to respective components & open the component jsp file. Ex:- For your case it would be in /libs/foundation/components/userinfo/userinfo.jsp
    Please refer [0] on how to use xtypes.
    I have placed a documentation request to update the missing component information.  For any additional details could you please file a daycare so that we can help & track it down.
    [0]  http://dev.day.com/docs/en/cq/current/getting_started/first_steps_for_developers.html

  • Trying to make a disc.img from an iMovie project get the mssage that some of the audio clips are not available. The clips still show as green bars in the project but do not play.

    I successfully made a disc.img and then burned a DVD of the project but found an error in a title. Went back to the project, corrected the error, and tried to create a new disc.img but got the message that some of the audio tracks were unavailable. They still show as green bars in the project but do not play. Tried deleting and reinstalling them with no success. They do play in iTunes and in the iMovie editing pane
    Thank you

    inspired2apathy wrote:
    ... The goal is a ScrollPane that automatically wraps the text inside it. I've just about got it, but I have one thing that's not working. If I just put the JTextArea{s} in as the Editor, then you lose the any text that doesn't fit inside whatever the initial size was. Instead, I put the JTextAreas inside a JScrollPane which works fine, except that I still have to determine the size of the JScrollPane in advance. I would like to make each Editor/JScrollPane start out with just a single line of text and expand until it reaches a certain small number of lines.
    ... What am I missing?THE BASICS. See if this isn't what you are trying to do.
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    public class Test
      public static void main(String[] args) {
        JTextArea ta = new JTextArea();
        ta.setLineWrap(true);
        ta.setWrapStyleWord(true);
        JScrollPane sp = new JScrollPane(ta);
        JFrame f = new JFrame();
        f.getContentPane().add(sp, "Center");
        f.setBounds(0, 0, 400, 300);
        f.setDefaultCloseOperation(f.EXIT_ON_CLOSE);
        f.setVisible(true); 
    }OP, your code was too long and complicated for me to compile and run. However, aren't you forgetting the two simple methods <tt>JTextArea.setLineWrap()</tt> and <tt>JTextArea.setWrapStyleWord()</tt>? Furthermore, I absolutely see no need for you to extend SWING components for demonstration this simple -- that is, if I understand your problem correctly.

  • How to validate multiple controls using a single Validator?

    I am trying to do an HourValidator because Flex doesn't have
    this, so i am extending from the Validator class. I read in the
    Creating and extending Flex components document the
    following:
    "A validator can validate more than one field at a time. For
    example, you could create a custom
    validator called NameValidator to validate three input
    controls that represent a person’s first,
    middle, and last names.
    To create a validator that examines multiple fields, you can
    either define properties on the
    validator that let you specify the multiple input fields, as
    does the Flex DateValidator class
    class, or you can require that the single item passed to the
    validator includes all of the fields to
    be validated."
    So according to the document i need to define properties so i
    defined 4 properties:
    startHourSource: the input control containing the starting
    hour
    startHourProperty: the control's property (in this case the
    text property)
    endHourSource: the input control containing the end hour
    endHourProperty: the control's property (in this case the
    text property)
    The thing is that when i call the doValidation of the
    superclass (to validate the required property) it does return a
    validation error but it doesn't mark the input control with the red
    frame that indicates there's a validation error. I assume that is
    because the
    source and
    property properties of the validator are null but that's ok
    because i am not using them, instead i am using the 4 properites
    mentioned above.
    So what do i need to do or override so the red frame appears
    in the input controls??

    Yeah i already know that, but when you use the doValidation
    method, which does the requiredField validation, by default marks
    the input control with the red frame, so that's why i am trying to
    do, doing it so it will do it by default.
    For example, try this:
    <mx:TextInput id="test"/>
    <mx:Validator id="validateTest" source="{test}"
    property="text" required="true" requiredFieldError="The field is
    empty"/>
    If you do
    validateTest.validate( ) and the textinput is empty, it will
    mark it with the red frame by default, that's the kind of behave i
    want for my HourValidator, but if it is not possible then the
    solution you suggested would be the only one to do this.

  • Trying to make a WrappingComboBox

    Inspired by a fairly straightforward WrappingList, I thought I'd try to make a Wrapping JScrollPane. The goal is a ScrollPane that automatically wraps the text inside it. I've just about got it, but I have one thing that's not working. If I just put the JTextArea{s} in as the Editor, then you lose the any text that doesn't fit inside whatever the initial size was. Instead, I put the JTextAreas inside a JScrollPane which works fine, except that I still have to determine the size of the JScrollPane in advance. I would like to make each Editor/JScrollPane start out with just a single line of text and expand until it reaches a certain small number of lines.
    Here is my attempt at a WrappingComboBox
    import java.awt.Component;
    import java.awt.Container;
    import java.awt.Dimension;
    import java.awt.Insets;
    import java.awt.LayoutManager;
    import java.awt.Rectangle;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.ComponentEvent;
    import java.awt.event.ComponentListener;
    import java.awt.event.InputMethodEvent;
    import java.awt.event.InputMethodListener;
    import java.util.Vector;
    import javax.swing.BoxLayout;
    import javax.swing.ComboBoxEditor;
    import javax.swing.JComboBox;
    import javax.swing.JComponent;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JList;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    import javax.swing.JViewport;
    import javax.swing.ListCellRenderer;
    import javax.swing.ScrollPaneConstants;
    import javax.swing.SwingUtilities;
    import javax.swing.event.EventListenerList;
    import javax.swing.plaf.basic.BasicComboBoxUI;
    import javax.swing.plaf.basic.BasicComboPopup;
    import javax.swing.plaf.basic.ComboPopup;
    import javax.swing.text.View;
    import debibdup.ScrollablePanel.ScrollableSizeHint;
    * @author jfolson
    public class WrappingComboBox extends JComboBox {
         WrappingComboBox() {
              super();
              this.setUI(new WrappingComboBoxUI());
         WrappingComboBox(Vector<?> items) {
              super(items);
              this.setUI(new WrappingComboBoxUI());
         public static class WrappingComboBoxUI extends BasicComboBoxUI {
              WrappingHelper wrappingHelper;
              public WrappingComboBoxUI() {
                   super();
              public WrappingHelper getWrappingHelper() {
                   if (wrappingHelper == null)
                        wrappingHelper = new WrappingHelper();
                   return wrappingHelper;
              /* Since my Editor, Renderer and Popup are not UIResources, I have to overload these methods
               * or else installUI would call BasicComboBoxUI.createXXX anyway and replace mine
              @Override
              protected ComboBoxEditor createEditor() {
                   return new WrappingComboBoxEditor();
              /* See note for createEditor()
              @Override
              protected ListCellRenderer createRenderer() {
                   return new WrappingList.WrappingListCellRenderer();
              /* See note for createEditor()
              @Override
              protected ComboPopup createPopup() {
                   return new BasicComboPopup(comboBox) {
                        @Override
                        protected JList createList() {
                             // use the WrappingList for the popup to make it update its
                             // sizes
                             return new WrappingList(comboBox.getModel());
                             // BasicComboPopup overrides default, apparently fixes some
                             // bug but I can't use it because BasicGraphicsUtils
                             // functions are private
                             /*return new JList(comboBox.getModel()) {
                                  @Override
                                  public void processMouseEvent(MouseEvent e) {
                                       if (BasicGraphicsUtils.isMenuShortcutKeyDown(e)) {
                                            // Fix for 4234053. Filter out the Control Key
                                            // from the list.
                                            // ie., don't allow CTRL key deselection.
                                            Toolkit toolkit = Toolkit.getDefaultToolkit();
                                            e = new MouseEvent((Component) e.getSource(), e
                                                      .getID(), e.getWhen(), e.getModifiers()
                                                      ^ toolkit.getMenuShortcutKeyMask(), e
                                                      .getX(), e.getY(), e.getXOnScreen(), e
                                                      .getYOnScreen(), e.getClickCount(), e
                                                      .isPopupTrigger(), MouseEvent.NOBUTTON);
                                       super.processMouseEvent(e);
              /*Have to overrige getMinimumSize, rectangleForCurrentValue and layoutContainer in the Helper class
               * to make a smaller (reasonable) sized popup button, otherwise, for multi-line combobox you get
               *  ridiculously large buttons.
              @Override
              public Dimension getMinimumSize(JComponent c) {
                   if (!isMinimumSizeDirty) {
                        return new Dimension(cachedMinimumSize);
                   Dimension size = getDisplaySize();
                   Insets insets = getInsets();
                   // calculate the width and height of the button
                   int buttonHeight = size.height;
                   if (buttonHeight > arrowButton.getPreferredSize().width)
                        buttonHeight = arrowButton.getPreferredSize().width;
                   int buttonWidth = arrowButton.getPreferredSize().width;
                   // adjust the size based on the button width
                   size.height += insets.top + insets.bottom;
                   size.width += insets.left + insets.right + buttonWidth;
                   cachedMinimumSize.setSize(size.width, size.height);
                   isMinimumSizeDirty = false;
                   return new Dimension(size);
               * Returns the area that is reserved for drawing the currently selected
               * item.
              @Override
              protected Rectangle rectangleForCurrentValue() {
                   int width = comboBox.getWidth();
                   int height = comboBox.getHeight();
                   Insets insets = getInsets();
                   int buttonSize = height - (insets.top + insets.bottom);
                   if (arrowButton != null) {
                        buttonSize = arrowButton.getWidth();
                   if (true) {// BasicGraphicsUtils.isLeftToRight(comboBox)) { // this
                        // method is not visible
                        return new Rectangle(insets.left, insets.top, width
                                  - (insets.left + insets.right + buttonSize), height
                                  - (insets.top + insets.bottom));
                   } else { // if I could tell, put the box on the other side for right
                        // to left checkboxes
                        return new Rectangle(insets.left + buttonSize, insets.top,
                                  width - (insets.left + insets.right + buttonSize),
                                  height - (insets.top + insets.bottom));
              @Override
              protected LayoutManager createLayoutManager() {
                   return getWrappingHelper();
              private class WrappingHelper implements LayoutManager {
                   // LayoutManager
                   /* Need to override layoutContainer to put in a smaller popup button
                   public void addLayoutComponent(String name, Component comp) {} // Can't
                   // do
                   // this
                   public void removeLayoutComponent(Component comp) {}
                   public Dimension preferredLayoutSize(Container parent) {
                        return parent.getPreferredSize();
                   public Dimension minimumLayoutSize(Container parent) {
                        return parent.getMinimumSize();
                   public void layoutContainer(Container parent) {
                        JComboBox cb = (JComboBox) parent;
                        int width = cb.getWidth();
                        int height = cb.getHeight();
                        Insets insets = getInsets();
                        int buttonHeight = height - (insets.top + insets.bottom);
                        int buttonWidth = buttonHeight;
                        if (arrowButton != null) {
                             if (buttonHeight > arrowButton.getPreferredSize().width)
                                  buttonHeight = arrowButton.getPreferredSize().width;
                             Insets arrowInsets = arrowButton.getInsets();
                             buttonWidth = arrowButton.getPreferredSize().width
                                       + arrowInsets.left + arrowInsets.right;
                        Rectangle cvb;
                        if (arrowButton != null) {
                             if (true) {// BasicGraphicsUtils.isLeftToRight(cb)) { //
                                  // this method is not visible
                                  arrowButton.setBounds(width
                                            - (insets.right + buttonWidth), insets.top,
                                            buttonWidth, buttonHeight);
                             } else { // if I could tell, put the box on the other side
                                  // for right to left checkboxes
                                  arrowButton.setBounds(insets.left, insets.top,
                                            buttonWidth, buttonHeight);
                        if (editor != null) {
                             cvb = rectangleForCurrentValue();
                             editor.setBounds(cvb);
         public static class WrappingComboBoxEditor extends JScrollPane implements
                   ComboBoxEditor, ComponentListener {
              EventListenerList listenerList = new EventListenerList();
              LineAwareTextArea text;
              public WrappingComboBoxEditor() {
                   super();
                   this.text = new LineAwareTextArea();
                   this.setViewportView(text);
                   setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
                   setPreferredSize(new Dimension(100, 30));
                   this.setItem("");
                   text.setLineWrap(true);
                   text.setWrapStyleWord(false);
                   text.setEditable(true);
                   text.addInputMethodListener(new InputMethodListener() {
                        @Override
                        public void caretPositionChanged(InputMethodEvent arg0) {}
                        @Override
                        public void inputMethodTextChanged(InputMethodEvent arg0) {
                             Object[] listeners = WrappingComboBoxEditor.this.listenerList
                                       .getListenerList();
                             // Process the listeners last to first, notifying
                             // those that are interested in this event
                             ActionEvent actionEvent = null;
                             for (int i = listeners.length - 2; i >= 0; i -= 2) {
                                  if (listeners[i] == ActionListener.class) {
                                       if (actionEvent == null)
                                            actionEvent = new ActionEvent(this,
                                                      ActionEvent.ACTION_PERFORMED, null);
                                       ((ActionListener) listeners[i + 1])
                                                 .actionPerformed(actionEvent);
                   text.addComponentListener(this);
              @Override
              public void addActionListener(ActionListener l) {
                   listenerList.add(ActionListener.class, l);
              @Override
              public Component getEditorComponent() {
                   return this;
              @Override
              public Object getItem() {
                   return text.getText();
              @Override
              public void removeActionListener(ActionListener l) {
                   listenerList.remove(ActionListener.class, l);
              @Override
              public void setItem(Object anObject) {
                   if (anObject == null)
                        text.setText("");
                   else
                        text.setText(String.valueOf(anObject));
              @Override
              public void selectAll() {
                   text.selectAll();
              public void componentHidden(ComponentEvent arg0) {}
              public void componentMoved(ComponentEvent arg0) {}
              @Override
              public void componentResized(ComponentEvent arg0) {
                   JViewport view = this.getViewport();
                   Dimension viewDim = view.getExtentSize();
                   Insets insets = view.getInsets();
                   System.out.println("actual view height: " + viewDim.height);
                   Dimension wantDim = text.getPreferredScrollableViewportSize();
                   if (wantDim.height > viewDim.height) {
                        viewDim.height = wantDim.height + insets.top + insets.bottom;
                        view.setPreferredSize(viewDim);
                        view.revalidate();
                        ((JComponent) this.getParent()).revalidate();
                        //SwingUtilities.windowForComponent(this).pack(); //even this doesn't work
              @Override
              public void componentShown(ComponentEvent arg0) {}
          * Only really need to expose rowHeight but might as well determine the
          * correct size it wants its viewport
          * @author jfolson
         public static class LineAwareTextArea extends JTextArea {
              private int maxVisibleRows = 3;
              public LineAwareTextArea() {
                   super();
              public LineAwareTextArea(String text) {
                   this();
                   setText(text);
              @Override
              public Dimension getPreferredScrollableViewportSize() {
                   Dimension d = this.getPreferredSize();
                   float hspan = getWidth();
                   View view = (getUI()).getRootView(this);
                   view.setSize(hspan, Float.MAX_VALUE);
                   float vspan = view.getPreferredSpan(View.Y_AXIS);
                   Insets insets = getInsets();
                   int rows = (d.height / this.getRowHeight());
                   if (rows > maxVisibleRows)
                        rows = maxVisibleRows;
                   d.height = rows * getRowHeight() + insets.top + insets.bottom;
                   System.out.println("prefer view height: " + d.height + " (" + rows
                             + " line(s))");  // this is here just so I can see that it's getting the right number of desired lines.
                   return d;
              public void setMaxVisibleRows(int rows) {
                   this.maxVisibleRows = rows;
              public int getMaxVisibleRows() {
                   return this.maxVisibleRows;
         public static class ComboTest extends JFrame {
              public ComboTest() {
                   setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                   init();
                   pack();
                   show();
              private void init() {
                   ScrollablePanel mainPanel = new ScrollablePanel();
                   mainPanel.setScrollableWidth(ScrollableSizeHint.FIT);
                   mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
                   ScrollablePanel fieldPanel = new ScrollablePanel();
                   fieldPanel.setLayout(new BoxLayout(fieldPanel, BoxLayout.X_AXIS));
                   fieldPanel.setScrollableWidth(ScrollableSizeHint.FIT);
                   Vector<String> items = new Vector<String>();
                   items.add("Item One");
                   JComboBox list = new WrappingComboBox(items);
                   list.setEditable(true);
                   JLabel fieldLabel = new JLabel("Label: ");
                   fieldLabel.setAlignmentY(TOP_ALIGNMENT);
                   list.setAlignmentY(TOP_ALIGNMENT);
                   fieldPanel.add(fieldLabel);
                   fieldPanel.add(list);
                   mainPanel.add(fieldPanel);
                   fieldPanel = new ScrollablePanel();
                   fieldPanel.setLayout(new BoxLayout(fieldPanel, BoxLayout.X_AXIS));
                   fieldPanel.setScrollableWidth(ScrollableSizeHint.FIT);
                   items
                             .add("Item Two content content content content Item Two content content content content Item Two content content content content Item Two content content content content");
                   list = new WrappingComboBox(items);
                   list.setEditable(true);
                   fieldLabel = new JLabel("Label: ");
                   fieldLabel.setAlignmentY(TOP_ALIGNMENT);
                   list.setAlignmentY(TOP_ALIGNMENT);
                   fieldPanel.add(fieldLabel);
                   fieldPanel.add(list);
                   mainPanel.add(fieldPanel);
                   JScrollPane mainScrolls = new JScrollPane(mainPanel,
                             JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                             JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
                   mainScrolls.setPreferredSize(new Dimension(200, 200));
                   setContentPane(mainScrolls);
         public static void main(String[] args) {
              new ComboTest();
    }And here is the WrappingList that it references
    import java.awt.Component;
    import java.awt.Dimension;
    import java.awt.Insets;
    import javax.swing.JFrame;
    import javax.swing.JList;
    import javax.swing.JScrollPane;
    import javax.swing.JTextPane;
    import javax.swing.ListCellRenderer;
    import javax.swing.ListModel;
    import javax.swing.border.EmptyBorder;
    import javax.swing.plaf.basic.BasicListUI;
    import javax.swing.text.View;
    * List that wraps its text! Whenever the list's layout (e.g. size) changes the
    * list's UI is instructed to update its layout too.
    public class WrappingList extends JList {
         public WrappingList() {
              setUI(new WrappingListUI());
              setCellRenderer(new WrappingListCellRenderer());
         public WrappingList(ListModel model) {
              super(model);
              setUI(new WrappingListUI());
              setCellRenderer(new WrappingListCellRenderer());
         @Override
         public void doLayout() {
              ((WrappingListUI) getUI()).updateLayoutState();
              super.doLayout();
         @Override
         public boolean getScrollableTracksViewportWidth() {
              return true;
          * ListUI implementation that exposes the method for updating its layout
         private static class WrappingListUI extends BasicListUI {
              @Override
              public void updateLayoutState() {
                   super.updateLayoutState();
          * List cell renderer that uses the list's width to alter its preferred size
          * TODO - override bound properties in the same way as
          * DefaultListCellRenderer
         public static class WrappingListCellRenderer extends JTextPane implements
                   ListCellRenderer {
              public WrappingListCellRenderer() {
                   setBorder(new EmptyBorder(1, 1, 1, 1));
              public Component getListCellRendererComponent(JList list, Object value,
                        int index, boolean selected, boolean hasFocus) {
                   setBackground(selected ? list.getSelectionBackground() : list
                             .getBackground());
                   setForeground(selected ? list.getSelectionForeground() : list
                             .getForeground());
                   // TODO - border, font etc.
                   setText(String.valueOf(value));
                   float hspan = list.getWidth();
                   View view = (getUI()).getRootView(this);
                   view.setSize(hspan, Float.MAX_VALUE);
                   float vspan = view.getPreferredSpan(View.Y_AXIS);
                   Insets insets = getInsets();
                   setPreferredSize(new Dimension(insets.left + insets.right
                             + (int) hspan, insets.top + insets.bottom + (int) vspan));
                   return this;
         public static void main(String[] args) {
              new Test();
         public static class Test extends JFrame {
              public Test() {
                   setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                   init();
                   pack();
                   show();
              private void init() {
                   JList list = new WrappingList();
                   list
                             .setListData(new Object[] {
                                       "Item One",
                                       "Item Two content content content content Item Two content content content content Item Two content content content content Item Two content content content content" });
                   setContentPane(new JScrollPane(list,
                             JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                             JScrollPane.HORIZONTAL_SCROLLBAR_NEVER));
    }You can verify (in System.out) that the preferred size is larger than the actual default size once you switch to the longer value in the combo box, but the actual size doesn't change. I've tried setSize, setMinimumSize, nothing makes the JScrollPane/Editor any larger. I've also tried calling and not calling various combinations of revalidate(), getParent().revalidate() and getViewport().revalidate(). What am I missing?
    Edited by: inspired2apathy on Oct 16, 2010 7:22 PM

    inspired2apathy wrote:
    ... The goal is a ScrollPane that automatically wraps the text inside it. I've just about got it, but I have one thing that's not working. If I just put the JTextArea{s} in as the Editor, then you lose the any text that doesn't fit inside whatever the initial size was. Instead, I put the JTextAreas inside a JScrollPane which works fine, except that I still have to determine the size of the JScrollPane in advance. I would like to make each Editor/JScrollPane start out with just a single line of text and expand until it reaches a certain small number of lines.
    ... What am I missing?THE BASICS. See if this isn't what you are trying to do.
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    public class Test
      public static void main(String[] args) {
        JTextArea ta = new JTextArea();
        ta.setLineWrap(true);
        ta.setWrapStyleWord(true);
        JScrollPane sp = new JScrollPane(ta);
        JFrame f = new JFrame();
        f.getContentPane().add(sp, "Center");
        f.setBounds(0, 0, 400, 300);
        f.setDefaultCloseOperation(f.EXIT_ON_CLOSE);
        f.setVisible(true); 
    }OP, your code was too long and complicated for me to compile and run. However, aren't you forgetting the two simple methods <tt>JTextArea.setLineWrap()</tt> and <tt>JTextArea.setWrapStyleWord()</tt>? Furthermore, I absolutely see no need for you to extend SWING components for demonstration this simple -- that is, if I understand your problem correctly.

  • WS-Security, WSE, Web Services, Authentication and Flex 2

    Hey All,
    I've been working hard on getting Flex to communicate with a
    Microsoft .NET 2.0 Web Services project enabled with WSE 3.0
    WS-Security. I can't seem to get the headers into the SOAP request
    that I need.
    For example, I can get a SOAP header into the message like
    so:
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="
    http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd="
    http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="
    http://www.w3.org/2001/XMLSchema-instance">
    <SOAP-ENV:Header>
    <ns0:Security xmlns:ns0="
    http://tempuri.org/">
    <ns0:password>pass</ns0:password>
    <ns0:username>DOMAIN\Administrator</ns0:username>
    </ns0:Security>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
    <HelloWorld xmlns="
    http://tempuri.org/" />
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    .. but, this isn't what my WSE, WS-Security enabled service
    expects. Which is:
    <soap:Envelope xmlns:soap="
    http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="
    http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="
    http://www.w3.org/2001/XMLSchema"
    xmlns:wsa="
    http://schemas.xmlsoap.org/ws/2004/08/addressing"
    xmlns:wsse="
    http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
    xmlns:wsu="
    http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <soap:Header>
    <wsa:Action>
    http://tempuri.org/HelloWorld</wsa:Action>
    <wsa:MessageID>urn:uuid:5be8b55a-df7b-4547-8def-76282fcd8b47</wsa:MessageID>
    <wsa:ReplyTo>
    <wsa:Address>
    http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>
    </wsa:ReplyTo>
    <wsa:To>
    http://localhost/CampaignMojoAPI.asmx</wsa:To>
    <wsse:Security soap:mustUnderstand="1">
    <wsu:Timestamp
    wsu:Id="Timestamp-aab299a8-81e3-4d8a-bfa4-555f38978584">
    <wsu:Created>2007-06-06T20:26:37Z</wsu:Created>
    <wsu:Expires>2007-06-06T20:31:37Z</wsu:Expires>
    </wsu:Timestamp>
    <wsse:UsernameToken xmlns:wsu="
    http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
    wsu:Id="SecurityToken-b43668b1-51a3-4ba1-a90a-69eca3b98b66">
    <wsse:Username>DOMAIN\Administrator</wsse:Username>
    <wsse:Password Type="
    http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#Passwor dText">pass</wsse:Password>
    <wsse:Nonce>IK4ZemfS1pj3kpdYO5+FBg==</wsse:Nonce>
    <wsu:Created>2007-06-06T20:26:37Z</wsu:Created>
    </wsse:UsernameToken>
    </wsse:Security>
    </soap:Header>
    <soap:Body>
    <HelloWorld xmlns="
    http://tempuri.org/" />
    </soap:Body>
    </soap:Envelope>
    I've tried "addSimpleHeader" and "addHeader", but both seem
    to inject nested xml elements. Can anyone help me shape this WS
    call into the format I need it in? Would it be possible to call
    this WS manually via a direct HTTP post from Flex 2?
    Thanks!,
    Sean

    Yeah,
    Hey guys - thanks for the responses. I looked into this and
    it seems no one uses WS-Security from the browser. That's why even
    Google's APIs use alternative key logins, etc. I read from one user
    that in the next version of Microsoft's AJAX platform that they
    might support it, but that's about it. For now, it looks like
    there's not even an AJAX/Javascript way to do this. If we could do
    it via Javascript, then we could use the FABridge. I don't think
    Flex supports it. I've tried to manipulate the headers into place
    via Flex classes and I don't think enough control is there to get
    the output in the form that's needed.
    I think it's possible to write it in Javascript. But right
    now my time budget just doesn't allow for it. I already spent two
    whole days re-writing how Flex makes Web Service calls so they're
    synchronous with timeouts instead of this massive amount of
    asynchronous code they want you to write, so no more
    re-writing/extending of components for me for a while.
    But if anyone wants to work together to support it via
    AJAX/Javascript, I would invest money into developing it.
    I would like a public WS-Security AJAX/Javascript framework
    for making these calls via WS-Security so I can offer customers a
    standard way of accessing/authenticating against our public API
    set. It would also make it possible for Flex to access standard web
    services with WS-Security enabled.
    Let me know what you guys think, or if anyone else has any
    good suggestions/software.
    Thanks much,
    S.

  • Retrieve data from SQL database and put into a table

    Hi all, i encountered this error while trying to create a table in 1 of my panels:
    C:\Documents and Settings\L311c01\Desktop\FYPJ Java2\RFIDLogistics.java:25:{color:#ff0000} cannot find symbol
    symbol : class ResultSetTable
    {color}location: class jdbc_bible.part2.RFIDLogistics
    private static ResultSetTable model = new ResultSetTable();
    ^
    C:\Documents and Settings\L311c01\Desktop\FYPJ Java2\RFIDLogistics.java:25: {color:#ff0000}cannot find symbol
    symbol : class ResultSetTable
    {color}location: class jdbc_bible.part2.RFIDLogistics
    private static ResultSetTable model = new ResultSetTable();
    I understand that " cannot find symbol class ResultSetTable means that i need to import something which has this ResultSetTable. I suppose my imports are sufficient and i think the error is with the package that i included.
    This package was taken from an example in a book named java database programming bible, so i assumed it is reliable and i use it for my insert statement, which had a DataInserter.
    Could someone plz help me with this? Thanks alot in advance.
    Here are the codes:
    {color:#ff0000}package jdbc_bible.part2;{color}
    import java.sql.*;
    import javax.swing.*;
    import java.util.Vector;
    import javax.swing.table.AbstractTableModel;
    import java.awt.*;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import java.io.*;
    import java.util.*;
    import javax.swing.event.*;
    import java.awt.event.*;
    import javax.swing.border.*;
    import sun.jdbc.odbc.JdbcOdbcDriver;
    public class RFIDLogistics extends JFrame{
    //Components
    // public SimpleClock clock;
    private static JTable jt;
    private static ResultSetTable model = new ResultSetTable();
    some codes
    {color:#ff0000}try
    {{color}
    {color:#ff0000} DataInserter inserter = new DataInserter();
    String SQLCommand = "INSERT INTO " + flstr + " (Item_ID,Location_ID) VALUES ('"+Item_ID1+"','"+Location_ID1+"')";
    String SQLCommand2 = "UPDATE Location SET Item_ID = '"+Item_ID1+"' WHERE Location_ID = '"+Location_ID1+"'";
    inserter.execute(SQLCommand);
    inserter.execute(SQLCommand2);
    {color} JOptionPane.showMessageDialog(null, "Successful!");
    catch(ClassNotFoundException f)
    f.printStackTrace();
    catch(SQLException f)
    f.printStackTrace();
    some codes
    public JPanel rightPanel() {
    JPanel rightPanel = new JPanel();
    rightPanel.setLayout(new BoxLayout(rightPanel, BoxLayout.Y_AXIS));
    //Forklift title Panel
    JPanel panel6 = new JPanel();
    panel6.setBorder(new TitledBorder(""));
    panel6.setPreferredSize(new Dimension(192,33));
    panel6.add(forkliftDetails);
    //Forklift 1 Panel
    {color:#ff0000} JPanel panel7 = new JPanel();
    panel7.setBorder(new TitledBorder("Forklift 1"));
    panel7.setPreferredSize(new Dimension(192,120));{color}
    {color:#ff0000} String query = "SELECT * FROM Forklift1";
    try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:RFID Logistics");
    PreparedStatement pstmt = con.prepareStatement(query);
    ResultSet rs= pstmt.executeQuery();
    // display the data in jtable
    jt = new JTable();
    model.setResultSet(rs);
    jt.setModel(model);
    catch(ClassNotFoundException sqle){
    System.out.println(sqle);
    }catch(SQLException sqle){
    System.out.println(sqle);
    panel7.add(itemDetail1);
    itemDetail1TextField.setEditable(false);
    panel7.add(itemDetail1TextField);
    panel7.add(locationDetail1);
    locationDetail1TextField.setEditable(false);
    panel7.add(locationDetail1TextField);
    panel7.add(jt);
    {color}..
    //Main Method
    public static void main(String args[]) {
    RFIDLogistics app = new RFIDLogistics();
    app.setFrame();
    app.setResizable(false);
    app.setDefaultCloseOperation(EXIT_ON_CLOSE);
    app.setSize(1024,676);
    app.setLocation(0,60);
    app.setVisible(true);
    If you would like to try if my table can extract, here are the sample codes, just change ur database name which is highlighted in green, and the table name in blue.
    Codes:
    import java.sql.*;
    import javax.swing.*;
    import java.util.Vector;
    import javax.swing.table.AbstractTableModel;
    import java.awt.*;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import java.io.*;
    import java.util.*;
    import javax.swing.event.*;
    import java.awt.event.*;
    import javax.swing.border.*;
    import sun.jdbc.odbc.JdbcOdbcDriver;
    public class sample1{
    private static JFrame frm;
    private static JTable jt;
    private static ResultSetTable model = new ResultSetTable();
    public static void main(String args[]){
    String query = "SELECT * FROM {color:#00ccff}Forklift1{color}";
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:{color:#00ff00}RFID Logistics{color}");
    PreparedStatement pstmt = con.prepareStatement(query);
    ResultSet rs= pstmt.executeQuery();
    // display the data in jtable
    jt = new JTable();
    model.setResultSet(rs);
    jt.setModel(model);
    frm = new JFrame("Sample");
    frm.setSize(400,400);
    frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frm.add(jt);
    frm.setVisible(true);
    }catch(ClassNotFoundException sqle){
    System.out.println(sqle);
    }catch(SQLException sqle){
    System.out.println(sqle);
    Could someone plz help me with this? Thanks alot in advance.

    public JTable populateTable()
      String[] colNames = new String[] {"ID","NAME","SURNAME"};
      return new JTable(getSQLData(), colNames);
    public Object[][] getSQLData()
      stmt = conn.createStatement();
      ResultSet rs = stmt.executeQuery("SELECT [ID], [NAME], [SURNAME] FROM [USERS]");
      Object[][[] out = new Object[rs.getFetchSize()][3];//Not sure on getFetchSize but it should work
      int i = 0;
      while(rs.next())
        out[0] = rs.getInt(1);
    out[i][1] = rs.getString(2);
    out[i++][2] = rs.getString(3);
    return out;
    The above code will create a JTable with the data retrieved from the DB                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How do I address the scrollbar's updateDisplayList properties if I do not instatiate the scrollBar component?

    Is there an easier route?
    My issue is that I am not attaching the scrollbar via
    <mx:HScrollBar or mx:VScrollBar, rather it is being
    automatically attached to a container. Therefore my only means of
    addressing this particular scrollbar seems to be from within the
    condainer's script, and the container's properties do not make
    provision for it's child scrollBar's height/width.
    Is it a matter of re-writing the default scroll component?
    For example, I've skinned a scrollBar using the examples at
    Narciso Jaramillo's
    http://www.adobe.com/devnet/flex/articles/flex_skins.html
    (using Flash) but this article does not explain how to
    override the default scaling.
    Next I've applied the skins to the Adobe example,
    http://examples.adobe.com/flex2/inproduct/sdk/photoviewer/srcview/index.html
    within the ThumbnailView.mxml file there is a Vbox containing
    a HorizonalList container with the id of photoList , that when
    loaded, adds a HorizontalScrollBar, like this..
    <mx:HorizontalList id="photoList"
    dataProvider="{gallery.photos}"
    width="98%" height="135" selectedIndex="0"
    itemRenderer="Thumbnail"
    styleName="thumbnailList" />
    I understand that the scope of this matter may be small in
    comparison to other issues but as a designer these otherwise simple
    tasks are terribly frustrating and time consuming.
    I would appreciate any insight.
    Thank You,
    Key.

    First this forum is intended for questions about Flex
    Builder. Flex language questions should be posted in the Flex
    General Discussion forum.
    That is why you are not getting any response.
    There is a yahoo group called flexcomponents that is devoted
    to issues around customizing/extending/creating components. The
    folks that hang out there are top notch, give it a look.
    http://tech.groups.yahoo.com/group/flexcomponents/
    Tracy

Maybe you are looking for

  • Aggregating Slowly Changing Dimension

    Hi All: I have a problem with whole lot of changes in the dimension values (SCD), need to create a view or stored procedure: Two Tables within the Oracle db are joined Tbl1: Store Summary consisting of Store ID, SUM(Sales Qty) Tbl2(View): Store View

  • Not able to access DB on VM after getting Reserved IP

    Hi, I have Reserved an Public Virtual IP for my VM 23.102.xxx.xxx  The OS WIN server 2012 R2 and and has SQL server 2012 running on it. Problem: 1. I'm not able to access the DB or connect to the server form outside( from my local machine). I was abl

  • Blocking the Cleared items From Fi Documents

    Hi ,        I am creating fi report . In my report i do not want to display cleared items . Can you tell me based which table and which field we can remove clearing documents .       In my customer balance report i want to remove the reversal entries

  • How to call  set method

    hi i have a set method which i what to call from another class how can i do that Edited by: ADF007 on 2012/09/13 2:08 PM Edited by: ADF007 on 2012/09/13 2:08 PM Edited by: ADF007 on 2012/09/13 3:14 PM

  • Artwork for albums

    is there any way to set the artwork for an album if itunes cannot find an album cover?