Examples of RelativeConstraints


Examples of edu.cmu.relativelayout.RelativeConstraints

      public void mouseClicked(MouseEvent e) {
      }
    });

    Binding leftOfUserList = bf.leftOf(userList);
    paintCanvasConstraints = new RelativeConstraints(leftEdge,
        leftOfUserList, topEdge, aboveInputField);

    // User List
    userList.setBackground(new Color(102, 255, 153));
    userList.setPreferredSize(new Dimension(200, userList.getHeight()));
    users.setEditable(false);
    Binding rightEdge = bf.rightEdge();
    userListConstraints = new RelativeConstraints(topEdge, rightEdge,
        aboveInputField);

    // Input Field
    inputField.setEnabled(true);
    inputField.setVisible(true);
    inputField.setPreferredSize(new Dimension(700, 30));
    Binding bottomEdge = bf.bottomEdge();
    Binding leftOfSendButton = bf.leftOf(sendButton);
    Binding aboveChatPane = bf.above(chatPane);
    inputFieldConstraints = new RelativeConstraints(leftEdge,
        aboveChatPane, leftOfSendButton);

    // Send Button
    sendButton.setEnabled(true);
    sendButton.addActionListener(this);
    sendButton.setPreferredSize(new Dimension(150, 30));
    Binding ver = bf.verticallyCenterAlignedWith(inputField);
    sendButtonConstrains = new RelativeConstraints(rightEdge, ver);
    chatPane.setBackground(new Color(255, 255, 153));
    chatPane.setPreferredSize(new Dimension(1000, 100));
    chatPaneConstraints = new RelativeConstraints(leftEdge, bottomEdge,
        rightEdge);

  }
View Full Code Here

Examples of edu.cmu.relativelayout.RelativeConstraints

    // RelativePosition.Direction.RIGHT, RelativePosition.Edge.RIGHT);
    // RelativePosition twelvePixelsFromRight = new
    // RelativePosition(RelativePosition.Edge.RIGHT, 12,
    // RelativePosition.Direction.LEFT, RelativePosition.Edge.RIGHT);

    RelativeConstraints cornerConstraint = new RelativeConstraints();
    cornerConstraint.addBinding(twelvePixelsFromLeft);
    cornerConstraint.addBinding(twelvePixelsFromTop);

    RelativeConstraints buttonConstraint = new RelativeConstraints();
    buttonConstraint.addBinding(verticallyCentered);
    // buttonConstraint.addRelation(twelvePixelsToTheRightOf, corner);
    // buttonConstraint.addRelation(twelvePixelsFromRight, RelativePosition.PARENT_CONTAINER);
    buttonConstraint.addBinding(horizontallyCenteredWithOffset);

    frame.getContentPane().add(corner, cornerConstraint);
    frame.getContentPane().add(button, buttonConstraint);

    frame.setSize(300, 150);
View Full Code Here

Examples of edu.cmu.relativelayout.RelativeConstraints

    Binding twelveToTheLeftOf = new Binding(Edge.RIGHT, 12, Direction.LEFT, Edge.LEFT, okButton);

    Binding twelveAbove = new Binding(Edge.BOTTOM, 12, Direction.ABOVE, Edge.TOP, okButton);
    Binding twelveBelow = new Binding(Edge.TOP, 12, Direction.BELOW, Edge.BOTTOM, label);

    RelativeConstraints labelConstraint = new RelativeConstraints();
    labelConstraint.addBindings(leftMarginTwelve, topMarginTwelve);

    RelativeConstraints okButtonConstraint = new RelativeConstraints();
    okButtonConstraint.addBinding(bottomMarginTwelve);
    okButtonConstraint.addBinding(rightMarginTwelve);

    RelativeConstraints cancelButtonConstraint = new RelativeConstraints();
    cancelButtonConstraint.addBindings(twelveToTheLeftOf, bottomMarginTwelve);

    RelativeConstraints areaConstraint = new RelativeConstraints();
    areaConstraint.addBindings(twelveAbove, twelveBelow, leftMarginTwelve, rightMarginTwelve);

    frame.add(label, labelConstraint);
    frame.add(area, areaConstraint);
    frame.add(okButton, okButtonConstraint);
    frame.add(cancelButton, cancelButtonConstraint);
View Full Code Here

Examples of edu.cmu.relativelayout.RelativeConstraints

    System.out.println("Sane relation valid: " + tenToTheRight.isValid());
    System.out.println("RelativePosition 1 valid: " + wtf.isValid());
    System.out.println("RelativePosition 2 valid: " + moreWtf.isValid());
    System.out.println("RelativePosition 3 valid: " + stillMoreWtf.isValid());

    RelativeConstraints c1 = new RelativeConstraints();
    c1.addBinding(wtf);

    RelativeConstraints c2 = new RelativeConstraints();
    c2.addBinding(moreWtf);

    RelativeConstraints c3 = new RelativeConstraints();
    c3.addBinding(stillMoreWtf);

    c3.addBinding(new Binding(tenToTheRight, two));
    c2.addBinding(new Binding(tenToTheRight, one));

    frame.add(one, c1);
    frame.add(two, c2);
    frame.add(three, c3);
View Full Code Here

Examples of edu.cmu.relativelayout.RelativeConstraints

    JButton one = new JButton("One");
    JButton two = new JButton("Two");
    JButton three = new JButton("Three");

    RelativeConstraints oneConstraints =
        new RelativeConstraints(new Binding(Edge.LEFT, 12, Direction.RIGHT, Edge.LEFT, frame),
                                new Binding(Edge.TOP, 12, Direction.BELOW, Edge.TOP, frame));
    RelativeConstraints twoConstraints =
        new RelativeConstraints(new Binding(Edge.LEFT, 12, Direction.RIGHT, Edge.RIGHT, one),
                                new Binding(Edge.TOP, 12, Direction.BELOW, Edge.TOP, frame));
    RelativeConstraints threeConstraints =
        new RelativeConstraints(new Binding(Edge.LEFT, 12, Direction.RIGHT, Edge.RIGHT, two),
                                new Binding(Edge.TOP, 12, Direction.BELOW, Edge.TOP, frame));

    frame.add(one, oneConstraints);
    frame.add(two, twoConstraints);
    frame.add(three, threeConstraints);
View Full Code Here

Examples of edu.cmu.relativelayout.RelativeConstraints

    JButton four = new JButton("Four");
    JButton five = new JButton("Five");

    final int WINDOW_PADDING = 12;

    frame.add(one, new RelativeConstraints(new Binding(Edge.LEFT, WINDOW_PADDING, Direction.RIGHT, Edge.LEFT, frame),
                                           new Binding(Edge.TOP, WINDOW_PADDING, Direction.BELOW, Edge.TOP, frame)));
    frame.add(two, new RelativeConstraints(new Binding(Edge.RIGHT, WINDOW_PADDING, Direction.LEFT, Edge.RIGHT, frame),
                                           new Binding(Edge.TOP, WINDOW_PADDING, Direction.BELOW, Edge.TOP, frame)));
    frame.add(three, new RelativeConstraints(new Binding(Edge.LEFT, WINDOW_PADDING, Direction.RIGHT, Edge.LEFT, frame),
                                             new Binding(Edge.BOTTOM, WINDOW_PADDING, Direction.ABOVE, Edge.BOTTOM,
                                                         frame)));
    frame.add(four, new RelativeConstraints(new Binding(Edge.RIGHT, WINDOW_PADDING, Direction.LEFT, Edge.RIGHT, frame),
                                            new Binding(Edge.BOTTOM, WINDOW_PADDING, Direction.ABOVE, Edge.BOTTOM,
                                                        frame)));
    frame.add(five, new RelativeConstraints(new Binding(Edge.TOP, 0, Direction.BELOW, Edge.BOTTOM, one),
                                            new Binding(Edge.LEFT, WINDOW_PADDING, Direction.RIGHT, Edge.LEFT, frame)));

    frame.pack();
    frame.setVisible(true);
  }
View Full Code Here

Examples of edu.cmu.relativelayout.RelativeConstraints

    RelativePosition justBelow = new RelativePosition(Edge.TOP, 0, Direction.BELOW, Edge.BOTTOM);
    RelativePosition justAbove = new RelativePosition(Edge.BOTTOM, 0, Direction.ABOVE, Edge.TOP);
    RelativePosition eightBelow = new RelativePosition(Edge.TOP, 8, Direction.BELOW, Edge.BOTTOM);
    RelativePosition eightRightOf = new RelativePosition(Edge.LEFT, 8, Direction.RIGHT, Edge.RIGHT);

    RelativeConstraints toolbarConstraints = new RelativeConstraints();
    toolbarConstraints
                      .addBindings(
                                   new Binding(Edge.HORIZONTAL_CENTER, 0, Direction.LEFT, Edge.HORIZONTAL_CENTER, frame),
                                   topEdge);
    frame.add(toolbar, toolbarConstraints);

    RelativeConstraints folderViewConstraints = new RelativeConstraints();
    folderViewConstraints.addBindings(leftEdge, new Binding(justBelow, toolbar), new Binding(justAbove, statusBar));
    frame.add(folderView, folderViewConstraints);

    RelativeConstraints mailListConstraints = new RelativeConstraints();
    mailListConstraints.addBindings(new Binding(justBelow, toolbar), new Binding(eightRightOf, folderView), rightEdge);
    frame.add(mailList, mailListConstraints);

    RelativeConstraints mailAreaConstraints = new RelativeConstraints();
    mailAreaConstraints.addBindings(new Binding(eightBelow, mailList), new Binding(eightRightOf, folderView),
                                    new Binding(justAbove, statusBar), rightEdge);
    frame.add(mailArea, mailAreaConstraints);

    RelativeConstraints statusBarConstraints = new RelativeConstraints();
    statusBarConstraints.addBindings(bottomEdge, leftEdge, new Binding(Edge.RIGHT, 20, Direction.LEFT, Edge.RIGHT,
                                                                       frame));
    frame.add(statusBar, statusBarConstraints);

    frame.setSize(800, 400);
    frame.setVisible(true);
View Full Code Here

Examples of edu.cmu.relativelayout.RelativeConstraints

    Binding belowOutside = new Binding(Edge.TOP, 3, Direction.BELOW, Edge.BOTTOM, addButton);

    Binding alignBottoms = new Binding(Edge.BOTTOM, 8, Direction.ABOVE, Edge.BOTTOM, frame);

    RelativeConstraints areaConstraint = new RelativeConstraints();
    areaConstraint.addBinding(toTheRightInside);
    areaConstraint.addBinding(belowInside);
    areaConstraint.addBinding(aboveInside);
    areaConstraint.addBinding(toTheLeftOutside);

    RelativeConstraints addButtonConstraint = new RelativeConstraints();
    addButtonConstraint.addBinding(belowInside);
    addButtonConstraint.addBinding(toTheLeftInside);

    RelativeConstraints editButtonConstraint = new RelativeConstraints();
    editButtonConstraint.addBinding(belowOutside);
    editButtonConstraint.addBinding(toTheLeftInside);

    RelativeConstraints okLabelConstraint = new RelativeConstraints();
    okLabelConstraint.addBinding(toTheLeftInside);
    // okLabelConstraint.addAnchor(aboveInside, frame);
    okLabelConstraint.addBinding(alignBottoms);

    frame.add(area, areaConstraint);
    frame.add(addButton, addButtonConstraint);
    frame.add(editButton, editButtonConstraint);
    frame.add(okLabel, okLabelConstraint);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.