javax.swing.Box.getComponent()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(156)

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

Box.getComponent介绍

暂无

代码示例

代码示例来源:origin: robward-scisys/sldeditor

/**
 * Find option panel.
 *
 * @param box the box
 * @param panel the panel
 * @return the int
 */
private int findOptionPanel(Box box, FieldPanel panel) {
  int index;
  for (index = 0; index < box.getComponentCount(); index++) {
    if (box.getComponent(index) == panel) {
      return index;
    }
  }
  return -1;
}

代码示例来源:origin: net.sf.mmax2/mmax2

private final void addMarkableLevel(Box box, ArrayList newLevel)
{
  Box headerBox = (Box)((JPanel)box.getComponent(1)).getComponent(0);
  
  for (int b=0;b<newLevel.size();b++)
  {            
    java.awt.Component toAdd = (java.awt.Component)newLevel.get(b);
    Box container = (Box)headerBox.getComponent((b*2)+1);
    container.add(toAdd);
    ((java.awt.Component)container.getComponent(0)).setVisible(true);
  }        
}

代码示例来源:origin: net.sf.mmax2/mmax2

public final void clear()
{
  int count = leftBox.getComponentCount();
  for (int i=0;i<count;i++)
  {
    ((JPanel) leftBox.getComponent(i)).removeAll();
  }
  
  count = middleBox.getComponentCount();
  for (int i=0;i<count;i++)
  {
    ((JPanel) middleBox.getComponent(i)).removeAll();
  }
  
  count = rightBox.getComponentCount();
  for (int i=0;i<count;i++)
  {
    ((JPanel) rightBox.getComponent(i)).removeAll();
  }        
}

代码示例来源:origin: icza/scelight

@Override
public void unhideTab( final int hiddenIdx, final int toIdx ) {
  // Adding a component to a container first removes it from its current parent.
  // To avoid complications, first store references, remove, then add to the new parent.
  
  final Component titleComp = titlesPark.getComponent( hiddenIdx );
  final Component contentComp = contentsPark.getComponent( hiddenIdx );
  
  titlesPark.remove( hiddenIdx );
  contentsPark.remove( hiddenIdx );
  
  wrappedTabbedPane.insertTab( null, null, contentComp, null, toIdx );
  wrappedTabbedPane.setTabComponentAt( toIdx, titleComp );
}

代码示例来源:origin: net.sf.mmax2/mmax2

public final MMAX2Attribute getLastAttribute()
{
  Box tempbox = (Box) modifiablePanel.getComponent(0);
  Box schemebox = (Box) tempbox.getComponent(0);
  System.err.println(((MMAX2Attribute) schemebox.getComponent(schemebox.getComponentCount()-1)).getDisplayAttributeName());
  return (MMAX2Attribute) schemebox.getComponent(schemebox.getComponentCount()-1);
}

代码示例来源:origin: eseifert/vectorgraphics2d

public void setImageFormat(ImageFormat imageFormat) {
    this.imageFormat = imageFormat;
    JLabel imageFormatLabel = (JLabel) rightPanel.getComponent(0);
    imageFormatLabel.setText(imageFormat.getName());
    imageFormatLabel.repaint();
  }
}

代码示例来源:origin: net.sf.mmax2/mmax2

/** Returns an ArrayList of all MMAX2Attribute objects currently displayed on this panel, 
  incl. member and pointer. */
public final ArrayList getAllCurrentAttributes()
{
  ArrayList result = new ArrayList();
  MMAX2Attribute currentAttribute = null;
  
  Box tempbox = (Box) modifiablePanel.getComponent(0);
  Box attributebox = (Box) tempbox.getComponent(0);
  
  /* Get number of MMAX2Attribute objects in Box */
  int compCount = attributebox.getComponentCount();
      
  /* Iterate over all available MMAX2Attribute objects */
  for (int e=0;e<compCount;e++)
  {
    /* Get Attribute object at current position */
    currentAttribute = (MMAX2Attribute) attributebox.getComponent(e);
    result.add(currentAttribute);
  }        
  return result;        
}

代码示例来源:origin: net.sf.mmax2/mmax2

private final boolean allMarkableLevelsSpecified()
{
  boolean allSpecified=true;
  for (int z=2;z<markableLevelBox.getComponentCount()-1;z++)
  {
    Box currentBox =(Box) ((JPanel)markableLevelBox.getComponent(z)).getComponent(0);
    if (((JTextField) currentBox.getComponent(1)).getText().trim().equals(""))
    {
      allSpecified=false;
      break;
    }
    if (((JTextField) currentBox.getComponent(5)).getText().trim().equals("") && 
       ((String)((JComboBox) currentBox.getComponent(3)).getSelectedItem()).equals("other ..."))
    {
      allSpecified=false;
      break;                
    }            
  }
  return allSpecified;
}

代码示例来源:origin: net.sf.mmax2/mmax2

((JCheckBoxMenuItem)outerBox.getComponent(b)).setSelected(false);
  ((JCheckBoxMenuItem)outerBox.getComponent(b)).setSelected(true);
  ((JCheckBoxMenuItem)outerBox.getComponent(b)).setSelected(!((JCheckBoxMenuItem)outerBox.getComponent(b)).isSelected());
for (int b=0;b<outerBox.getComponentCount()-1;b++)
  JCheckBoxMenuItem item = ((JCheckBoxMenuItem)outerBox.getComponent(b));
  if (item.isSelected())

代码示例来源:origin: net.sf.mmax2/mmax2

/** Removes and returns MMAX2Attributes dependent on lastAttribute, or empty list. */
public final MMAX2Attribute[] removeTrailingDependentAttributes(MMAX2Attribute lastAttribute)
{
  MMAX2Attribute currentAttribute = null;
  ArrayList removedAsList = new ArrayList();
  Box tempbox = (Box) modifiablePanel.getComponent(0);
  Box attributebox = (Box) tempbox.getComponent(0);
  
  /* Get number of MMAX2Attribute objects in Box */
  int compCount = attributebox.getComponentCount();
  // Iterate over all attributes in attributebox, backwards
  for (int e=compCount-1;e>=0;e--)
  {            
    /* Get attribute object at current position */
    currentAttribute = (MMAX2Attribute) attributebox.getComponent(e);
    if (currentAttribute.dependsOn(lastAttribute))
    {
      removedAsList.add(currentAttribute);
      attributebox.remove(e);
    }
  }        
  MMAX2Attribute[] result = (MMAX2Attribute[]) removedAsList.toArray(new MMAX2Attribute[removedAsList.size()]);        
  {
    container.repaint();
  }
  return result;        
}

代码示例来源:origin: org.opencadc/cadc-download-manager

public void actionPerformed(ActionEvent e) {
  log.debug("ClearAction.actionPerformed()");
  ArrayList removals = new ArrayList();
  for (int i = 0; i < downloads.getComponentCount(); i++) {
    JDownload jdl = (JDownload) downloads.getComponent(i);
    TransferEvent te = jdl.getLastEvent();
    if (te != null && doClear(te.getState())) {
      removals.add(jdl);
    }
  }
  for (int i = 0; i < removals.size(); i++) {
    downloads.remove((Component) removals.get(i));
  }
  validateTree();
  repaint();
}

代码示例来源:origin: net.sf.mmax2/mmax2

Box attributebox = (Box) tempbox.getComponent(0);
  currentAttribute = (MMAX2Attribute) attributebox.getComponent(e);
  if (currentAttribute.getType()== AttributeAPI.MARKABLE_SET) continue;

代码示例来源:origin: net.sf.mmax2/mmax2

schemebox = (Box) tempbox.getComponent(0);
if (schemebox.getComponent(o)==leader)

代码示例来源:origin: net.sf.mmax2/mmax2

Box headerBox = (Box)((JPanel)markableLevelBox.getComponent(1)).getComponent(0);
Box levelNameBox = (Box)headerBox.getComponent(1);
  allLevelNames.add(((JTextField) levelNameBox.getComponent(z)).getText().trim());            
  allLevelFiles.add("_"+((String)allLevelNames.get(allLevelNames.size()-1))+"_level.xml");                        
  allCustomizationFiles.add(((String)allLevelNames.get(allLevelNames.size()-1))+"_customization.xml");
Box sourceBox = (Box) headerBox.getComponent(3);
Box specifyBox = (Box) headerBox.getComponent(5);
for (int z=1;z<sourceBox.getComponentCount();z++)
  String currentLevelSource = (String)((JComboBox) sourceBox.getComponent(z)).getSelectedItem();
  if (currentLevelSource.equals("specify ..."))
    currentLevelSource = currentLevelSource+":"+((JTextField)specifyBox.getComponent(z)).getText();
Box handleBox = (Box) headerBox.getComponent(7);
for (int z=1;z<handleBox.getComponentCount();z++)
  selectedHandleTypes.add(((String)((JComboBox) handleBox.getComponent(z)).getSelectedItem()).trim());
Box colorBox = (Box) headerBox.getComponent(9);
for (int z=1;z<colorBox.getComponentCount();z++)
  allLevelColors.add(((JTextField) colorBox.getComponent(z)).getForeground());
Box styleBox = (Box) headerBox.getComponent(11);
for (int z=1;z<styleBox.getComponentCount();z++)

代码示例来源:origin: robward-scisys/sldeditor

Component component = boxToUpdate.getComponent(index);
if (fieldConfig.getPanel() == component) {
  fieldIndex = index;

代码示例来源:origin: net.sf.mmax2/mmax2

public final void addAttributes(MMAX2Attribute[] attributes)
{        
  Box tempbox = (Box) this.modifiablePanel.getComponent(0);
  Box schemebox = null;
  
  if (tempbox.getComponentCount() !=1)
  {
    schemebox = Box.createVerticalBox();
    schemebox.setBackground(Color.yellow);
    tempbox.add(schemebox);
  }
  else 
  {
    schemebox = (Box) tempbox.getComponent(0);
  }
      
  for (int z=0;z<attributes.length;z++)
  {            
    schemebox.add(attributes[z]);            
  }
  
  rebuild();
  container.invalidate();
}

代码示例来源:origin: net.sf.mmax2/mmax2

Box headerBox = (Box)((JPanel)markableLevelBox.getComponent(1)).getComponent(0);
Box sourceContainer = (Box)headerBox.getComponent(19);
int levelToRemove = 0;            
for (int z=0;z<sourceContainer.getComponentCount();z++)
  if (sourceContainer.getComponent(z)==source)
  Box container = (Box)headerBox.getComponent(b);
  container.remove(levelToRemove);
  if (numMarkableLevels == 1)
    ((java.awt.Component)container.getComponent(0)).setVisible(false);                
Box headerBox = (Box)((JPanel)markableLevelBox.getComponent(1)).getComponent(0);
Box sourceContainer = (Box)headerBox.getComponent(3);
int levelToChange = 0;            
for (int z=0;z<sourceContainer.getComponentCount();z++)
  if (sourceContainer.getComponent(z)==source)
Box specifyBox = (Box)headerBox.getComponent(5);
Box nameBox = (Box)headerBox.getComponent(1);
if(selected.equalsIgnoreCase("specify ..."))
  ((JTextField)specifyBox.getComponent(levelToChange)).setEnabled(true);
  if (((JTextField)specifyBox.getComponent(levelToChange)).getText().equals(""))
    ((JTextField)specifyBox.getComponent(levelToChange)).setText(getTagNameList(source,4,source.getItemCount()-2));

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

buttonBox.getComponent(i).setMaximumSize(btnSize);

相关文章