Package javax.swing

Examples of javax.swing.SpringLayout$SpringProxy


  JTextField manufacturerTxt;
  JTextField modelTxt;
 
  public DetailPanel() {
    setLayout(new BorderLayout());
    JPanel panel = new JPanel(new SpringLayout());
    panel.setBorder(BorderFactory.createTitledBorder("User Details"));
    companyLbl = new JLabel("Company");
    manufacturerLbl = new JLabel("PBX Manufacturer");
    modelLbl = new JLabel("PBX Model");
   
View Full Code Here


   
    tableModel = new AttributeTableModel(parserModel);
    orderTable = new JTable(tableModel);
    JScrollPane scrollpane = new JScrollPane(orderTable);
    orderTable.setPreferredScrollableViewportSize(new Dimension(150,30));
    this.setLayout(new SpringLayout());
    this.add(scrollpane);
    this.add(buttonPanel);
    org.jsmdr.configui.base.SpringUtilities.makeCompactGrid(this,
        1, 2, //rows, cols
        10, 5,        //initX, initY
View Full Code Here

    p.add(manufacturerLabel);p.add(manufacturerCombo);
    p.add(modelLabel);p.add(modelCombo);
    p.add(new JLabel("")); p.add(new JLabel(""));
    p.add(loadConfigBtn);p.add(new JLabel(""));
    p.add(saveConfigBtn);p.add(new JLabel(""));   
    p.setLayout(new SpringLayout());
   
    org.jsmdr.configui.base.SpringUtilities.makeCompactGrid(p,
        5, 2, //rows, cols
        10, 10,        //initX, initY
        15, 10);
View Full Code Here

     */
    public static void makeGrid(Container parent,
                                int rows, int cols,
                                int initialX, int initialY,
                                int xPad, int yPad) {
        SpringLayout layout;
        try {
            layout = (SpringLayout)parent.getLayout();
        } catch (ClassCastException exc) {
            System.err.println("The first argument to makeGrid must use SpringLayout."); //$NON-NLS-1$
            return;
        }

        Spring xPadSpring = Spring.constant(xPad);
        Spring yPadSpring = Spring.constant(yPad);
        Spring initialXSpring = Spring.constant(initialX);
        Spring initialYSpring = Spring.constant(initialY);
        int max = rows * cols;

        //Calculate Springs that are the max of the width/height so that all
        //cells have the same size.
        Spring maxWidthSpring = layout.getConstraints(parent.getComponent(0)).
                                    getWidth();
        Spring maxHeightSpring = layout.getConstraints(parent.getComponent(0)).
                                    getWidth();
        for (int i = 1; i < max; i++) {
            SpringLayout.Constraints cons = layout.getConstraints(
                                            parent.getComponent(i));

            maxWidthSpring = Spring.max(maxWidthSpring, cons.getWidth());
            maxHeightSpring = Spring.max(maxHeightSpring, cons.getHeight());
        }

        //Apply the new width/height Spring. This forces all the
        //components to have the same size.
        for (int i = 0; i < max; i++) {
            SpringLayout.Constraints cons = layout.getConstraints(
                                            parent.getComponent(i));

            cons.setWidth(maxWidthSpring);
            cons.setHeight(maxHeightSpring);
        }

        //Then adjust the x/y constraints of all the cells so that they
        //are aligned in a grid.
        SpringLayout.Constraints lastCons = null;
        SpringLayout.Constraints lastRowCons = null;
        for (int i = 0; i < max; i++) {
            SpringLayout.Constraints cons = layout.getConstraints(
                                                 parent.getComponent(i));
            if (i % cols == 0) { //start of new row
                lastRowCons = lastCons;
                cons.setX(initialXSpring);
            } else { //x position depends on previous component
                cons.setX(Spring.sum(lastCons.getConstraint(SpringLayout.EAST),
                                     xPadSpring));
            }

            if (i / cols == 0) { //first row
                cons.setY(initialYSpring);
            } else { //y position depends on previous row
                cons.setY(Spring.sum(lastRowCons.getConstraint(SpringLayout.SOUTH),
                                     yPadSpring));
            }
            lastCons = cons;
        }

        //Set the parent's size.
        SpringLayout.Constraints pCons = layout.getConstraints(parent);
        pCons.setConstraint(SpringLayout.SOUTH,
                            Spring.sum(
                                Spring.constant(yPad),
                                lastCons.getConstraint(SpringLayout.SOUTH)));
        pCons.setConstraint(SpringLayout.EAST,
View Full Code Here

    /* Used by makeCompactGrid. */
    private static SpringLayout.Constraints getConstraintsForCell(
                                                int row, int col,
                                                Container parent,
                                                int cols) {
        SpringLayout layout = (SpringLayout) parent.getLayout();
        Component c = parent.getComponent(row * cols + col);
        return layout.getConstraints(c);
    }
View Full Code Here

     */
    public static void makeCompactGrid(Container parent,
                                       int rows, int cols,
                                       int initialX, int initialY,
                                       int xPad, int yPad) {
        SpringLayout layout;
        try {
            layout = (SpringLayout)parent.getLayout();
        } catch (ClassCastException exc) {
            System.err.println("The first argument to makeCompactGrid must use SpringLayout."); //$NON-NLS-1$
            return;
        }

        //Align all cells in each column and make them the same width.
        Spring x = Spring.constant(initialX);
        for (int c = 0; c < cols; c++) {
            Spring width = Spring.constant(0);
            for (int r = 0; r < rows; r++) {
                width = Spring.max(width,
                                   getConstraintsForCell(r, c, parent, cols).
                                       getWidth());
            }
            for (int r = 0; r < rows; r++) {
                SpringLayout.Constraints constraints =
                        getConstraintsForCell(r, c, parent, cols);
                constraints.setX(x);
                constraints.setWidth(width);
            }
            x = Spring.sum(x, Spring.sum(width, Spring.constant(xPad)));
        }

        //Align all cells in each row and make them the same height.
        Spring y = Spring.constant(initialY);
        for (int r = 0; r < rows; r++) {
            Spring height = Spring.constant(0);
            for (int c = 0; c < cols; c++) {
                height = Spring.max(height,
                                    getConstraintsForCell(r, c, parent, cols).
                                        getHeight());
            }
            for (int c = 0; c < cols; c++) {
                SpringLayout.Constraints constraints =
                        getConstraintsForCell(r, c, parent, cols);
                constraints.setY(y);
                constraints.setHeight(height);
            }
            y = Spring.sum(y, Spring.sum(height, Spring.constant(yPad)));
        }

        //Set the parent's size.
        SpringLayout.Constraints pCons = layout.getConstraints(parent);
        pCons.setConstraint(SpringLayout.SOUTH, y);
        pCons.setConstraint(SpringLayout.EAST, x);
    }
View Full Code Here

    endColumnSldr = new JSlider(0, MAX_SLIDER_VAL, 0);
    textPane.setContentType("text/html");
    textPane.setPreferredSize(new Dimension(100,40));
   
    JPanel sliderPanel = new JPanel();
    sliderPanel.setLayout(new SpringLayout());
    sliderPanel.add(loadBtnPanel);
    sliderPanel.add(startColumnSldr);
    sliderPanel.add(endColumnSldr);
   
    org.jsmdr.configui.base.SpringUtilities.makeCompactGrid(sliderPanel,
View Full Code Here

    attributesPanel = new AttributesPanel();
    propertiesPanelFixed = new PropertiesPanel(false, parserModel); // resulting properties
    sliderPanel = new SliderPanel();
   
    JPanel midPanel = new JPanel();
    midPanel.setLayout(new SpringLayout());
    midPanel.add(sliderPanel);
    midPanel.add(propertiesPanelFixed);
    org.jsmdr.configui.base.SpringUtilities.makeCompactGrid(midPanel,
        2, 1, //rows, cols
        10, 20,        //initX, initY
View Full Code Here

    propertiesPanelDelimited = new PropertiesPanel(true, parserModel); // resulting properties
    //propertiesPanelDelimited.setTableSize(300,70);
    propertiesPanelDelimited.setPreferredSize(new Dimension(300,160));
    formatPanel = new FormatPanel();
    orderPanel = new AttributeOrderPanel(parserModel);
    delPanel.setLayout(new SpringLayout());
   
    delimiterLbl = new JLabel("Delimiter");
    delimiterFld = new JComboBox(new String[] { "\\s", ",", " " });
    delimiterFld.setPreferredSize(new Dimension(60,20));
   
    JPanel delimiterPanel = new JPanel();
    delimiterPanel.add(delimiterLbl);
    delimiterPanel.add(delimiterFld);
   
    JPanel leftPanel = new JPanel();
    leftPanel.setLayout(new BorderLayout());
    leftPanel.add(delimiterPanel, BorderLayout.NORTH);
    leftPanel.add(formatPanel, BorderLayout.CENTER);
   
    JPanel stringsPanel = new JPanel();
    loadStringsBtn = new JButton("Load Processed Strings");
    JPanel btnPanel = new JPanel();
    btnPanel.add(loadStringsBtn);
    collectedStringsArea = new JTextArea();
    collectedStringsArea.setLineWrap(true);
    collectedStringsArea.setPreferredSize(new Dimension(100,60));
   
    stringsPanel.setLayout(new SpringLayout());
    stringsPanel.add(btnPanel);
    stringsPanel.add(collectedStringsArea);
    stringsPanel.setBorder(BorderFactory.createTitledBorder("Collected Strings"));
   
    org.jsmdr.configui.base.SpringUtilities.makeCompactGrid(stringsPanel,
View Full Code Here

  JButton emailBtn;
 
  public CapturePanel() {
    setLayout(new BorderLayout());
   
    JPanel topLeftPanel = new JPanel(new SpringLayout());
    beginCaptureBtn = ComponentGenerator.getButton("Begin Capture");
    endCaptureBtn = ComponentGenerator.getButton("End Capture");
    clearCaptureBtn = ComponentGenerator.getButton("Clear Capture");
   
    topLeftPanel.add(beginCaptureBtn);
    topLeftPanel.add(endCaptureBtn);
    topLeftPanel.add(clearCaptureBtn);
   
    topLeftPanel.setBorder(BorderFactory.createCompoundBorder(
        BorderFactory.createTitledBorder("Capture"),
        BorderFactory.createEmptyBorder(10,20,10,20)
        ));
    org.jsmdr.configui.base.SpringUtilities.makeCompactGrid(topLeftPanel,
        3, 1, //rows, cols
        5, 0,        //initX, initY
        10, 5);
   
    JPanel topRightPanel = new JPanel(new SpringLayout());
    topRightPanel.setBorder(BorderFactory.createCompoundBorder(
        BorderFactory.createTitledBorder("Select Call Type"),
        BorderFactory.createEmptyBorder(10,20,10,20)
        ));
    callTypeLbl = ComponentGenerator.getLabel("Call Type");
View Full Code Here

TOP

Related Classes of javax.swing.SpringLayout$SpringProxy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.