public CFFreeSwitchSwingAuditActionAttrJPanel( ICFFreeSwitchSwingSchema argSchema, ICFSecurityAuditActionObj argFocus) { super(); JLabel label; JComponent compo; CFJReferenceEditor reference; final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. swingSchema = argSchema; setSwingFocusAsAuditAction(argFocus); 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 = 785; final int panelwidth = fieldx + fieldwidth + spacing; // temporary -- I think you have to have a panel bigger than the coordinates initially setSize(panelwidth, 100000); label = getSwingLabelAuditActionId(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorAuditActionId(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelDescription(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorDescription(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; // Now we can set the proper size based on the fields and references populated setSize(panelwidth, y); Dimension pfsz = new Dimension(panelwidth, y); setPreferredSize(pfsz); Dimension min = new Dimension(400, y); setMinimumSize(min); populateFields(); adjustComponentEnableStates(); swingIsInitializing = false; }
@Override public void doLayout() { Rectangle bounds = getBounds(); myBaseDocControl.setBounds(new Rectangle(0, 0, bounds.width, bounds.height)); int x = bounds.width; for (JComponent button : myButtons) { Dimension buttonSize = button.getPreferredSize(); x -= buttonSize.width; button.setBounds(x, 0, buttonSize.width, buttonSize.height); x -= BUTTON_HGAP; } }
/** Records a new size. Called by the AWT. */ public void setBounds(int x, int y, int width, int height) { Insets insets = getInsets(); int w; int h; if (source == null) { w = width; h = height; } else { w = source.getWidth(); h = source.getHeight(); if (width < w) { w = width; } if (height < h) { h = height; } } componentWidth = w + insets.left + insets.right; componentHeight = h + insets.top + insets.bottom; super.setBounds(x + shift_x, y + shift_y, componentWidth, componentHeight); }
public void doLayout() { JComponent compo; Dimension sz = getSize(); compo = getPanelMenuBar(); compo.setBounds(0, 0, sz.width, 25); dataScrollPane.setBounds(0, 25, sz.width, sz.height - 25); }
/** * Instructs the layout manager to perform the layout for the specified container. * * @param the Container for which this layout manager is being used */ public void layoutContainer(Container parent) { JRootPane root = (JRootPane) parent; Rectangle b = root.getBounds(); Insets i = root.getInsets(); int nextY = 0; int w = b.width - i.right - i.left; int h = b.height - i.top - i.bottom; if (root.getLayeredPane() != null) { root.getLayeredPane().setBounds(i.left, i.top, w, h); } if (root.getGlassPane() != null) { root.getGlassPane().setBounds(i.left, i.top, w, h); } // Note: This is laying out the children in the layeredPane, // technically, these are not our children. if (root.getWindowDecorationStyle() != JRootPane.NONE && (root.getUI() instanceof RootPaneUI)) { JComponent titlePane = ((RootPaneUI) root.getUI()).getTitlePane(); if (titlePane != null) { Dimension tpd = titlePane.getPreferredSize(); if (tpd != null) { int tpHeight = tpd.height; titlePane.setBounds(0, 0, w, tpHeight); nextY += tpHeight; } } } if (root.getContentPane() != null) { root.getContentPane().setBounds(0, nextY, w, h < nextY ? 0 : h - nextY); } }
public void doLayout() { JLabel label; 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 = getSwingLabelOwnerTenant(); label.setBounds(labelx, y, labelwidth, height); reference = getSwingReferenceOwnerTenant(); reference.setBounds(fieldx, y, usefieldwidth, height); y = y + vspacing; 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 = 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; }
private void addRow(String label, JComponent component) { JLabel l = new JLabel(label); l.setFont(Theme.SMALL_BOLD_FONT); l.setBounds(18, y, 400, 18); add(l); y += 18; int componentHeight = (int) component.getPreferredSize().getHeight(); component.setBounds(16, y, 400, componentHeight); y += componentHeight; y += 2; // vertical gap add(component); }
public void setBounds(int x, int y, int width, int height) { this.width = width; this.height = height; if (width > 0 && height > 0) { Image newim = createImage(width, height); offscreen = newim.getGraphics(); clearCanvas(); if (im != null) { offscreen.drawImage(im, 0, 0, this); } im = newim; } super.setBounds(x, y, width, height); repaint(); }
public void doLayout() { if (getLayout() != null) { // A layout manager has been set, so delegate to it super.doLayout(); return; } Dimension d = getSize(); Insets i = getInsets(); if (collapsed) { if (label != null) { Dimension p = label.getPreferredSize(); label.setBounds( i.left, i.top + (d.height - i.top - i.bottom - p.height) / 2, p.width, p.height); } } else { if (comp != null) { comp.setBounds(i.left, i.top, d.width - i.left - i.right, d.height - i.top - i.bottom); } } }
@Override public void setBounds(int x, int y, int width, int height) { super.setBounds(x, y, width, height); relayout(); }
public void doLayout() { JLabel label; 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 = getSwingLabelISOCode(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorISOCode(); 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 = getSwingLabelName(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorName(); 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 = getSwingLabelUnitSymbol(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorUnitSymbol(); 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 = getSwingLabelFracSymbol(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorFracSymbol(); 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 = getSwingLabelPrecis(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorPrecis(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; }
public void doLayout() { JLabel label; 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 = getSwingLabelContainerSecUser(); label.setBounds(labelx, y, labelwidth, height); reference = getSwingReferenceContainerSecUser(); reference.setBounds(fieldx, y, usefieldwidth, height); y = y + vspacing; label = getSwingLabelParentSecProxy(); label.setBounds(labelx, y, labelwidth, height); reference = getSwingReferenceParentSecProxy(); reference.setBounds(fieldx, y, usefieldwidth, height); y = y + vspacing; label = getSwingLabelSecSessionId(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorSecSessionId(); 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 = getSwingLabelSecDevName(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorSecDevName(); 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 = getSwingLabelStart(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorStart(); 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 = getSwingLabelFinish(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorFinish(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; }
public void doLayout() { JLabel label; 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 = getSwingLabelContainerTenant(); label.setBounds(labelx, y, labelwidth, height); reference = getSwingReferenceContainerTenant(); reference.setBounds(fieldx, y, usefieldwidth, height); y = y + vspacing; label = getSwingLabelMenuId(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorMenuId(); 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 = getSwingLabelName(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorName(); 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 = getSwingLabelGreetLong(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorGreetLong(); 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 = getSwingLabelGreetShort(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorGreetShort(); 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 = getSwingLabelInvalidSound(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorInvalidSound(); 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 = getSwingLabelExitSound(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorExitSound(); 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 = getSwingLabelTimeout(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorTimeout(); 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 = getSwingLabelInterDigitTimeout(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorInterDigitTimeout(); 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 = getSwingLabelMaxFailures(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorMaxFailures(); 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 = getSwingLabelMaxTimeouts(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorMaxTimeouts(); 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 = getSwingLabelDigitLen(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorDigitLen(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; }
public CFFreeSwitchSwingPbxIvrMenuAttrJPanel( ICFFreeSwitchSwingSchema argSchema, ICFFreeSwitchPbxIvrMenuObj argFocus) { super(); JLabel label; JComponent compo; CFJReferenceEditor reference; final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. swingSchema = argSchema; setSwingFocusAsPbxIvrMenu(argFocus); 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 = 785; final int panelwidth = fieldx + fieldwidth + spacing; // temporary -- I think you have to have a panel bigger than the coordinates initially setSize(panelwidth, 100000); label = getSwingLabelContainerTenant(); add(label); label.setBounds(labelx, y, labelwidth, height); reference = getSwingReferenceContainerTenant(); add(reference); reference.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelMenuId(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorMenuId(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelName(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorName(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelGreetLong(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorGreetLong(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelGreetShort(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorGreetShort(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelInvalidSound(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorInvalidSound(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelExitSound(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorExitSound(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelTimeout(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorTimeout(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelInterDigitTimeout(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorInterDigitTimeout(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelMaxFailures(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorMaxFailures(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelMaxTimeouts(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorMaxTimeouts(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelDigitLen(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorDigitLen(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; // Now we can set the proper size based on the fields and references populated setSize(panelwidth, y); Dimension pfsz = new Dimension(panelwidth, y); setPreferredSize(pfsz); Dimension min = new Dimension(400, y); setMinimumSize(min); populateFields(); adjustComponentEnableStates(); swingIsInitializing = false; }
/** * Reshape the receiver. The offscreen Image is destroyed, the component is laid out and * repainted. * * @see java.awt.Component * @see layoutComponent */ public void setBounds(int x, int y, int width, int height) { super.setBounds(x, y, width, height); layoutComponent(); repaint(); }
protected void layout1024() { // 640x480, Creative camera for layout1024 size_x = 1024; size_y = 768; sizeCaptureWindow_x = 680; sizeCaptureWindow_y = 480; cwLocation_x = cwLocation_y = 0; // Borders in relation to a normal screen (not the rotated) int border_top, border_left, border_right, border_bottom; border_top = border_bottom = border_left = 50 * 2; // Top, left, right when rotated border_right = 80 * 2; // Bottom when rotated txt_location_x = border_left; txt_location_y = border_top; txt_size_x = 18; txt_size_y = size_y - border_bottom - txt_location_y; imagepanels = new WebcamCaptureAndFadeImagePanel[1]; imagepanels[0] = new WebcamCaptureAndFadeImagePanel( 1, 1, // Size of each image frame in x direction size_x - border_left - border_right, // Size of each image frame in y direction size_y - border_top - border_bottom); // setSize(size_x, size_y); setLayout(null); JComponent jcomp = new JComponent() { /** */ private static final long serialVersionUID = 1L; @Override protected void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setColor(Color.white); g2.fillRect(0, 0, size_x, size_y); super.paintComponent(g); } }; datetext = new rotatedText2(""); add(datetext); datetext.setBounds(size_x - 35, 10, 40, 100); add(jcomp); jcomp.setBounds(0, 0, size_x, size_y); add(imagepanels[0]); imagepanels[0].setBounds( border_top, border_left, size_x - border_right - border_left, size_y - border_top - border_bottom); enable_datetext = true; enable_forceNewImage = true; captureWindow = true; number_of_frames_redborder = -1; // Set capture window at center of the screen cwLocation_x = (size_x / 2) - (sizeCaptureWindow_x / 2); cwLocation_y = (size_y / 2) - (sizeCaptureWindow_y / 2); setSize(size_x, size_y); setBounds(0, 0, 200, 200); setPreferredSize(new Dimension(size_x, size_y)); }