Example usage for javax.swing JComponent setBounds

List of usage examples for javax.swing JComponent setBounds

Introduction

In this page you can find the example usage for javax.swing JComponent setBounds.

Prototype

public void setBounds(int x, int y, int width, int height) 

Source Link

Document

Moves and resizes this component.

Usage

From source file:Main.java

public static void setBoundsAndCenterHorizontally(JComponent component, int x, int y, int width, int height) {
    Container parent = component.getParent();
    int parentWidth = parent.getWidth();
    int paddingOnBothSides = parentWidth - width;
    x = paddingOnBothSides / 2;//from   w w  w  .  j av a 2  s .  c o m
    component.setBounds(x, y, width, height);
}

From source file:DesktopManagerDemo.java

public void resizeFrame(JComponent f, int newX, int newY, int newWidth, int newHeight) {
    f.setBounds(newX, newY, newWidth, newHeight);
    m_counts[13]++;//ww  w. j  a  v a2s.c o  m
}

From source file:DesktopManagerDemo.java

public void setBoundsForFrame(JComponent f, int newX, int newY, int newWidth, int newHeight) {
    f.setBounds(newX, newY, newWidth, newHeight);
    m_counts[14]++;//from  w w w. ja v a  2  s . com
}

From source file:JavaXWin.java

public void resizeFrame(JComponent f, int newX, int newY, int newWidth, int newHeight) {
    f.setBounds(newX, newY, newWidth, newHeight);
    ww.repaint();/*w ww . ja v  a 2 s. c om*/
}

From source file:JavaXWin.java

public void setBoundsForFrame(JComponent f, int newX, int newY, int newWidth, int newHeight) {
    f.setBounds(newX, newY, newWidth, newHeight);
    ww.repaint();/*from   w  w  w  . j a  v a 2  s . c om*/
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccSwing.CFAccSwingAccountConfigListJPanel.java

public void doLayout() {
    JComponent compo;
    Dimension sz = getSize();//from www  . j a  va2  s . co  m
    compo = getPanelMenuBar();
    compo.setBounds(0, 0, sz.width, 25);
    dataScrollPane.setBounds(0, 25, sz.width, sz.height - 25);
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccSwing.CFAccSwingClusterAttrJPanel.java

public void doLayout() {
    JLabel label;//from   w  w  w .ja v  a2 s  . co m
    JComponent compo;
    CFJReferenceEditor reference;
    Dimension dim;
    final int spacing = 5;
    int y = spacing;
    final int height = 25;
    final int textheight = 80;
    final int vspacing = height + spacing;
    final int textvspacing = textheight + spacing;
    final int labelx = spacing;
    final int labelwidth = 200;
    final int fieldx = labelx + labelwidth + spacing;
    final int fieldwidth = 1024;
    Dimension jpsz = getSize();
    int usefieldwidth = jpsz.width - 215;

    label = getSwingLabelId();
    label.setBounds(labelx, y, labelwidth, height);
    compo = getSwingEditorId();
    dim = compo.getMaximumSize();
    if (dim.width < usefieldwidth) {
        compo.setBounds(fieldx, y, dim.width, height);
    } else {
        compo.setBounds(fieldx, y, fieldwidth, height);
    }
    y = y + vspacing;

    label = getSwingLabelFullDomainName();
    label.setBounds(labelx, y, labelwidth, height);
    compo = getSwingEditorFullDomainName();
    dim = compo.getMaximumSize();
    if (dim.width < usefieldwidth) {
        compo.setBounds(fieldx, y, dim.width, height);
    } else {
        compo.setBounds(fieldx, y, fieldwidth, height);
    }
    y = y + vspacing;

}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccSwing.CFAccSwingSecUserAttrJPanel.java

public void doLayout() {
    JLabel label;//from  w  w w  .ja  va2 s. com
    JComponent compo;
    CFJReferenceEditor reference;
    Dimension dim;
    final int spacing = 5;
    int y = spacing;
    final int height = 25;
    final int textheight = 80;
    final int vspacing = height + spacing;
    final int textvspacing = textheight + spacing;
    final int labelx = spacing;
    final int labelwidth = 200;
    final int fieldx = labelx + labelwidth + spacing;
    final int fieldwidth = 1024;
    Dimension jpsz = getSize();
    int usefieldwidth = jpsz.width - 215;

    label = getSwingLabelSecUserId();
    label.setBounds(labelx, y, labelwidth, height);
    compo = getSwingEditorSecUserId();
    dim = compo.getMaximumSize();
    if (dim.width < usefieldwidth) {
        compo.setBounds(fieldx, y, dim.width, height);
    } else {
        compo.setBounds(fieldx, y, fieldwidth, height);
    }
    y = y + vspacing;

    label = getSwingLabelEMailAddress();
    label.setBounds(labelx, y, labelwidth, height);
    compo = getSwingEditorEMailAddress();
    dim = compo.getMaximumSize();
    if (dim.width < usefieldwidth) {
        compo.setBounds(fieldx, y, dim.width, height);
    } else {
        compo.setBounds(fieldx, y, fieldwidth, height);
    }
    y = y + vspacing;

}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccSwing.CFAccSwingAuditActionAttrJPanel.java

public void doLayout() {
    JLabel label;//w  w  w .j a  va 2 s.co m
    JComponent compo;
    CFJReferenceEditor reference;
    Dimension dim;
    final int spacing = 5;
    int y = spacing;
    final int height = 25;
    final int textheight = 80;
    final int vspacing = height + spacing;
    final int textvspacing = textheight + spacing;
    final int labelx = spacing;
    final int labelwidth = 200;
    final int fieldx = labelx + labelwidth + spacing;
    final int fieldwidth = 1024;
    Dimension jpsz = getSize();
    int usefieldwidth = jpsz.width - 215;

    label = getSwingLabelAuditActionId();
    label.setBounds(labelx, y, labelwidth, height);
    compo = getSwingEditorAuditActionId();
    dim = compo.getMaximumSize();
    if (dim.width < usefieldwidth) {
        compo.setBounds(fieldx, y, dim.width, height);
    } else {
        compo.setBounds(fieldx, y, fieldwidth, height);
    }
    y = y + vspacing;

    label = getSwingLabelDescription();
    label.setBounds(labelx, y, labelwidth, height);
    compo = getSwingEditorDescription();
    dim = compo.getMaximumSize();
    if (dim.width < usefieldwidth) {
        compo.setBounds(fieldx, y, dim.width, height);
    } else {
        compo.setBounds(fieldx, y, fieldwidth, height);
    }
    y = y + vspacing;

}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccSwing.CFAccSwingServiceTypeAttrJPanel.java

public void doLayout() {
    JLabel label;/*  w  w  w .  ja va2s .  com*/
    JComponent compo;
    CFJReferenceEditor reference;
    Dimension dim;
    final int spacing = 5;
    int y = spacing;
    final int height = 25;
    final int textheight = 80;
    final int vspacing = height + spacing;
    final int textvspacing = textheight + spacing;
    final int labelx = spacing;
    final int labelwidth = 200;
    final int fieldx = labelx + labelwidth + spacing;
    final int fieldwidth = 1024;
    Dimension jpsz = getSize();
    int usefieldwidth = jpsz.width - 215;

    label = getSwingLabelServiceTypeId();
    label.setBounds(labelx, y, labelwidth, height);
    compo = getSwingEditorServiceTypeId();
    dim = compo.getMaximumSize();
    if (dim.width < usefieldwidth) {
        compo.setBounds(fieldx, y, dim.width, height);
    } else {
        compo.setBounds(fieldx, y, fieldwidth, height);
    }
    y = y + vspacing;

    label = getSwingLabelDescription();
    label.setBounds(labelx, y, labelwidth, height);
    compo = getSwingEditorDescription();
    dim = compo.getMaximumSize();
    if (dim.width < usefieldwidth) {
        compo.setBounds(fieldx, y, dim.width, height);
    } else {
        compo.setBounds(fieldx, y, fieldwidth, height);
    }
    y = y + vspacing;

}