/** * Returns this panel's insets. */ @Override public Insets getInsets() { return insets==null?super.getInsets():insets; } }
@Override public Insets getInsets() { Insets result = super.getInsets(); if (margin != null) { result.top += margin.top; result.left += margin.left; result.right += margin.right; result.bottom += margin.bottom; } return result; } }
/** * Returns this panel's insets. */ @Override public Insets getInsets() { return insets==null?super.getInsets():insets; } }
@Override public Insets getInsets() { Insets result = super.getInsets(); if (margin != null) { result.top += margin.top; result.left += margin.left; result.right += margin.right; result.bottom += margin.bottom; } return result; } }
@Override public Insets getInsets() { Insets result = super.getInsets(); if (margin != null) { result.top += margin.top; result.left += margin.left; result.right += margin.right; result.bottom += margin.bottom; } return result; } }
@Override public Insets getInsets() { Insets result = super.getInsets(); if (margin != null) { result.top += margin.top; result.left += margin.left; result.right += margin.right; result.bottom += margin.bottom; } return result; } }
@Override public Insets getInsets() { Insets result = super.getInsets(); if (margin != null) { result.top += margin.top; result.left += margin.left; result.right += margin.right; result.bottom += margin.bottom; } return result; } }
@Override public Insets getInsets() { Insets result = super.getInsets(); if (margin != null) { result.top += margin.top; result.left += margin.left; result.right += margin.right; result.bottom += margin.bottom; } return result; } }
public Insets getInsets() { if (insets == null) { return super.getInsets(); } return insets; }
@Override public Insets getInsets() { Insets insets = super.getInsets(); if (myTabs.isEditorTabs()) { //&& UISettings.getInstance().SHOW_CLOSE_BUTTON) { insets.right = 3; } return insets; }
public Run() { /** Create & Initialise Things **/ jpanel = new JPanel(); JPanel jpanel2 = new JPanel(); x = 400; y = 400; jpanel.setLayout(null); Insets insets = jpanel2.getInsets(); Dimension size = jpanel2.getPreferredSize(); jpanel2.setBounds(125 + insets.left, 100 + insets.top, size.width, size.height); /** JPanel Properties **/ jpanel2.setBackground(Color.red); jpanel.add(jpanel2); /** Add things to JFrame and JPanel **/ add(jpanel); /** JFrame Properties **/ ... }
public GridBagTest(){ setLayout(new GridBagLayout()); add(gbcComponent(0,0,1,2), gbc); add(gbcComponent(1,0,1,1), gbc); addComponentListener(new java.awt.event.ComponentAdapter() { @Override public void componentResized(java.awt.event.ComponentEvent evt) { GridBagLayout layout = (GridBagLayout) getLayout(); JPanel panel = (JPanel)evt.getComponent(); int width = panel.getWidth(); int height = panel.getHeight(); int wGap = panel.getInsets().left+panel.getInsets().right; int hGap = panel.getInsets().top+panel.getInsets().bottom; layout.columnWidths = new int[]{width/2-wGap, width/2-wGap}; layout.rowHeights = new int[]{height-hGap}; } }); }
final void doLayoutImpl() { super.doLayout(); if ((searchpanel != null) && searchpanel.isDisplayable()) { Rectangle visibleRect = getVisibleRect(); int width = Math.min( visibleRect.width - (SEARCH_FIELD_SPACE * 2), SEARCH_FIELD_PREFERRED_SIZE - SEARCH_FIELD_SPACE); int height = heightOfTextField + searchpanel.getInsets().top + searchpanel.getInsets().bottom; searchpanel.setBounds( Math.max(SEARCH_FIELD_SPACE, (visibleRect.x + visibleRect.width) - width), visibleRect.y + SEARCH_FIELD_SPACE, Math.min(visibleRect.width, width) - SEARCH_FIELD_SPACE, height); } }
@Override public Dimension getPreferredSize() { if (isPreferredSizeSet()) { return super.getPreferredSize(); } Dimension dim = this.innerPanel.getPreferredSize(); if (this.titleIcon != null) { int iconHeight = this.titleIcon.getPreferredSize().height; Insets insets = this.innerPanel.getInsets(); int yBase = getTitleBar().getIconBase().getY(); int yBaseToTop = yBase + insets.top; dim.height += Math.max(0, iconHeight - yBaseToTop); } return dim; }
/** * Applys a border to this customizer. </br> * Usually you will use this method rather than setBorder. * @param border a border */ public void applyBorder(Border border) { getGlassPane().setBorder(border); // painted on glass pane so the handles of HandleBorder are always visible Insets insets = getGlassPane().getInsets(); if (! insets.equals(getComponentContainer().getInsets())){ getComponentContainer().setBorder(BorderFactory.createEmptyBorder(insets.top, insets.left, insets.bottom, insets.right)); } // System.out.println("bounds before: "+getComponent().getBounds()); // Insets insets = getGlassPane().getInsets(); // getComponentContainer().setBorder(BorderFactory.createEmptyBorder(insets.top, insets.left, insets.bottom, insets.right)); // getComponentContainer().doLayout(); // System.out.println("bounds after: "+getComponent().getBounds()); // repaint(); }
/** * Shows the tab list popup by clicking on the list button. * * @param listButton the list button being clicked. * @since 3.2.2 */ public void showTabListPopup(JButton listButton) { JPanel panel = new JPanel(new BorderLayout()); panel.setBackground(UIDefaultsLookup.getColor("JideTabbedPane.tabListBackground")); panel.setOpaque(true); panel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); JList list = createTabList(panel.getInsets()); JScrollPane scroller = new JScrollPane(list); scroller.setBorder(BorderFactory.createEmptyBorder()); scroller.getViewport().setOpaque(false); scroller.setOpaque(false); panel.add(scroller); hideTabListPopup(); _tabListPopup = createTabListPopup(); _tabListPopup.setComponentOrientation(getComponentOrientation()); _tabListPopup.setPopupBorder(BorderFactory.createLineBorder(UIDefaultsLookup.getColor("JideTabbedPane.darkShadow"))); _tabListPopup.add(panel); _tabListPopup.addExcludedComponent(listButton); _tabListPopup.setDefaultFocusComponent(list); _tabListPopup.setOwner(this); _tabListPopup.removeExcludedComponent(this); Point point = calculateTabListPopupPosition(listButton); _tabListPopup.showPopup(point.x, point.y); }
@Override public void doLayout() { if (this.titleIcon != null) { Insets insets = this.innerPanel.getInsets(); Dimension titleBarDim = getTitleBar().getPreferredSize(); int iconHeight = this.titleIcon.getPreferredSize().height; int yBase = titleBarDim.height - getTitleBar().getTitleMargin().bottom; int yBaseToTop = yBase + insets.top; int outsideIconHeight = Math.max(0, (iconHeight - yBaseToTop)); int y = outsideIconHeight; int availableHeight = getHeight() - y; this.innerPanel.setSize(getWidth(), availableHeight); this.innerPanel.setLocation(0, y); y = y + insets.top + (titleBarDim.height - getTitleBar().getTitleMargin().bottom) - iconHeight; this.titleIcon.setSize(this.titleIcon.getPreferredSize()); int x = insets.left + this.titleBar.getTitleMargin().left; this.titleIcon.setLocation(x, y); } else { this.innerPanel.setSize(getWidth(), getHeight()); this.innerPanel.setLocation(0, 0); } }
int deprecatedWidth; int deprecatedHeight; Insets rcInsets = renderingComponent.getInsets();
int deprecatedWidth; int deprecatedHeight; Insets rcInsets = renderingComponent.getInsets();
/** Calculates the insets needed around the center component. * This is the sum of border sizes and bordercomponents sizes. * */ private Insets getComponentInsets() { Insets i = getInsets(); // borders Insets i2 = content.getInsets(); i.top += i2.top; i.left += i2.left; i.bottom += i2.bottom; i.right += i2.right; if(topDragger.isVisible()) { i.top += topDragger.getHeight(); } i.top += titleBar.getHeight(); if(leftDragger.isVisible()) { i.left += leftDragger.getWidth(); } if(bottomDragger.isVisible()) { i.bottom += bottomDragger.getHeight(); } if(rightDragger.isVisible()) { i.right += rightDragger.getWidth(); } return i; }