Adding components using GridBagLayout?

I am adding different components to a JPanel using GridBagLayout as my layout manager. After the JPanel is displayed I need to add additional components to the JPanel. After the components are added I call validate() to update the JPanel. However, after the new components are added, it seems like it changes the constraints in the previous components because they are not displayed correctly. I was wondering why this occurs after I call validate().
Thanks,
Michael

Remember GBL uses components to calculate column widths/heights, etc. So if you are added wider or taller components after the container is shown and re validating the GBL will take new components into account and you'll see some changes.
This is just a swag but you might try adding the components and calling setVisible to show or hide them -- no guarantees, but it might be worth a try.
Cheers
DB

Similar Messages

  • Facing problem while adding combobox using gridbaglayout

    HI, I have used gridbaglayout in my panel. after adding the gridbaglayout, if i select long value combobox does't display all the value of the selected value. Why?
    This is my code
    cboPrioritySearchValue = new JComboBox();
    cboPrioritySearchValue.setBackground(Color.white);
    cboPrioritySearchValue.addItem("ALL");
    cboPrioritySearchValue.addItem(Priority.NOT.getValue());
    cboPrioritySearchValue.addItem(Priority.ONE.getValue());
    cboPrioritySearchValue.addItem(Priority.TWO.getValue());
    cboPrioritySearchValue.addItem(Priority.THREE.getValue());
    cboPrioritySearchValue.addItem(Priority.FOUR.getValue());
    setConstraints(gbc,gbc.WEST,gbc.NONE,2,1,2,8,new Insets(2,5,5,5),0,0,0,0);
    gbl.setConstraints(cboPrioritySearchValue,gbc);
    panel.add(cboPrioritySearchValue);This is my setConstraints method,
    public GridBagConstraints setConstraints(GridBagConstraints gbc, int anchor,int fill,
                                                 int gridw, int gridh, int gridx, int gridy,
                                                 Insets insets, int ipadx, int ipady,
                                                 int weightx, int weighty)
            gbc.anchor     = anchor;
            gbc.fill       = fill;
            gbc.gridwidth  = gridw;
            gbc.gridheight = gridh;
            gbc.gridx      = gridx;
            gbc.gridy      = gridy;
            gbc.insets     = insets;
            gbc.ipadx      = ipadx;
            gbc.ipady      = ipady;
            gbc.weightx    = weightx;
            gbc.weighty    = weighty;
            return gbc;
        }Edited by: JavaHeroPrince on May 13, 2010 6:58 AM

    Thanks Pete, hopefully its only a temporary problem.Short answer: It is (well ... hopefully).
    Long answer: My server's dying regularly because all the connections fill up in CLOSE_WAIT states. This doesn't seem to have the same root cause as the reported bugs that I can find (issues with older JDKs) so I'm interested in investigating it beyond just upgrading everything to the latest and crossing my fingers. Unfortunately that will take time and I'm a bit pressed for spare time at the moment - so: my apologies; the domain is likely to be down until after the weekend at least.
    After the weekend I'll re-target sscce.org (and .com and .net which I acquired a little while back) to a different server that's not suffering from the problem. Or if Andrew prefers I'll target a server under his control.

  • How to get a border around several components in GridBagLayout

    I have several buttons in a 16 x 12 matrix using GridBagLayout manager
    Now I want to have a border around buttons 1/1 to 6/6 and another border around 1/7 to 8/6
    and another border around 1/9 to 16/6. How can I do this ?

    I usually create JPanels for each group, with their own LayoutManager. Adding a [ border to a JPanel is fairly staight forward|http://java.sun.com/docs/books/tutorial/uiswing/components/border.html] . To put thing together, I add instances of those JPanels to a top level JPanel in some frame or window.

  • Not able to display all the componets using GridBagLayout manager

    Hii Javaites
    I m using GridBagLayout manager to display my components.
    But there is some problem.
    I am not able to view the last element of my second Row.
    Can anybody tell me what is wrong.
    This is driving me crazy.
    // code...................................................
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    pane.setLayout(gridbag)
    c.weightx = c.weighty = 1;
    c.insets = new Insets(5, 5, 5, 5); // 5-pixel margins on all sides
    // First Row
    date_IconLabel= new JLabel("Date")
    c.gridx = 0;
    c.gridy = 0;
    pane.add(date_IconLabel,c);
    textField1= new JTextField(("Text 1");
    c.gridx = 1;
    c.gridy = 0;
    pane.add(textField1 ,c);
    textField2 = new JTextField("Text 2");
    c.gridx = 2;
    c.gridy = 0;
    c.gridwidth=GridBagConstraints.REMAINDER;
    pane.add(textField2 ,c);
    //2nd Row
    date_IconLabel= new JLabel("Date");
    c.gridx = 0;
    c.gridy = 1;
    pane.add(date_IconLabel,c);
    textField3 = new JTextField("Text 3");
    c.gridx = 1;
    c.gridy = 1;
    pane.add(textField3 ,c);
    textField4 = new JTextField("Text 4");
    c.gridx = 2;
    c.gridy = 1;
    pane.add(textField4,c);
    Message was edited by:
    help_eachother

    Hello,
    I create a new Constraint object for every component.
    It might look like nonsense but it is clearer what
    you are really specifying in every component
    constraints.
    I find it otherwise difficult to follow all the
    changes done to the constraint through all the
    components. Reuse is a great thing but in this case
    is confusing.That's why I created a simple subclass of GridBagConstaints with a reset() method and a few other goodies:
    ==================
    import java.awt.GridBagConstraints;
    import java.awt.Insets;
    public class GBC extends GridBagConstraints {
         public GBC() {
              super();
         public GBC(
              int gridx,
              int gridy,
              int gridwidth,
              int gridheight,
              double weightx,
              double weighty,
              int anchor,
              int fill,
              Insets insets,
              int ipadx,
              int ipady) {
              super(
                   gridx,
                   gridy,
                   gridwidth,
                   gridheight,
                   weightx,
                   weighty,
                   anchor,
                   fill,
                   insets,
                   ipadx,
                   ipady);
        public void reset() {
            gridx = RELATIVE;
            gridy = RELATIVE;
            gridwidth = 1;
            gridheight = 1;
            weightx = 0;
            weighty = 0;
            anchor = CENTER;
            fill = NONE;
            insets = new Insets(0, 0, 0, 0);
            ipadx = 0;
            ipady = 0;
        public String toString() {
            final String SEP = System.getProperty("line.separator");
            return "GridBagConstraints" + SEP +
                   "\tgridx = "         + getGridXString()      + SEP +
                   "\tgridy = "         + getGridYString()      + SEP +
                   "\tgridwidth = "     + getGridWidthString()  + SEP +
                   "\tgridheight = "    + getGridHeightString() + SEP +
                   "\tweightx = "       + weightx               + SEP +
                   "\tweighty = "       + weighty               + SEP +
                   "\tanchor = "        + getAnchorString()     + SEP +
                   "\tfill = "          + getFillString()       + SEP +
                   "\tinsets = "        + insets                + SEP +
                   "\tipadx = "         + ipadx                 + SEP +
                   "\tipady = "         + ipady;
        private final String getGridXString() {
            String s = null;
            switch (gridx) {
                case RELATIVE:
                    s = "RELATIVE";
                    break;
                default:
                    s = String.valueOf(gridx);
            return s;
        private final String getGridYString() {
            String s = null;
            switch (gridy) {
                case RELATIVE:
                    s = "RELATIVE";
                    break;
                default:
                    s = String.valueOf(gridy);
            return s;
        private final String getAnchorString() {
            String s = null;
            switch (anchor) {
                //Absolute values
                case CENTER:
                    s = "CENTER";
                    break;
                case NORTH:
                    s = "NORTH";
                    break;
                case NORTHEAST:
                    s = "NORTHEAST";
                    break;
                case EAST:
                    s = "EAST";
                    break;
                case SOUTHEAST:
                    s = "SOUTHEAST";
                    break;
                case SOUTH:
                    s = "SOUTH";
                    break;
                case SOUTHWEST:
                    s = "SOUTHWEST";
                    break;
                case WEST:
                    s = "WEST";
                    break;
                case NORTHWEST:
                    s = "NORTHWEST";
                    break;
                //realtive values
                case PAGE_START:
                    s = "PAGE_START";
                    break;
                case PAGE_END:
                    s = "PAGE_END";
                    break;
                case LINE_START:
                    s = "LINE_START";
                    break;
                case LINE_END:
                    s = "LINE_END";
                    break;
                case FIRST_LINE_START:
                    s = "FIRST_LINE_START";
                    break;
                case FIRST_LINE_END:
                    s = "FIRST_LINE_END";
                    break;
                case LAST_LINE_START:
                    s = "LAST_LINE_START";
                    break;
                case LAST_LINE_END:
                    s = "LAST_LINE_END";
                    break;
            return s;
        private final String getFillString() {
            String s = null;
            switch (fill) {
                case NONE:
                    s = "NONE";
                    break;
                case HORIZONTAL:
                    s = "HORIZONTAL";
                    break;
                case VERTICAL:
                    s = "VERTICAL";
                    break;
                case BOTH:
                    s = "BOTH";
                    break;
            return s;
        private final String getGridWidthString() {
            String s = null;
            switch (gridwidth) {
                case RELATIVE:
                    s = "REALTIVE";
                    break;
                case REMAINDER:
                    s = "REMAINDER";
                    break;
                default:
                    s = String.valueOf(gridwidth);
                    break;
            return s;
        private final String getGridHeightString() {
            String s = null;
            switch (gridheight) {
                case RELATIVE:
                    s = "REALTIVE";
                    break;
                case REMAINDER:
                    s = "REMAINDER";
                    break;
                default:
                    s = String.valueOf(gridheight);
                    break;
            return s;
    }

  • How to avoid extra div tags, when we add components using cq:include

    I tried using the below code in my component jsp from forums to remove those extra div tags when we try to add components using <cq:include tags.
    <%
       if (WCMMode.fromRequest(request) != WCMMode.EDIT && WCMMode.fromRequest(request) != WCMMode.DESIGN) {
           IncludeOptions.getOptions(request, true).forceSameContext(Boolean.TRUE);
    %>
    But this code helped to remove most of the extra div tags , but still adds this extra div tag to the first component I add using  <cq:include tag.
    its a basic and very critical necessity to maintain our markup design,But due to this  dynamically added extra div tag will hinder the html and css behaviour of the page.
    Appreciate your help to resolve this issue.
    Thanks

    Hi,
    Can you try below if you really dont want to include anything during include.
    <%
    IncludeOptions opts=null;
       if (WCMMode.fromRequest(request) != WCMMode.EDIT && WCMMode.fromRequest(request) != WCMMode.DESIGN) {
    opts= IncludeOptions.getOptions(request, true);     
    opts.forceSameContext(Boolean.TRUE);
    opts.setDecorationTagName("");
    %>
    Thanks,
    Pawan

  • The component  couldn't get smaller  using gridbaglayout

    There is a vertical jsplitpane ,the upper part contains button,jtable,combox using gridbaglayout,I have set the GridBagConstraints.weightx,weighty to 1. The problem is when I drag divider to change upper size,it couldn't get smaller, even if I set all of the upper components' minimumsize to a tiny value.
    here is the code, I wrote it in windowsbuilder (a kind of eclipse swing plugin), I guess you can see it using ve too.
    package frame;
    import java.awt.BorderLayout;
    import java.awt.EventQueue;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.border.EmptyBorder;
    import java.awt.Rectangle;
    import javax.swing.JSplitPane;
    import javax.swing.JList;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.JTextArea;
    import javax.swing.JLabel;
    import javax.swing.UIManager;
    import javax.swing.UnsupportedLookAndFeelException;
    import java.awt.Color;
    import javax.swing.JComboBox;
    import javax.swing.JButton;
    import java.awt.GridBagLayout;
    import java.awt.GridBagConstraints;
    import java.awt.Insets;
    public class FrmMain extends JFrame {
         private JPanel contentPane;
         private JTable table;
          * Launch the application.
         public static void main(String[] args) {
              createWin();
          * Create the frame.
         public FrmMain() {
              setTitle("Notebook");
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              setBounds(100, 100, 573, 465);
              setBounds(new Rectangle(0, 0, 980, 738));
              contentPane = new JPanel();
              contentPane.setBounds(new Rectangle(0, 0, 980, 0));
              contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
              contentPane.setLayout(new BorderLayout(0, 0));
              setContentPane(contentPane);
              JSplitPane splAll = new JSplitPane();
              splAll.setDividerSize(10);
              splAll.setOneTouchExpandable(true);
              contentPane.add(splAll, BorderLayout.CENTER);
              JSplitPane splRight = new JSplitPane();
              splRight.setContinuousLayout(true);
              splRight.setDividerSize(10);
              splRight.setOneTouchExpandable(true);
              splRight.setOrientation(JSplitPane.VERTICAL_SPLIT);
              splAll.setRightComponent(splRight);
              JPanel pnlRightUp = new JPanel();
              splRight.setLeftComponent(pnlRightUp);
              GridBagLayout gbl_pnlRightUp = new GridBagLayout();
              gbl_pnlRightUp.columnWidths = new int[]{36, 54, 227, 88, 88, 211, 0};
              gbl_pnlRightUp.rowHeights = new int[]{23, 363, 0};
              gbl_pnlRightUp.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
              gbl_pnlRightUp.rowWeights = new double[]{0.0, 0.0, Double.MIN_VALUE};
              pnlRightUp.setLayout(gbl_pnlRightUp);
              JLabel label = new JLabel("\u5F53\u524D\u6709");
              GridBagConstraints gbc_label = new GridBagConstraints();
              gbc_label.anchor = GridBagConstraints.WEST;
              gbc_label.insets = new Insets(0, 0, 5, 5);
              gbc_label.gridx = 0;
              gbc_label.gridy = 0;
              pnlRightUp.add(label, gbc_label);
              JLabel lblCount = new JLabel("New label");
              lblCount.setForeground(Color.BLUE);
              GridBagConstraints gbc_lblCount = new GridBagConstraints();
              gbc_lblCount.anchor = GridBagConstraints.WEST;
              gbc_lblCount.insets = new Insets(0, 0, 5, 5);
              gbc_lblCount.gridx = 1;
              gbc_lblCount.gridy = 0;
              pnlRightUp.add(lblCount, gbc_lblCount);
              JComboBox tfKey = new JComboBox();
              GridBagConstraints gbc_tfKey = new GridBagConstraints();
              gbc_tfKey.fill = GridBagConstraints.HORIZONTAL;
              gbc_tfKey.insets = new Insets(0, 0, 5, 5);
              gbc_tfKey.gridx = 2;
              gbc_tfKey.gridy = 0;
              pnlRightUp.add(tfKey, gbc_tfKey);
              JLabel label_1 = new JLabel("\u6761");
              GridBagConstraints gbc_label_1 = new GridBagConstraints();
              gbc_label_1.anchor = GridBagConstraints.WEST;
              gbc_label_1.insets = new Insets(0, 0, 5, 5);
              gbc_label_1.gridx = 2;
              gbc_label_1.gridy = 0;
              pnlRightUp.add(label_1, gbc_label_1);
              JButton btnSearch = new JButton("\u641C\u7D22");
              GridBagConstraints gbc_btnSearch = new GridBagConstraints();
              gbc_btnSearch.anchor = GridBagConstraints.NORTH;
              gbc_btnSearch.fill = GridBagConstraints.HORIZONTAL;
              gbc_btnSearch.insets = new Insets(0, 0, 5, 5);
              gbc_btnSearch.gridx = 3;
              gbc_btnSearch.gridy = 0;
              pnlRightUp.add(btnSearch, gbc_btnSearch);
              JButton btnType = new JButton("\u7C7B\u522B\u7EF4\u62A4");
              GridBagConstraints gbc_btnType = new GridBagConstraints();
              gbc_btnType.anchor = GridBagConstraints.NORTH;
              gbc_btnType.fill = GridBagConstraints.HORIZONTAL;
              gbc_btnType.insets = new Insets(0, 0, 5, 5);
              gbc_btnType.gridx = 4;
              gbc_btnType.gridy = 0;
              pnlRightUp.add(btnType, gbc_btnType);
              JButton button_2 = new JButton("\u91CD\u65B0\u6253\u5F00\u7A97\u53E3");
              GridBagConstraints gbc_button_2 = new GridBagConstraints();
              gbc_button_2.anchor = GridBagConstraints.NORTHWEST;
              gbc_button_2.insets = new Insets(0, 0, 5, 0);
              gbc_button_2.gridx = 5;
              gbc_button_2.gridy = 0;
              pnlRightUp.add(button_2, gbc_button_2);
              JScrollPane spData = new JScrollPane();
              GridBagConstraints gbc_spData = new GridBagConstraints();
              gbc_spData.fill = GridBagConstraints.BOTH;
              gbc_spData.gridwidth = 6;
              gbc_spData.gridx = 0;
              gbc_spData.gridy = 1;
              gbc_spData.weightx=1;
              gbc_spData.weighty=1;
              pnlRightUp.add(spData, gbc_spData);
              table = new JTable();
              spData.setViewportView(table);
              JScrollPane scrollPane = new JScrollPane();
              splRight.setRightComponent(scrollPane);
              JTextArea taContent = new JTextArea();
              scrollPane.setViewportView(taContent);
              splRight.setDividerLocation(400);
              JScrollPane scrollPane_1 = new JScrollPane();
              splAll.setLeftComponent(scrollPane_1);
              JList lstType = new JList();
              scrollPane_1.setViewportView(lstType);
              splAll.setDividerLocation(180);
         public static void  createWin(){
              EventQueue.invokeLater(new Runnable() {
                   public void run() {
                        try {
                             try {
                               UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
                           } catch (ClassNotFoundException e) {
                               e.printStackTrace();
                           } catch (InstantiationException e) {
                               e.printStackTrace();
                           } catch (IllegalAccessException e) {
                               e.printStackTrace();
                           } catch (UnsupportedLookAndFeelException e) {
                               e.printStackTrace();
                             FrmMain frame = new FrmMain();
                             frame.setVisible(true);
                        } catch (Exception e) {
                             e.printStackTrace();
    }thanks.

    I found the reason. the code below defines the jtable height as 363 pixels,so the divider couldn't make the upper part less than 363 pixels. I don't know why divider cound't but draging win could. Gridbaglayout is so complex.
    gbl_pnlRightUp.rowHeights = new int[]{23, 363, 0};if I use BorderLayout and put jtable into center in the upper part of splitpane, everything is ok. But if I had to use gridbaglayout,what was I gonna do?

  • How to use GridBagLayout in JlayeredPane.

    I am using JLayered Pane for Dynamically putting the components at Front and at Back, But Now i want to put the components in a specified grid and for that i think i hav to use GridBagLayout... so Plz tell me how can i implement it.

    But Now i want to put the components in a specified grid I would use the [url http://java.sun.com/docs/books/tutorial/uiswing/layout/visual.html]Grid Layout.

  • Error while adding a used relationship between the New DC and the Web DC

    Hi Gurus
    We are getting the Error in NWDS while Adding  a used relationship between the New DC and the Web DC.
    Steps what we are Done
    1. Create the custom project from inactiveDC's
    2.creating the project for the component crm/b2b in SHRAPP_1
    3.After that we changed the application.xml and given the contect path.
    4.Then we tried to add Dependency to the custom create DC we are getting the error saying that illegal deppendency : the compartment sap.com_CUSTCRMPRJ_1 of DC sap.com/home/b2b_xyz(sap.com.CUSTCRMPRJ_1) must explicitly use compartment sap.com_SAP-SHRWEB_1 of DC sap.com/crm/isa/ like that it was throwing the error.
    so, we skip this step and tried to create the build then it is saying that build is failed..
    Please help us in this regard.
    Awaiting for ur quick response...
    Regards
    Satish

    Hi
    Please Ignore my above message.
    Thanks for ur Response.
    After ur valuble inputs we have added the required dependencies and sucessfully created the projects, then building of the  projects was also sucessfully done and  EAR file was created.
    We need to deploy this EAR file in CRM Application Server by using the interface NWDI.
    For Deploying the EAR into NWDI, we need to check-in the activites what i have created for EAR. once i check-in the activites ,the NWDI will deploy the EAR into CRM Application Server.
    In the Activity Log we are able to check the Activities as Suceeded but the Deployment column is not showing any status.
    When i  right click on my activity Id the deployment summery is also disabled.
    So finally my Question is that where can i get the deployment log file, and where can i check the deployment status for my application..
    Any pointers in this regard would be of great help..
    Awaiting for ur valuble Responses..
    Regards
    Satish

  • How can I display JTextFields correctly on a JPanel using GridBagLayout?

    I had some inputfields on a JPanel using the boxLayout. All was ok. Then I decided to change the panellayout to GridBagLayout. The JLabel fields are displayed correctly but the JTextField aren't. They are at the JPanel but have a size of 0??? So we cannot see what we type in these fields... Even when I put some text in the field before putting it on the panel.
    How can I display JTextFields correctly on a JPanel using GridBagLayout?
    here is a shortcut of my code:
    private Dimension sFieldSize10 = new Dimension(80, 20);
    // Create and instantiate Selection Fields
    private JLabel lSearchAbrText = new JLabel();
    private JTextField searchAbrText = new JTextField();
    // Set properties for SelectionFields
    lSearchAbrNumber.setText("ABR Number (0-9999999):");
    searchAbrNumber.setText("");
    searchAbrNumber.createToolTip();
    searchAbrNumber.setToolTipText("enter the AbrNumber.");
    searchAbrNumber.setPreferredSize(sFieldSize10);
    searchAbrNumber.setMaximumSize(sFieldSize10);
    public void createViewSubsetPanel() {
    pSubset = new JPanel();
    // Set layout
    pSubset.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    // Add Fields
    gbc.gridy = 0;
    gbc.gridx = GridBagConstraints.RELATIVE;
    pSubset.add(lSearchAbrNumber, gbc);
    // also tried inserting this statement
    // searchAbrNumber.setText("0000000");
    // without success
    pSubset.add(searchAbrNumber,gbc);
    pSubset.add(lSearchAbrText, gbc);
    pSubset.add(searchAbrText, gbc);
    gbc.gridy = 1;
    pSubset.add(lSearchClassCode, gbc);
    pSubset.add(searchClassCode, gbc);
    pSubset.add(butSearch, gbc);
    }

    import java.awt.*;
    import java.awt.event.*;
    import javax .swing.*;
    public class GridBagDemo {
      public static void main(String[] args) {
        JLabel
          labelOne   = new JLabel("Label One"),
          labelTwo   = new JLabel("Label Two"),
          labelThree = new JLabel("Label Three"),
          labelFour  = new JLabel("Label Four");
        JLabel[] labels = {
          labelOne, labelTwo, labelThree, labelFour
        JTextField
          tfOne   = new JTextField(),
          tfTwo   = new JTextField(),
          tfThree = new JTextField(),
          tfFour  = new JTextField();
        JTextField[] fields = {
          tfOne, tfTwo, tfThree, tfFour
        Dimension
          labelSize = new Dimension(125,20),
          fieldSize = new Dimension(150,20);
        for(int i = 0; i < labels.length; i++) {
          labels.setPreferredSize(labelSize);
    labels[i].setHorizontalAlignment(JLabel.RIGHT);
    fields[i].setPreferredSize(fieldSize);
    GridBagLayout gridbag = new GridBagLayout();
    JPanel panel = new JPanel(gridbag);
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.weightx = 1.0;
    gbc.weighty = 1.0;
    gbc.insets = new Insets(5,5,5,5);
    panel.add(labelOne, gbc);
    panel.add(tfOne, gbc);
    gbc.gridwidth = gbc.RELATIVE;
    panel.add(labelTwo, gbc);
    gbc.gridwidth = gbc.REMAINDER;
    panel.add(tfTwo, gbc);
    gbc.gridwidth = 1;
    panel.add(labelThree, gbc);
    panel.add(tfThree, gbc);
    gbc.gridwidth = gbc.RELATIVE;
    panel.add(labelFour, gbc);
    gbc.gridwidth = gbc.REMAINDER;
    panel.add(tfFour, gbc);
    final JButton
    smallerButton = new JButton("smaller"),
    biggerButton = new JButton("wider");
    final JFrame f = new JFrame();
    ActionListener l = new ActionListener() {
    final int DELTA_X = 25;
    int oldWidth, newWidth;
    public void actionPerformed(ActionEvent e) {
    JButton button = (JButton)e.getSource();
    oldWidth = f.getSize().width;
    if(button == smallerButton)
    newWidth = oldWidth - DELTA_X;
    if(button == biggerButton)
    newWidth = oldWidth + DELTA_X;
    f.setSize(new Dimension(newWidth, f.getSize().height));
    f.validate();
    smallerButton.addActionListener(l);
    biggerButton.addActionListener(l);
    JPanel southPanel = new JPanel(gridbag);
    gbc.gridwidth = gbc.RELATIVE;
    southPanel.add(smallerButton, gbc);
    gbc.gridwidth = gbc.REMAINDER;
    southPanel.add(biggerButton, gbc);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(panel);
    f.getContentPane().add(southPanel, "South");
    f.pack();
    f.setLocation(200,200);
    f.setVisible(true);

  • What are the UI components used in oracle adf?

    what are the UI components used in oracle adf?

    Web.:
    - ADF Faces and Trinidad JSF components
    http://docs.oracle.com/cd/E28280_01/apirefs.1111/e12419/toc.htm
    Desktop:
    - MS Excel
    http://www.oracle.com/technetwork/developer-tools/adf/overview/index-085534.html
    Mobile
    - AMX UI Components for Android and iOS
    Frank

  • [svn:cairngorm3:] 15920: Adding the use of Spark component into ModuleC to add the scenario where a Module must be able to get its default spark skin  (currently this is failing due to a bug in the Module Lib)

    Revision: 15920
    Revision: 15920
    Author:   [email protected]
    Date:     2010-05-06 02:11:21 -0700 (Thu, 06 May 2010)
    Log Message:
    Adding the use of Spark component into ModuleC to add the scenario where a Module must be able to get its default spark skin (currently this is failing due to a bug in the Module Lib)
    Modified Paths:
        cairngorm3/trunk/libraries/ModuleTest/src/example/moduleC/ModuleC.mxml

    As the server.xml is big enough, I took the minimum portion of it. Hope u can proceed with it.
    <!-- Tomcat Root Context -->
    <Context path="" docBase="ROOT" debug="0"/>
    <!-- New contexts -->
    <Context path="/xyz" docBase="pathTo_xyz" debug="0" crossContext="true"/>
    <Context path="/pqr" docBase="pathTo_pqr" debug="0" crossContext="true"/>
    <!-- Tomcat Examples Context -->
    <Context path="/examples" docBase="examples" debug="0"
    reloadable="true" crossContext="true">
    You should also provide a WEB-INF folder under pqr or xyz folder.
    You should also provide a web.xml file under each WEB-INF folder.
    The minimal web.xml is
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/j2ee/dtd/web-app_2_3.dtd">
    <web-app>
    </web-app>
    That's it. Try it out. Hope it is OK.
    Hafizur Rahman
    SCJP

  • Errors Installing Portal Components using 9iAS Enterprise on 8.1.7 SE

    We are getting an error installing the Portal Components using
    9iAS Enterprise on a 8.1.7 SE database. The log indicates that
    the error is:
    ORA-00439: feature not enabled: Function-based indexes
    Errors encountered in the Install process. Installation Aborted.
    While I know that Function-based indexes are not supported in SE
    this should not prevent the installation of Portal.
    Does anyone have any suggestions?
    Thx, Paul

    Its also working in our case where we have used 8.1.7 Enterprise Edition. We installed 9iAS 1.0.2.0 on NT. So if you have any issues regarding this then let me know.

  • Can we use GridBagLayout in JInternal Frame

    i've a question that can we use gridbaglayout in JInternalFrame?

    Yes:
    internalFrame.getContentPane().setLayout(new GridBagLayout());
    // Add children to be laid out to internalFrame,getContentPane()
    //or if you prefer:
    JPanel p = new JPanel(new GridBagLayout());
    internaleFrame.getContentPane().add(p);
    // Add children to be laid out to 'p'
    //

  • How to Specify Metadata When Adding Content Using iTunes U Web Service?

    I've been developing Java applications using iTunes U Web service and uploaded content to iTunes U site using iTunes U Web service without problem. Now I want to add metadata fields (name, artist name, album name, etc.) for the tracks I uploaded. It seems to me that "AddTrack" will do. So I tested it but it neither adds a track under the specified group nor updates metadata fields for an existing track. It turned out "MergeTrack" actually updates metadata fields for an existing track. So is there any way to specify metadata at the time of adding content using iTunes U Web service? And what exactly does AddTrack do? This is all about contents hosted by iTunes U site and no RSS is involved.
    I'm referring to the "AddTrack" method in iTunes U Web service:
    http://deimos.apple.com/rsrc/doc/iTunesUAdministrationGuide/iTunesUWebServices/c hapter18_section_21.html#//appleref/doc/uid/AdminGuide-CH13-SW26

    Thanks for all the replies. My question is whether there is any way to specify metadata WHEN adding content using iTunes U Web service. Specifying metadata AFTER adding content can be achieved by MergeTrack (weird naming) and it does work.
    As for setting track level meta-data in the media file and then upload it, there're several reasons against that, among which are:
    1. Some track metadata are context-dependent. A video about buildings on Michigan Ave in Chicago can be track #2 in a history course and described as "historic view of the Magnificent Mile", but the same media can also be track #5 in a landscape design course and described as something like "contemporary architecture". Setting these metadata in the media file itself is not the preferred way to do it since it implies maintaining a version of the same media for any course/group it gets uploaded to.
    2. Setting metadata in a location separate from the media file helps track the metadata change and search for media without digging into the media itself.
    3. If MergeTrack "updates" metadata, there got to be some other method that "creates" metadata - that's what a well-designed API should look like. And setting metadata in the media file is not an equivalent to a "create metadata" method call. In rickwolf's term, that implicit AddTrack should actually be made explicit so the party uploading content can explicitly specify metadata instead of having iTunes U extract metadata from the media.
    It is still not clear what "AddTrack" does exactly, maybe rickwolf is right - it's only relevant to tracks created through RSS.
    So it seems to me there is no other way to specify metadata WHEN adding content using iTunes U Web service than setting metadata in the media file. To me it is more like a design flaw.
    Message was edited by: Stone Xiang
    Message was edited by: Stone Xiang
    Message was edited by: Stone Xiang

  • The recent upgrade for i-tunes prevents me from adding and using the Field, "Show". How can I add this field in i-tunes?

    The recent upgrade for i-tunes prevents me from adding and using the Field, "Show". How can I add this field in i-tunes?

    Hold down shift as you right-click > Get Info to get the old style dialog box.
    tt2

Maybe you are looking for