@Override public Dimension getMaximumSize() { if (getText().equals("")) { return (m_sizeLabel.getMaximumSize()); } return (super.getMaximumSize()); }
public void actionPerformed(ActionEvent e) { if (export) { ExportFile exp = new ExportFile(cRep); exp.exequte(format); } else { lbActiveReport.setText(template.getName()); lbActiveReport.setPreferredSize(lbActiveReport.getMaximumSize()); cRep.setTemplate(template); try { cRep.createReport(mainFrame); } catch (Exception e2) { System.err.println("CreateReport.create()....."); } } }
private void configureStatusLabel(JLabel label, int width) { label.setMinimumSize(new Dimension(width, (int) label.getMinimumSize().getHeight())); label.setMaximumSize(new Dimension(width, (int) label.getMaximumSize().getHeight())); label.setPreferredSize(new Dimension(width, (int) label.getPreferredSize().getHeight())); }
public DivPanel init() { Dimension d = new Dimension(120, 80); this.setSize(d); this.setPreferredSize(d); if (iconPanel == null && textPanel == null) { return this; } arrangement = arrangement % 5; this.setLayout(new SpringLayout()); if (icon != null) { iconPanel = iconPanel == null ? new FPanel() : iconPanel; } textPanel = textPanel == null ? new FPanel() : textPanel; switch (arrangement) { case ICON_LEFT_AND_TEXT_RIGHT: if ((icon != null && text != null)) { this.add(iconPanel); this.add(textPanel); SpringUtilities.makeCompactGrid(this, 1, 2, initX, initY, xPad, yPad); } else if (icon != null) { this.add(iconPanel); SpringUtilities.makeCompactGrid(this, 1, 1, initX, initY, xPad, yPad); } else if (text != null) { this.add(textPanel); SpringUtilities.makeCompactGrid(this, 1, 1, initX, initY, xPad, yPad); } break; case ICON_RIGHT_AND_TEXT_LEFT: if ((icon != null && text != null)) { this.add(textPanel); this.add(iconPanel); SpringUtilities.makeCompactGrid(this, 1, 2, initX, initY, xPad, yPad); } else if (icon != null) { this.add(iconPanel); SpringUtilities.makeCompactGrid(this, 1, 1, initX, initY, xPad, yPad); } else if (text != null) { this.add(textPanel); SpringUtilities.makeCompactGrid(this, 1, 1, initX, initY, xPad, yPad); } break; case ICON_TOP_AND_TEXT_BOTTOM: if ((icon != null && text != null)) { this.add(iconPanel); this.add(textPanel); SpringUtilities.makeCompactGrid(this, 2, 1, initX, initY, xPad, yPad); } else if (icon != null) { this.add(iconPanel); SpringUtilities.makeCompactGrid(this, 1, 1, initX, initY, xPad, yPad); } else if (text != null) { this.add(textPanel); SpringUtilities.makeCompactGrid(this, 1, 1, initX, initY, xPad, yPad); } break; case ICON_BOTTOM_AND_TEXT_TOP: if ((icon != null && text != null)) { this.add(textPanel); this.add(iconPanel); SpringUtilities.makeCompactGrid(this, 2, 1, initX, initY, xPad, yPad); } else if (icon != null) { this.add(iconPanel); SpringUtilities.makeCompactGrid(this, 1, 1, initX, initY, xPad, yPad); } else if (text != null) { this.add(textPanel); SpringUtilities.makeCompactGrid(this, 1, 1, initX, initY, xPad, yPad); } break; case ICON_BACK_AND_TEXT_FRONT: if ((icon != null && text != null)) { JPanel tempPanel = new JPanel(); this.add(tempPanel); OverlayLayout ov = new OverlayLayout(tempPanel); tempPanel.setLayout(ov); tempPanel.setMaximumSize(iconPanel.getMaximumSize()); if (iconPanel != null) tempPanel.setBackground(iconPanel.getBackground()); textLabel.setAlignmentX(0.5f); textLabel.setAlignmentY(0.5f); textLabel.setMaximumSize(iconLabel.getMaximumSize()); tempPanel.add(textLabel); iconLabel.setAlignmentX(0.5f); iconLabel.setAlignmentY(0.5f); tempPanel.add(iconLabel); SpringUtilities.makeCompactGrid(this, 1, 1, initX, initY, xPad, yPad); } else if (icon != null) { this.add(iconPanel); SpringUtilities.makeCompactGrid(this, 1, 1, initX, initY, xPad, yPad); } else if (text != null) { this.add(textPanel); SpringUtilities.makeCompactGrid(this, 1, 1, initX, initY, xPad, yPad); } } return this; }