How to add muliple panels to a single frame?

How can i place my diff panels on a same frame at same location/place?
what i need is on double clicking on each leaf node of my tree.. i need corresponding panel on frame.
the problem is can place each panel in diff place(ie east/west/north/south in BorderLayout)
but i cannot place 2 panels in same place.

thanks got correct..

Similar Messages

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

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

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

  • [CS3] How to add multiple panels in a single FR

    Fellow Developers,
    I have tried every other way to try adding a 2nd panel definition to a single fr - no luck. Here is what I did.
    //================================================================================
    // PanelList definition.
    //================================================================================
    resource PanelList (kSDKDefPanelResourceID)
    // 1st panel in the list
    kSDKDefPanelResourceID,
    kGINPluginID,
    isResizable,
    kGINPanelWidgetActionID,
    kGINPanelTitleKey,
    "",item in a second place
    0.0,
    0,0,
    c_Panel,
    // 2nd panel in the list
    kGINDocPanelPanelWidgetResourceID,
    kGINPluginID,
    notResizable,
    kGINDocPanelPanelWidgetActionID,
    kGINDocPanelPanelTitleKey,
    0.0,
    0,0,
    c_Panel
    resource GINPanelWidget(kSDKDefPanelResourceID + index_enUS)
    resource GINDocPanelPanelWidget(kGINDocPanelPanelWidgetResourceID + index_enUS)
    In ID.h
    #define kGINDocPanelPanelWidgetResourceID 720 // random number
    Code builds but I get an assert complaining about missing resource with id = 720.
    All the included samples in SDK illustrate single panels.
    Appreciate any help. Thanks
    CG

    You are trying to merge two panel resource with SDK PanelList. Instead create a separate panelist for each panel resource -
    resource PanelList (kGINDocPanelPanelWidgetResourceID)
    // 2nd panel in the list
    kGINDocPanelPanelWidgetResourceID,
    kGINPluginID,
    notResizable,
    kGINDocPanelPanelWidgetActionID,
    kGINDocPanelPanelTitleKey,
    0.0,
    0,0,
    c_Panel
    Hope this helps !!
    - Amit Gupta
    MetaDesign Solutions

  • How do I position to panels in a single frame?

    Hi,
    Can someone tell me how i can position two panels in a single frame using the BorderLayout class.
    I have included my code below. When it is run it shows two JPanels positioned at the top and the bottom, a text area to the right, a panel in the center and a panel on the left. I want to get the panel on the left - the yellow panel - to be positioned in the lower third of the center panel. I have tried to use the BorderLayout.SOUTH statement - but this positions the panel across the very bottom which causes the bottom JPanel and part of the text area to disappear.
    Can anyone help with this please???
    Many thanks
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Panels extends JFrame implements ActionListener
         private TopPanel topPanel;
         private BottomPanel bottomPanel;
         private JButton open;
         private JButton close;
         private JButton connect;
         boolean openClicked = false;
         boolean closeClicked = false;
         public Panels()
              super("Panels");
              setSize(1000,600);
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              setVisible(true);
              Container contentArea = getContentPane();
              topPanel = new TopPanel();
              bottomPanel = new BottomPanel();
              JTextArea textArea = new JTextArea("Text Area",20,20);
              JScrollPane textScroller = new JScrollPane(textArea);
              open = new JButton("Open");
              open.addActionListener(this);
              close = new JButton("Close");
              close.addActionListener(this);
              connect = new JButton("Connect");
              connect.addActionListener(this);
              JPanel topBar = new JPanel();
              topBar.setBackground(Color.red);
              topBar.add(open);
              topBar.add(close);
              JPanel lowerBar = new JPanel();
              lowerBar.setBackground(Color.red);
              lowerBar.add(connect);
              bottomPanel.setPreferredSize(new Dimension(100,100));
              contentArea.add(topPanel);
         contentArea.add(bottomPanel,BorderLayout.WEST);
              contentArea.add(textScroller,BorderLayout.EAST);
              contentArea.add(lowerBar,BorderLayout.SOUTH);
              contentArea.add(topBar,BorderLayout.NORTH);
              setContentPane(contentArea);
    public void actionPerformed(ActionEvent e)
         if(e.getSource() == open)
         openClicked = true;
         topPanel.repaint();
         if(e.getSource() == close)
         {closeClicked = true;
         bottomPanel.repaint();
    class TopPanel extends JPanel
         public TopPanel()
         public void paintComponent(Graphics painter)
              super.paintComponent(painter);
              painter.setColor(Color.white);
              painter.fillRect(0,0,getSize().width,getSize().height);
              if (openClicked == true)
              drawTopMessage(painter);
         public void drawTopMessage(Graphics painter)
              painter.setColor(Color.black);
              painter.drawString("This is the top panel", 20,20);
    class BottomPanel extends JPanel
         public BottomPanel()
         public void paintComponent(Graphics painter)
              super.paintComponent(painter);
              painter.setColor(Color.yellow);
              painter.fillRect(0,0,getSize().width,getSize().height);
              if (closeClicked == true)
              drawBottomMessage(painter);
         public void drawBottomMessage(Graphics painter)
              painter.setColor(Color.black);
              painter.drawString("This is the bottom panel", 20,20);
    public static void main(String[] args)
         Panels example = new Panels();

    One solution would be to create a new panel, bothPanels and adding the two panels that you need to this panel.
    Once you have done that, you can add bothPanels to contentArea.add( bothPanels, BorderLayout.CENTER)
    hth

  • How to add different columns in a single dashboard prompt?

    Hi
    I am new to this forum. I got a new requirement, my client is asking me to show multiple columns with multiple tables in a single dashboard prompt
    for Ex: Column name Table name
    1. Customer 1. Customer Details
    2. Market 2. Region
    3. Order 3. Order Status
    4. Product 4. Product Type
    He wants to show all these column names in a single prompt when user click on the particular column name it should appear on report. Is it Possible? if possible tell me how?

    See this thread...
    Re: How to add new columns by using Multiselect

  • Urgent ! How to add multiple JToolBars in a single JFrame

    How to implement multiple JToolBars in a single JFrame
    or what is the concept behind floating toolBars.If anybody can help me ,Thisis very urgent

    If you insist on multiple toolbars, use the following code:
    JToolBar tb1 = new JToolBar();
    //add stuff
    JToolBar tb2 = new JToolBar();
    //add stuff
    //put the toolbars on the top of the window
    JPanel toolbars = new JPanel(new BorderLayout());
    toolbars.add(tb1, BorderLayout.NORTH);
    toolbars.add(tb2, BorderLayout.CENTER);
    getContentPane().add(toolbars, BorderLayout.NORTH);Stephen

  • How to add muliple namespace in XMP schema?

    Dear All,
    I was wondering how to add more than one namespace in a schema. I have seen that some schemas in XMP have more than one namespace, e.g.,
    <rdf:Description rdf:about=""
                xmlns:xmpTPg="http://ns.adobe.com/xap/1.0/t/pg/"
                xmlns:xmpG="http://ns.adobe.com/xap/1.0/g/"
                xmlns:stFnt="http://ns.adobe.com/xap/1.0/sType/Font#">
    When I register a namespace using IMetaDataAccess:RegisterNamespace, say http://ns.abc.com, I get a schema as follows:
    <rdf:Description rdf:about=""
                xmlns:abc="http://ns.abc.com">
    How to add an another namespace, say http://ns.xyz.com, to the same schema to get as follows:
    <rdf:Description rdf:about=""
                xmlns:abc="http://ns.abc.com"
                xmlns:xyz="http://ns.xyz.com">

    Dear All,
    I was wondering how to add more than one namespace in a schema. I have seen that some schemas in XMP have more than one namespace, e.g.,
    <rdf:Description rdf:about=""
                xmlns:xmpTPg="http://ns.adobe.com/xap/1.0/t/pg/"
                xmlns:xmpG="http://ns.adobe.com/xap/1.0/g/"
                xmlns:stFnt="http://ns.adobe.com/xap/1.0/sType/Font#">
    When I register a namespace using IMetaDataAccess:RegisterNamespace, say http://ns.abc.com, I get a schema as follows:
    <rdf:Description rdf:about=""
                xmlns:abc="http://ns.abc.com">
    How to add an another namespace, say http://ns.xyz.com, to the same schema to get as follows:
    <rdf:Description rdf:about=""
                xmlns:abc="http://ns.abc.com"
                xmlns:xyz="http://ns.xyz.com">

  • How to add a button to an existing frame?

    Hey everyone , this is a GUI question for a project I am doing in school.
    Basically, I have created a frame that has 3 JPanes, top, center and bottom. Here are the declarations:
    this.add(northPanel,    BorderLayout.NORTH);
              this.add(SYBoard, BorderLayout.CENTER);
              this.add(southPanel,    BorderLayout.SOUTH);          
                    When I try to add a button to the top panel, nothing is happening. This is my first time with GUI, so if anyone knows what is wrong, I wold highly appreciate it. Thanks so much:
         private void startGame() {
              String playerName = JOptionPane.showInputDialog("Enter your name");
              System.out.println(playerName);
              ScotlandYard.frame.northPanel.add(new JButton(playerName));
              ScotlandYard.frame = new SYFrameWithImages();
              ScotlandYard.frame.update();
              this.repaint();
         }               as you can see, i have tried updating, repainting, etc, but nuthin' is happening.

    In the future, Swing related questions should be posted in the Swing forum.
    After adding/removing a component from a panel on a visible frame you need to do:
    panel.add(...);
    panel.revalidate();
    panel.repaint(); // generally only needed for a remove

  • How to add multiple databases for a single frontend

    We have a project based on distributed databases and we have to workout on .Net framework.I want to know some information of connecting multiple databases for a single frontend and how can we access them.
    If so we have connected 2 databases for a single frontend in future if I want add one more database to it how it will be possible to do it without disturbing the current connectivity.
    Please help me in resolving this problem.
    Thanks......

    hi,
    what do you mean by connecting 2 databases? can you explain further?
    using entityframework you can connect to different databases
    public class CustomerContext : DbContext
    public ReportContext()
    : base("DefaultConnection")
    public DbSet<Customers> Customers { get; set; }
    and your connectionstring (config file)
    <connectionStrings>
    <add name="DefaultConnection" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=D:\\Database\Project.mdf;Integrated Security=True" providerName="System.Data.SqlClient" />
    </connectionStrings>
    you can add more connection strings on it.
    https://msdn.microsoft.com/en-us/library/vstudio/cc716756(v=vs.100).aspx
    https://msdn.microsoft.com/en-us/library/ms254978(v=vs.110).aspx
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • How to add mouse listener for a single row alone

    I have a requirement. In a JTable when I double click a particular row the cells in the row should set to the width which I have provided.
    The problem with my code is when I click fourth row in the table, the first row gets adjusted.
    So how I need help is
    only if I click the first row, the first row cell size should get adjusted not when I click fourth row.
    Similarly if I give some cell width and height for fourth row cells, then when I double click the fourth row, the fourth should alone get adjusted and not the other rows.
    Hope I have explained clearly.
    How can it be achieved?
    Please find below my code. Everything is hardcoded. So it may look messy. Please excuse.
    // Imports
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.JTextArea;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.table.TableColumn;
    class SimpleTableExample extends JFrame {
    // Instance attributes used in this example
    private JPanel topPanel;
    private JTable table;
    private JScrollPane scrollPane;
    String data1 = "";
    String data2 = "123456789ABCDEFGHIJKLMNOPQRSTUVQWXYZabcdefghijklmnopqrstuvwxyzaquickbrownfoxjumpedoverthelazydog";
    int size = data2.length();
    // Constructor of main frame
    public SimpleTableExample() {
         // Set the frame characteristics
         setTitle("Simple Table Application");
         setSize(400, 200);
         setBackground(Color.gray);
         // Create a panel to hold all other components
         topPanel = new JPanel();
         topPanel.setLayout(new BorderLayout());
         getContentPane().add(topPanel);
         // Create columns names
         String columnNames[] = { "SEL", "DESIGN DATA", "PART NUMBER" };
         // Create some data
         String dataValues[][] = { { data1, data2, "67", "77" },
              { "", "43", "853" }, { "", "89.2", "109" },
              { "", "9033", "3092" } };
         DefaultTableModel model = new DefaultTableModel(dataValues, columnNames);
         model.addColumn("PART TITLE");
         model.addColumn("SPECIAL INSTRUCTIONS");
         table = new JTable(model) {
         public boolean isCellEditable(int rowIndex, int colIndex) {
              return false;
         // set specific row height
         table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
         int colInd = 0;
         TableColumn col = table.getColumnModel().getColumn(colInd);
         int width = 50;
         col.setPreferredWidth(width);
         int colInd2 = 1;
         TableColumn col2 = table.getColumnModel().getColumn(colInd2);
         int width2 = 100;
         col2.setPreferredWidth(width2);
         int colInd3 = 2;
         TableColumn col3 = table.getColumnModel().getColumn(colInd3);
         int width3 = 10;
         col3.setPreferredWidth(width3);
         int colInd4 = 3;
         TableColumn col4 = table.getColumnModel().getColumn(colInd4);
         int width4 = 10;
         col4.setPreferredWidth(width4);
         int colInd5 = 4;
         TableColumn col5 = table.getColumnModel().getColumn(colInd5);
         int width5 = 10;
         col5.setPreferredWidth(width5);
         table.addMouseListener(new MouseAdapter() {
         public void mouseClicked(MouseEvent e) {
              if (e.getClickCount() == 2) {
              JTable target = (JTable) e.getSource();
              int row = target.getSelectedRow();
              int column = target.getSelectedColumn();
              TableColumn col1 = table.getColumnModel().getColumn(0);
              col1.setPreferredWidth(50);
              TableColumn col2 = table.getColumnModel().getColumn(1);
              col2.setPreferredWidth(400);
              table.getColumnModel().getColumn(1).setCellRenderer(
                   new TableCellLongTextRenderer());
              table.setRowHeight(50);
              TableColumn col5 = table.getColumnModel().getColumn(4);
              col5.setPreferredWidth(200);
         // Create a new table instance
         // table = new JTable(dataValues, columnNames);
         // Add the table to a scrolling pane
         scrollPane = new JScrollPane(table);
         topPanel.add(scrollPane, BorderLayout.CENTER);
    // Main entry point for this example
    public static void main(String args[]) {
         // Create an instance of the test application
         SimpleTableExample mainFrame = new SimpleTableExample();
         mainFrame.setVisible(true);
    class TableCellLongTextRenderer extends JTextArea implements TableCellRenderer {
    public Component getTableCellRendererComponent(JTable table, Object value,
         boolean isSelected, boolean hasFocus, int row, int column) {
         this.setText((String) value);
         this.setWrapStyleWord(true);
         this.setLineWrap(true);
         // set the JTextArea to the width of the table column
         setSize(table.getColumnModel().getColumn(column).getWidth(),
              getPreferredSize().height);
         if (table.getRowHeight(row) != getPreferredSize().height) {
         // set the height of the table row to the calculated height of the
         // JTextArea
         table.setRowHeight(row, getPreferredSize().height);
         return this;
    Edited by: 915175 on Aug 3, 2012 4:24 AM

    Hi
    Try below code. Hope this will help
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.JTextArea;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.table.TableColumn;
    public class SimpleTableExample extends JFrame {
    private JPanel topPanel;
    private JTable table;
    private JScrollPane scrollPane;
    String data1 = "";
    String data2 = "123456789ABCDEFGHIJKLMNOPQRSTUVQWXYZabcdefghijklmnopqrstuvwxyzaquickbrownfoxjumpedoverthelazydog";
    int size = data2.length();
    // Constructor of main frame
    public SimpleTableExample() {
    // Set the frame characteristics
    setTitle("Simple Table Application");
    setSize(400, 200);
    setBackground(Color.gray);
    // Create a panel to hold all other components
    topPanel = new JPanel();
    topPanel.setLayout(new BorderLayout());
    getContentPane().add(topPanel);
    // Create columns names
    String columnNames[] = { "SEL", "DESIGN DATA", "PART NUMBER" };
    // Create some data
    String dataValues[][] = { { data1, data2, "67", "77" },
    { "", "43", "853" }, { "", "89.2", "109" },
    { "", "9033", "3092" } };
    DefaultTableModel model = new DefaultTableModel(dataValues, columnNames);
    model.addColumn("PART TITLE");
    model.addColumn("SPECIAL INSTRUCTIONS");
    table = new JTable(model) {
    public boolean isCellEditable(int rowIndex, int colIndex) {
    return false;
    // set specific row height
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    int colInd = 0;
    TableColumn col = table.getColumnModel().getColumn(colInd);
    int width = 50;
    col.setPreferredWidth(width);
    int colInd2 = 1;
    TableColumn col2 = table.getColumnModel().getColumn(colInd2);
    int width2 = 100;
    col2.setPreferredWidth(width2);
    int colInd3 = 2;
    TableColumn col3 = table.getColumnModel().getColumn(colInd3);
    int width3 = 10;
    col3.setPreferredWidth(width3);
    int colInd4 = 3;
    TableColumn col4 = table.getColumnModel().getColumn(colInd4);
    int width4 = 10;
    col4.setPreferredWidth(width4);
    int colInd5 = 4;
    TableColumn col5 = table.getColumnModel().getColumn(colInd5);
    int width5 = 10;
    col5.setPreferredWidth(width5);
    // Cell Render should apply on each column -- add by Rupali
    for(int i=0; i< table.getColumnModel().getColumnCount(); i++){
    table.getColumnModel().getColumn(i).setCellRenderer( new TableCellLongTextRenderer());
    table.addMouseListener(new MouseAdapter() {
    public void mouseClicked(MouseEvent e) {
    if (e.getClickCount() == 2) {
    JTable target = (JTable) e.getSource();
    int row = target.getSelectedRow();
    int column = target.getSelectedColumn();
    setTableCellHeight(table,row,column); //Added by Rupali
    TableColumn col1 = table.getColumnModel().getColumn(0);
    col1.setPreferredWidth(50);
    TableColumn col2 = table.getColumnModel().getColumn(1);
    col2.setPreferredWidth(400);
    TableColumn col5 = table.getColumnModel().getColumn(4);
    col5.setPreferredWidth(200);
    // Create a new table instance
    // table = new JTable(dataValues, columnNames);
    // Add the table to a scrolling pane
    scrollPane = new JScrollPane(table);
    topPanel.add(scrollPane, BorderLayout.CENTER);
    * Created By Rupali
    * This will set cell's height and column's width
    * @param table
    * @param row
    * @param column
    public void setTableCellHeight(JTable table, int row, int column) {
    // set the JTextArea to the width of the table column
    setSize(table.getColumnModel().getColumn(column).getWidth(),
    getPreferredSize().height);
    if (table.getRowHeight(row) != getPreferredSize().height) {
    // set the height of the table row to the calculated height of the
    // JTextArea
    table.setRowHeight(row, getPreferredSize().height);
    // Main entry point for this example
    public static void main(String args[]) {
    // Create an instance of the test application
    SimpleTableExample mainFrame = new SimpleTableExample();
    mainFrame.setVisible(true);
    class TableCellLongTextRenderer extends JTextArea implements TableCellRenderer {
    public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus, int row, int column) {
    this.setText((String) value);
    this.setWrapStyleWord(true);
    this.setLineWrap(true);
    return this;
    }

  • How to add form values into a single line...

    How can we add numerous form values (say surname, first name and middle initial) into a single line? thanks in advance^^  

    You can use the "+" operator which is both the addition (number) and concatenation (string) operator. JavaScript makes the decision about how this operator will work by the type of the value of being processed. Two numbers JavaScript performs addition, character string and number, number and character string, or 2 character strings then concatenation.
    If you just use the '+' operator and spaces, you will get extra spaces unless you add code to allow for null fields and adjusting the spacing or other punctuation as needed. You may also need to force numeric values to character stings or you might end up with an addition and not concatenation.
    Adobe provided a example of a funciton to properly join 3 fields with full versions of Acrobat:
    function fillin(s1, s2, s3, sep) {
      // Concatenate 3 strings with separators where needed
      // convert passed strings to a string value
      s1 = s1.toString();
      s2 = s2.toString();
      s3 = s3.toString();
      // assign a numeric value for presence of a given string(s)
      var test = 0; // no passed strings
      if (s1 != "") test += 1; // s1 has a value
      if (s2 != "") test += 2; // s2 has a value
      if (s3 != "") test += 4; // s3 has a value
      // return appropriate combination based on passed strings
      if (test == 0) return ""; // no stings passed
      if (test == 1) return s1; // s1 only
      if (test == 2) return s2; // s2 only
      if (test == 3) return s1 + sep + s2; // s1 and s2
      if (test == 4) return s3; // s3 only
      if (test == 5) return s1 + sep + s3; // s1 and s3
      if (test == 6) return s2 + sep + s3; // s2 and s3
      if (test == 7) return s1 + sep + s2 + sep + s3; // s1, s2, and s3

  • How to add two services in a single application in SAP FIORI

    Hi Experts,
                I am working on SAP FIORI and created a starter application project using oData services. Initially i am adding one service from catalog and i want that service details ie., Business Partners to be displayed in my master view. Till this I am able to see the data in my master view.
            Now i would like to add one more service with which i should be able to see the item details of each and every BP.
    But i dont know where to add this second service and how..?
    Can anybody help me in solving this issue??

    Hi,
             My problem is fixed, they are calcualted if you have a child nodes. How means Revenue is positive and Expenses are negative. So we get difference of this two.
    Thanks
    Ganesh Reddy.

  • How to add multiple groups in a single user in ldap

    I have problem with ldap ,Please clarify the following problem.
    My request is --> send the multiple groups at a time with single user.
    My code contain single user and single group is working.
    Please see the source file ,please solve my problem. i tried , but i did not get.
    package com.ldap;
    import java.util.Hashtable;
    import javax.naming.AuthenticationException;
    import javax.naming.Context;
    import javax.naming.NameAlreadyBoundException;
    import javax.naming.NamingException;
    import javax.naming.directory.Attribute;
    import javax.naming.directory.Attributes;
    import javax.naming.directory.BasicAttribute;
    import javax.naming.directory.BasicAttributes;
    import javax.naming.directory.DirContext;
    import javax.naming.directory.InitialDirContext;
    * This class provides methods for the user management
    * @author sudhakar
    public class LdapUserMgr {
         public final static String USER_ID = "uid";
         public final static String COMMONNAME = "cn";
         public final static String SURNAME = "sn";
         public final static String MEMBEROF = "wlsMemberOf";
         public final static String MEMBEROF1 = "wlsMemberOf";
         public final static String PASSWORD = "userpassword";
         public final static String EMAIL = "mail";
         * This method creates new user in the embedded ldap registry
         * @return
         * @throws Exception
         public void createUser() throws Exception {
              DirContext ctx = getLDAPConnection();
              String userId="sudhakar";
              String userName="sudhakar";
              String userRole="Assessor";
              String password="sudhakar123";
              String email="[email protected]";
              try{
                        Attributes attrNew = new BasicAttributes(true);
                        Attribute objclass = new BasicAttribute("objectclass");
                        String group = "ou=groups,ou=myrealm,dc=sudhakar_domain";
                        String people = "ou=people,ou=myrealm,dc=sudhakar_domain";
                        // add all the object classes required for the user profile
                        objclass.add("top");
                        objclass.add("person");
                        objclass.add("organizationalPerson");
                        objclass.add("inetOrgPerson");
                        objclass.add("wlsUser");
                        // put all the attributes required as part of the user profile
                        // add object classes
                        attrNew.put(objclass);
                        // add user Id
                        attrNew.put(USER_ID, userId);
                        // add user common name
                        attrNew.put(COMMONNAME, userName);
                        // add user surname
                        attrNew.put(SURNAME, userName);
                        // prepare the group path for the user
                        String role = COMMONNAME + "=" + userRole + "," + group;
                        // add user to a group
                        attrNew.put(MEMBEROF,role);
                        System.out.println("user role is "+role);
    // i want to pass multiple user roles at a time
                        // add user password
                        attrNew.put(PASSWORD, password);
                        // add user mail Id
                        attrNew.put(EMAIL, email);
                        // Prepare the query string to add the user to the embedded ldap
                        String query = USER_ID + "=" + userId+ "," + people;
                        System.out.println("user query is "+query);
                        // add the user to the LDAP directory
                        ctx.createSubcontext( query, attrNew );
                        System.out.println("user" + userId+ "created");
              catch ( NameAlreadyBoundException nabe ){
                   System.out.println(nabe.getMessage());
                   throw new NameAlreadyBoundException("User by this name already exits");
              catch (NamingException namEx) {
                   System.out.println(namEx.getMessage());
              catch(Exception ex){
                   System.out.println(ex.getMessage());
              finally{
                   closeLDAPConnection(ctx);
         public DirContext getLDAPConnection() throws Exception{
              DirContext ctx = null;
              try{
                   Hashtable<String,String> env = new Hashtable<String,String>();
                   env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
                   env.put(Context.PROVIDER_URL, "ldap://192.168.100.84:7030/");
                   env.put(Context.SECURITY_AUTHENTICATION, "simple");
                   env.put(Context.SECURITY_PRINCIPAL, "cn=Admin");
                   env.put(Context.SECURITY_CREDENTIALS,"admin");
                   // Create the initial directory context
                   ctx = new InitialDirContext(env);
         return ctx;
              catch (AuthenticationException authEx){
                   System.out.println(authEx.getMessage());
              throw new AuthenticationException("Authentication failed");
              catch (NamingException namEx) {
                   System.out.println(namEx.getMessage());
              throw new NamingException("Naming Exception");
              catch(Exception ex){
                   System.out.println(ex.getMessage());
              throw new Exception("Exception Occured");
         * This method closes the LDAP connection
         * @param ctx
         public void closeLDAPConnection(DirContext ctx){
              try{
                   ctx.close();
              catch(NamingException nex){
                   System.out.println(nex.getMessage());
              catch(Exception ex){
                   System.out.println(ex.getMessage());
         public static void main(String s[])throws Exception{
              LdapUserMgr ldapUserMgr = new LdapUserMgr();
              ldapUserMgr.createUser();
    Edited by: sudhakar_kavuru on Jun 16, 2009 1:58 AM

    Hi Sudhakar,
    try some thing like this.Here I have enclosed the code snippet.
         String query = USER_ID + "=" + user.getUserId()+ "," + people;
                        // add the user to the LDAP directory
    //                    ctx.createSubcontext( query, attrNew );
                        Attribute att1 = new BasicAttribute(MEMBEROF);
                        String roleName=user.getUserRoleList().get(0);
                        String role1 = COMMONNAME + "="+roleName+"," + group;
                        att1.add(role1);
                        attrNew.put(att1);
                        DirContext dirContext =ctx.createSubcontext( query, attrNew );
                        for (int i = 1; i < user.getUserRoleList().size(); i++) {
                             Attributes att2 = new BasicAttributes();
                             String roleNameStr=user.getUserRoleList().get(i);
                             log.debug("roleNameStr--->"+roleNameStr);
                             String role2 = COMMONNAME + "="+roleNameStr+"," + group;
                             log.debug("role2-->"+role2);
                             att2.put(MEMBEROF,role2);
                             dirContext.modifyAttributes("", DirContext.ADD_ATTRIBUTE, att2);
                        }

  • How to add 3 legends for a single series barchart?? JAVAFX

    Here is my code to generate 10 bars of different colors. I want to add legend respectively but it only one shows yellow legend
    1. I think it shows only 1 color because there is only 1 series. Is it possible to add more than 1 legend for a single series?
    or
    2. or can i display another image for legend in barchart??
    output :http://i.stack.imgur.com/fSNu7.png
    file i want to display in barchart:http://i.stack.imgur.com/cchch.png
    public class DynamicallyColoredBarChart extends Application {
        @Override
        public void start(Stage stage) {
            final CategoryAxis xAxis = new CategoryAxis();
            xAxis.setLabel("Bars");
            final NumberAxis yAxis = new NumberAxis();
            yAxis.setLabel("Value");
            final BarChart<String, Number> bc = new BarChart<>(xAxis, yAxis);
            bc.setLegendVisible(false);
            XYChart.Series series1 = new XYChart.Series();
            for (int i = 0; i < 10; i++) {
                // change color of bar if value of i is >5 than red if i>8 than blue
                final XYChart.Data<String, Number> data = new XYChart.Data("Value " + i, i);
                data.nodeProperty().addListener(new ChangeListener<Node>() {
                    @Override
                    public void changed(ObservableValue<? extends Node> ov, Node oldNode, Node newNode) {
                        if (newNode != null) {
                            if (data.getYValue().intValue() > 8) {
                                newNode.setStyle("-fx-bar-fill: navy;");
                            } else if (data.getYValue().intValue() > 5) {
                                newNode.setStyle("-fx-bar-fill: red;");
                series1.getData().add(data);
            bc.getData().add(series1);
            stage.setScene(new Scene(bc));
            stage.show();
        public static void main(String[] args) {
            launch(args);
    ...Edited by: 993431 on Mar 12, 2013 1:42 PM

    Either:
    1. Use a chart which displays multiple series, then you can allow the built-in legend to show OR
    2. Use a single dynamically colored series have you have done and create your own custom legend.
    import javafx.application.Application;
    import javafx.scene.*;
    import javafx.scene.chart.*;
    import javafx.stage.Stage;
    public class ThreeSeriesBarChart extends Application {
      @Override public void start(Stage stage) {
        final CategoryAxis xAxis = new CategoryAxis();
        xAxis.setLabel("Bars");
        final NumberAxis yAxis = new NumberAxis();
        yAxis.setLabel("Value");
        final BarChart<String, Number> bc = new BarChart<>(xAxis, yAxis);
        XYChart.Series lowSeries = new XYChart.Series();
        lowSeries.setName("Not Achieved");
        XYChart.Series medSeries = new XYChart.Series();
        medSeries.setName("Achieved");
        XYChart.Series hiSeries  = new XYChart.Series();
        hiSeries.setName("Exceeded");
        bc.setBarGap(0);
        bc.setCategoryGap(0);
        for (int i = 0; i < 10; i++) {
          final XYChart.Data<String, Number> data = new XYChart.Data("Value " + i, i);
          if (data.getYValue().intValue() > 8) {
            hiSeries.getData().add(data);
          } else if (data.getYValue().intValue() > 5) {
            medSeries.getData().add(data);
          } else {
            lowSeries.getData().add(data);
        bc.getData().setAll(lowSeries, medSeries, hiSeries);
        bc.getStylesheets().add(getClass().getResource("colored-chart.css").toExternalForm());
        stage.setScene(new Scene(bc));
        stage.show();
      public static void main(String[] args) {
        launch(args);
    import javafx.application.Application;
    import javafx.beans.value.*;
    import javafx.geometry.Pos;
    import javafx.scene.*;
    import javafx.scene.chart.*;
    import javafx.scene.control.Label;
    import javafx.scene.layout.*;
    import javafx.scene.paint.Color;
    import javafx.scene.shape.*;
    import javafx.stage.Stage;
    public class DynamicallyColoredBarChart extends Application {
      @Override public void start(Stage stage) {
        final CategoryAxis xAxis = new CategoryAxis();
        xAxis.setLabel("Bars");
        final NumberAxis yAxis = new NumberAxis();
        yAxis.setLabel("Value");
        final BarChart<String, Number> bc = new BarChart<>(xAxis, yAxis);
        bc.setLegendVisible(false);
        XYChart.Series series1 = new XYChart.Series();
        for (int i = 0; i < 10; i++) {
          // change color of bar if value of i is >5 than red if i>8 than blue
          final XYChart.Data<String, Number> data = new XYChart.Data("Value " + i, i);
          data.nodeProperty().addListener(new ChangeListener<Node>() {
            @Override
            public void changed(ObservableValue<? extends Node> ov, Node oldNode, Node newNode) {
              if (newNode != null) {
                if (data.getYValue().intValue() > 8) {
                  newNode.setStyle("-fx-bar-fill: -fx-exceeded;");
                } else if (data.getYValue().intValue() > 5) {
                  newNode.setStyle("-fx-bar-fill: -fx-achieved;");
                } else {
                  newNode.setStyle("-fx-bar-fill: -fx-not-achieved;");
          series1.getData().add(data);
        bc.getData().add(series1);
        LevelLegend legend = new LevelLegend();
        legend.setAlignment(Pos.CENTER);
        VBox chartWithLegend = new VBox();
        chartWithLegend.getChildren().setAll(bc, legend);
        chartWithLegend.getStylesheets().add(getClass().getResource("colored-chart.css").toExternalForm());
        stage.setScene(new Scene(chartWithLegend));
        stage.show();
      class LevelLegend extends GridPane {
        LevelLegend() {
          setHgap(10);
          setVgap(10);
          addRow(0, createSymbol("-fx-exceeded"),     new Label("Exceeded"));
          addRow(1, createSymbol("-fx-achieved"),     new Label("Achieved"));
          addRow(2, createSymbol("-fx-not-achieved"), new Label("Not Achieved"));
          getStyleClass().add("level-legend");
        private Node createSymbol(String fillStyle) {
          Shape symbol = new Ellipse(10, 5, 10, 5);
          symbol.setStyle("-fx-fill: " + fillStyle);
          symbol.setStroke(Color.BLACK);
          symbol.setStrokeWidth(2);
          return symbol;
      public static void main(String[] args) { launch(args); }
    /** colored-chart.css: place in same directory as other bar chart application files and setup your build system to copy it to the output directory */
    .root {
      -fx-not-achieved: red;
      -fx-achieved:     green;
      -fx-exceeded:     blue;
    .default-color0.chart-bar { -fx-bar-fill: -fx-not-achieved; }
    .default-color1.chart-bar { -fx-bar-fill: -fx-achieved; }
    .default-color2.chart-bar { -fx-bar-fill: -fx-exceeded; }
    .level-legend {
      -fx-padding: 10;
      -fx-border-width: 2;
      -fx-background-color: rgba(211, 211, 211, 0.5);
      -fx-border-color: derive(rgba(211, 211, 211, 0.7), 10%);
    }

  • How to add multiple users on a single phone

    Hello
    I'm having trouble finding documentation on how I might add a second person on a phone. In other words, how do I get multiple extentions to go to different lines on the same phone? I'm using a UC 560.
    Many thanks.

    Hi Monte,
    You can achieve this by assigning a secondary extension to another button, but this might not be what you want, so if you can elaborate a little further as to what you want exactly I can help you with putting together a solution
    Cheers,
    David Trad.
    **When you rate a persons post, you are indicating a thank you or that it helped, but at the same time you are also helping to maintain the community spirit - You don't have to rate posts and you wont be looked down upon :) **

Maybe you are looking for