javax.swing.JTabbedPane.getParent()方法的使用及代码示例

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

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

JTabbedPane.getParent介绍

暂无

代码示例

代码示例来源:origin: realXuJiang/bigtable-sql

void selectCurrentTab()
{
  if (_tabPnl.getParent() != null)
  {
    int idx = _tabPnl.getSelectedIndex();
    if (idx != -1 && idx < _tabs.size())
    {
      IObjectTab tab = _tabs.get(idx);
      if (tab != null)
      {
        tab.select();
      }
    }
  }
}

代码示例来源:origin: net.sf.squirrel-sql/squirrel-sql

void selectCurrentTab()
{
  if (_tabPnl.getParent() != null)
  {
    int idx = _tabPnl.getSelectedIndex();
    if (idx != -1 && idx < _tabs.size())
    {
      IObjectTab tab = _tabs.get(idx);
      if (tab != null)
      {
        tab.select();
      }
    }
  }
}

代码示例来源:origin: CallForSanity/Gaalop

if (fileChooser.showOpenDialog(tabbedPane.getParent()) == JFileChooser.APPROVE_OPTION) {
  String content = readFile(fileChooser.getSelectedFile());
  lastDirectory = fileChooser.getSelectedFile().getParentFile();
JOptionPane.showMessageDialog(tabbedPane.getParent(), "Unable to open file " +
    fileChooser.getSelectedFile() + ".\n" + ex, "Error", JFileChooser.ERROR);

代码示例来源:origin: com.eas.platypus/platypus-js-forms

@ScriptFunction
@Override
public void setTop(int aValue) {
  if (super.getParent() != null && super.getParent().getLayout() instanceof MarginLayout) {
    MarginLayout.ajustTop(this, aValue);
  }
  super.setLocation(getLeft(), aValue);
}

代码示例来源:origin: com.eas.platypus/platypus-js-forms

@ScriptFunction
@Override
public void setLeft(int aValue) {
  if (super.getParent() != null && super.getParent().getLayout() instanceof MarginLayout) {
    MarginLayout.ajustLeft(this, aValue);
  }
  super.setLocation(aValue, getTop());
}

代码示例来源:origin: net.java.dev.laf-widget/laf-widget

public void actionPerformed(ActionEvent e) {
    TabPagerManager te = TabPagerManager.getPager();
    if (te.isVisible()) {
      te.hide();
    } else {
      // fix for defect 233 on Substance - the key event
      // is not dispatched when tab pager is not showing.
      Component comp = jcomp.getParent();
      while (comp != null) {
        if (comp instanceof JComponent) {
          JComponent jc = (JComponent) comp;
          KeyStroke escapeKeyStroke = KeyStroke.getKeyStroke(
              KeyEvent.VK_ESCAPE, 0, false);
          ActionListener al = jc
              .getActionForKeyStroke(escapeKeyStroke);
          if (al != null) {
            al.actionPerformed(e);
            return;
          }
        }
        comp = comp.getParent();
      }
    }
  }
});

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-terminal-nb

@Override
public void setTitleWork(JComponent comp, String title) {
// pass-through for currently visible component
// SHOULD see if the following logic can be applied generically
// after addTab() or removeTab()
  if (soleComponent != null) {
  assert soleComponent == comp;
  updateWindowName(title);
  } else {
  assert tabbedPane.getParent() == this;
  updateWindowName(null);
  // write thru
  restoreAttrsFor(comp);
  }
}

代码示例来源:origin: com.jtattoo/JTattoo

protected Color getGapColor(int tabIndex) {
  if (isTabOpaque() || tabIndex == tabPane.getSelectedIndex()) {
    if ((tabIndex >= 0) && (tabIndex < tabCount)) {
      Color tabColors[] = getTabColors(tabIndex, tabIndex == tabPane.getSelectedIndex(), false);
      if (tabColors != null && tabColors.length > 0) {
        return tabColors[tabColors.length - 1];
      } else {
        return tabPane.getBackgroundAt(tabIndex);
      }
    }
  }
  if (!tabPane.isOpaque()) {
    Container parent = tabPane.getParent();
    while (parent != null) {
      if (parent.isOpaque()) {
        return parent.getBackground();
      }
      parent = parent.getParent();
    }
  }
  return tabAreaBackground;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-terminal-nb

if (soleComponent != null) {
  assert tabbedPane.getParent() == null;
  assert tabbedPane.getTabCount() == 0;
  componentRemove(soleComponent);
  assert tabbedPane.getParent() != null;
  assert soleComponent == null;
  tabbedPane.add(comp);
  assert tabbedPane.getParent() == null;
  assert soleComponent == null;
  setFocusable(false);

代码示例来源:origin: org.codehaus.mevenide/lifecycle-build-plan

public void addView(BuildPlanViewUI viewUI) {
  synchronized (BuildPlanTopComponent.class) {
    if (getComponents().length == 0) {
      setName(NbBundle.getMessage(BuildPlanTopComponent.class,
          "CTL_BuildPlanTopComponent2", viewUI.getName()));
      add(viewUI, BorderLayout.CENTER);
    } else {
      if (tabpane.getParent()==null) {
        BuildPlanViewUI current = (BuildPlanViewUI) getComponents()[0];
        tabpane.addTab(NbBundle.getMessage(BuildPlanTopComponent.class,
            "LBL_Buildplan_of") + current.getName() + "    "/*adding space to prevent overlap of X*/,
            current);
        removeAll();
        add(tabpane, BorderLayout.CENTER);
        
      }
      //______________________________________________________________
      int componentCount = tabpane.getComponentCount();
      tabpane.addTab(NbBundle.getMessage(BuildPlanTopComponent.class,
          "LBL_Buildplan_of") + viewUI.getName() + "    "/*adding space to prevent overlap of X*/,
          viewUI);
      setName(NbBundle.getMessage(BuildPlanTopComponent.class,
          "CTL_BuildPlanTopComponent"));
      tabpane.setSelectedIndex(componentCount);
    }
    repaint();
    updateUI();
  }
}

代码示例来源:origin: net.sf.squirrel-sql/squirrel-sql

private void autoScrollTest(Point glassPt)
{
 Rectangle r = DndTabUtils.getTabAreaBounds(_dnDTabbedPaneData.getTabbedPane());
 int tabPlacement = _dnDTabbedPaneData.getTabbedPane().getTabPlacement();
 if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM)
 {
   _dnDTabbedPaneData.getrBackward().setBounds(r.x, r.y, DndTabUtils.RWH, r.height);
   _dnDTabbedPaneData.getrForward().setBounds(r.x + r.width - DndTabUtils.RWH - DndTabUtils.BUTTON_SIZE, r.y, DndTabUtils.RWH + DndTabUtils.BUTTON_SIZE, r.height);
 }
 else if (tabPlacement == SwingConstants.LEFT || tabPlacement == SwingConstants.RIGHT)
 {
   _dnDTabbedPaneData.getrBackward().setBounds(r.x, r.y, r.width, DndTabUtils.RWH);
   _dnDTabbedPaneData.getrForward().setBounds(r.x, r.y + r.height - DndTabUtils.RWH - DndTabUtils.BUTTON_SIZE, r.width, DndTabUtils.RWH + DndTabUtils.BUTTON_SIZE);
 }
 _dnDTabbedPaneData.setrBackward(SwingUtilities.convertRectangle(_dnDTabbedPaneData.getTabbedPane().getParent(), _dnDTabbedPaneData.getrBackward(), _glassPane));
 _dnDTabbedPaneData.setrForward(SwingUtilities.convertRectangle(_dnDTabbedPaneData.getTabbedPane().getParent(), _dnDTabbedPaneData.getrForward(), _glassPane));
 if (_dnDTabbedPaneData.getrBackward().contains(glassPt))
 {
   //System.out.println(new java.util.Date() + "Backward");
   clickArrowButton("scrollTabsBackwardAction");
 }
 else if (_dnDTabbedPaneData.getrForward().contains(glassPt))
 {
   //System.out.println(new java.util.Date() + "Forward");
   clickArrowButton("scrollTabsForwardAction");
 }
}

代码示例来源:origin: realXuJiang/bigtable-sql

private void autoScrollTest(Point glassPt)
{
 Rectangle r = DndTabUtils.getTabAreaBounds(_dnDTabbedPaneData.getTabbedPane());
 int tabPlacement = _dnDTabbedPaneData.getTabbedPane().getTabPlacement();
 if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM)
 {
   _dnDTabbedPaneData.getrBackward().setBounds(r.x, r.y, DndTabUtils.RWH, r.height);
   _dnDTabbedPaneData.getrForward().setBounds(r.x + r.width - DndTabUtils.RWH - DndTabUtils.BUTTON_SIZE, r.y, DndTabUtils.RWH + DndTabUtils.BUTTON_SIZE, r.height);
 }
 else if (tabPlacement == SwingConstants.LEFT || tabPlacement == SwingConstants.RIGHT)
 {
   _dnDTabbedPaneData.getrBackward().setBounds(r.x, r.y, r.width, DndTabUtils.RWH);
   _dnDTabbedPaneData.getrForward().setBounds(r.x, r.y + r.height - DndTabUtils.RWH - DndTabUtils.BUTTON_SIZE, r.width, DndTabUtils.RWH + DndTabUtils.BUTTON_SIZE);
 }
 _dnDTabbedPaneData.setrBackward(SwingUtilities.convertRectangle(_dnDTabbedPaneData.getTabbedPane().getParent(), _dnDTabbedPaneData.getrBackward(), _glassPane));
 _dnDTabbedPaneData.setrForward(SwingUtilities.convertRectangle(_dnDTabbedPaneData.getTabbedPane().getParent(), _dnDTabbedPaneData.getrForward(), _glassPane));
 if (_dnDTabbedPaneData.getrBackward().contains(glassPt))
 {
   //System.out.println(new java.util.Date() + "Backward");
   clickArrowButton("scrollTabsBackwardAction");
 }
 else if (_dnDTabbedPaneData.getrForward().contains(glassPt))
 {
   //System.out.println(new java.util.Date() + "Forward");
   clickArrowButton("scrollTabsForwardAction");
 }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-terminal-nb

@Override
final protected void removeTabWork(final JComponent comp) {
if (soleComponent != null) {
  // removing the last one
  assert soleComponent == comp;
  componentRemove(soleComponent);
  soleComponent = null;
  updateWindowName(null);
  checkSelectionChange();
  setFocusable(true);
  revalidate();
  repaint();    // otherwise term will still stay in view
} else if (tabbedPane.getParent() == this) {
  assert tabbedPane.getTabCount() > 1;
  tabbedPane.remove(comp);
  if (tabbedPane.getTabCount() == 1) {
  //  switch to no tabbed pane
  soleComponent  = (JComponent) tabbedPane.getComponentAt(0);
  tabbedPane.remove(soleComponent);
  componentRemove(tabbedPane);
  super.add(soleComponent);
  updateWindowName(soleComponent.getName());
  }
  checkSelectionChange();
  revalidate();
}
}

相关文章

JTabbedPane类方法