Java Code Examples for javax.swing.SpringLayout#Constraints

The following examples show how to use javax.swing.SpringLayout#Constraints . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SpringUtilities.java    From Robot-Overlord-App with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 2
Source File: SpringUtilities.java    From Astrosoft with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 3
Source File: SpringUtilities.java    From BIMserver with GNU Affero General Public License v3.0 5 votes vote down vote up
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);
}
 
Example 4
Source File: SpringUtilities.java    From jdal with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 5
Source File: SpringUtilities.java    From swift-k with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 6
Source File: SpringUtilities.java    From btdex with GNU General Public License v3.0 5 votes vote down vote up
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);
}
 
Example 7
Source File: SpringUtilities.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
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);
}
 
Example 8
Source File: SpringUtilities.java    From mule-intellij-plugins with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 9
Source File: SpringUtilities.java    From gate-core with GNU Lesser General Public License v3.0 5 votes vote down vote up
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);
}
 
Example 10
Source File: SpringUtilities.java    From spotbugs with GNU Lesser General Public License v2.1 4 votes vote down vote up
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);
}
 
Example 11
Source File: SpringUtilities.java    From zap-extensions with Apache License 2.0 4 votes vote down vote up
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);
}
 
Example 12
Source File: SpringUtilities.java    From javamelody with Apache License 2.0 4 votes vote down vote up
private static SpringLayout.Constraints getConstraintsForCell(int row, int col,
		Container parent, int cols) {
	final SpringLayout layout = (SpringLayout) parent.getLayout();
	final Component c = parent.getComponent(row * cols + col);
	return layout.getConstraints(c);
}
 
Example 13
Source File: SpringUtilities.java    From ganttproject with GNU General Public License v3.0 4 votes vote down vote up
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);
}
 
Example 14
Source File: SummaryPanel.java    From swift-k with Apache License 2.0 4 votes vote down vote up
private void makeProgressBars(SpringLayout l) {
    JComponent prevLabel = null, prevBar = null;
    bars = new JProgressBar[SummaryItem.STATES.length];
    
    SpringLayout ls = new SpringLayout();
    JPanel appSummary = new JPanel();
    appSummary.setBorder(BorderFactory.createTitledBorder(
        BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "App Summary"));
    add(appSummary);
    l.putConstraint(SpringLayout.WEST, appSummary, 5, SpringLayout.WEST, this);
    l.putConstraint(SpringLayout.EAST, appSummary, -5, SpringLayout.EAST, this);
    l.putConstraint(SpringLayout.NORTH, appSummary, 25, SpringLayout.NORTH, this);
    
    appSummary.setLayout(ls);
    
    
    for (int i = 0; i < SummaryItem.STATES.length; i++) {
        JLabel label = new JLabel(SummaryItem.STATES[i] + ":");
        appSummary.add(label);
        
        JProgressBar lb = new JProgressBar();
        bars[i] = lb;
        lb.setString("0");
        lb.setStringPainted(true);
        appSummary.add(lb);
    
        fixEdges(ls, label, lb, appSummary);
        if (prevLabel == null) {
            ls.putConstraint(SpringLayout.NORTH, label, 5, SpringLayout.NORTH, appSummary);
        }
        else {
            ls.putConstraint(SpringLayout.NORTH, label, 10, SpringLayout.SOUTH, prevLabel);
        }
        prevLabel = label;
        prevBar = lb;
    }
    
    JLabel hl = new JLabel("Heap:");
    memory = makeProgress(l, hl);
    
    l.putConstraint(SpringLayout.SOUTH, appSummary, -25, SpringLayout.NORTH, hl);
    l.putConstraint(SpringLayout.SOUTH, hl, -25, SpringLayout.SOUTH, this);
    
    Spring maxW = Spring.constant(0);
    
    for (int i = 0; i < SummaryItem.STATES.length; i++) {
        maxW = Spring.max(maxW, ls.getConstraints(appSummary.getComponent(i * 2)).getWidth());
    }
    
    for (int i = 0; i < SummaryItem.STATES.length; i++) {
        SpringLayout.Constraints c = ls.getConstraints(appSummary.getComponent(i * 2));
        c.setWidth(maxW);
    }
}
 
Example 15
Source File: MiscUtil.java    From energy2d with GNU Lesser General Public License v3.0 4 votes vote down vote up
private static SpringLayout.Constraints getConstraintsForCell(int r, int c, Container parent, int cols) {
	SpringLayout layout = (SpringLayout) parent.getLayout();
	Component component = parent.getComponent(r * cols + c);
	return layout.getConstraints(component);
}
 
Example 16
Source File: Working.java    From sheepit-client with GNU General Public License v2.0 4 votes vote down vote up
private 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);
}
 
Example 17
Source File: SwingStrategyPanelHelper.java    From atdl4j with MIT License 4 votes vote down vote up
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);
}
 
Example 18
Source File: ModelTreeRTStats.java    From mts with GNU General Public License v3.0 4 votes vote down vote up
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);
}
 
Example 19
Source File: SpringUtilities.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
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);
}
 
Example 20
Source File: SpringUtilities.java    From uima-uimaj with Apache License 2.0 3 votes vote down vote up
/**
 * Gets the constraints for cell.
 *
 * @param row the row
 * @param col the col
 * @param parent the parent
 * @param cols the cols
 * @return the constraints for cell
 */
/* 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);
}