javax.swing.JPanel.getInsets()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(195)

本文整理了Java中javax.swing.JPanel.getInsets()方法的一些代码示例,展示了JPanel.getInsets()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JPanel.getInsets()方法的具体详情如下:
包路径:javax.swing.JPanel
类名称:JPanel
方法名:getInsets

JPanel.getInsets介绍

暂无

代码示例

代码示例来源:origin: mucommander/mucommander

/**
   * Returns this panel's insets.
   */
  @Override
  public Insets getInsets() {
    return insets==null?super.getInsets():insets;
  }
}

代码示例来源:origin: org.nuiton.jaxx/jaxx-runtime

@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;
  }
}

代码示例来源:origin: mucommander/mucommander

/**
   * Returns this panel's insets.
   */
  @Override
  public Insets getInsets() {
    return insets==null?super.getInsets():insets;
  }
}

代码示例来源:origin: org.nuiton.jaxx/jaxx-runtime

@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;
  }
}

代码示例来源:origin: io.ultreia.java4all.jaxx/jaxx-runtime

@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;
  }
}

代码示例来源:origin: io.ultreia.java4all.jaxx/jaxx-runtime

@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;
  }
}

代码示例来源:origin: org.nuiton.jaxx/jaxx-runtime-swing

@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;
  }
}

代码示例来源:origin: org.nuiton.jaxx/jaxx-runtime-swing

@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;
  }
}

代码示例来源:origin: KokaKiwi/MCLauncher

public Insets getInsets()
{
  if (insets == null)
  {
    return super.getInsets();
  }
  return insets;
}

代码示例来源:origin: JetBrains/jediterm

@Override
public Insets getInsets() {
  Insets insets = super.getInsets();
  if (myTabs.isEditorTabs()) { //&& UISettings.getInstance().SHOW_CLOSE_BUTTON) {
    insets.right = 3;
  }
  return insets;
}

代码示例来源:origin: stackoverflow.com

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 **/
  ...
}

代码示例来源:origin: stackoverflow.com

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};
    }
  });

}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

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);
  }        
}

代码示例来源:origin: org.japura/japura-gui

@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;
}

代码示例来源:origin: org.softsmithy.lib/lib-core

/**
  * 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();
}

代码示例来源:origin: com.jidesoft/jide-oss

/**
 * 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);
}

代码示例来源:origin: org.japura/japura-gui

@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);
 }
}

代码示例来源:origin: protegeproject/protege

int deprecatedWidth;
int deprecatedHeight;
Insets rcInsets = renderingComponent.getInsets();

代码示例来源:origin: edu.stanford.protege/protege-editor-owl

int deprecatedWidth;
int deprecatedHeight;
Insets rcInsets = renderingComponent.getInsets();

代码示例来源:origin: org.bidib.jbidib.com.vldocking/vldocking

/** 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;
}

相关文章

微信公众号

最新文章

更多

JPanel类方法