本文整理了Java中javax.swing.JToolBar.getComponent()
方法的一些代码示例,展示了JToolBar.getComponent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JToolBar.getComponent()
方法的具体详情如下:
包路径:javax.swing.JToolBar
类名称:JToolBar
方法名:getComponent
暂无
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* Disable the tab/button for each visible perspective
*/
public void disableAllPerspectiveTabs() {
for (int i = 0; i < m_perspectiveToolBar.getComponentCount(); i++) {
m_perspectiveToolBar.getComponent(i).setEnabled(false);
}
}
代码示例来源:origin: org.activecomponents.jadex/jadex-editor-bpmn
/**
* Removes all components.
*/
public void removeAll()
{
//super.removeAll();
//this.toolbars = new ArrayList<JToolBar>();
for (JToolBar toolbar : toolbars)
{
((JPanel) ((JScrollPane) toolbar.getComponent(0)).getViewport().getComponent(0)).removeAll();
}
this.toolgroup = new ButtonGroup();
}
代码示例来源:origin: vasl-developers/vasl
@Override
public void setup(boolean gameStarting) {
super.setup(gameStarting);
if (gameStarting) {
if (markUnmovedButton != null) {
for (int l_i = map.getToolBar().getComponents().length - 1; l_i >= 0; l_i--) {
Component l_objComponent = map.getToolBar().getComponent(l_i);
if (l_objComponent instanceof JButton) {
if ("MarkMovedPlaceHolder".equals(((JButton) l_objComponent).getName())) {
map.getToolBar().remove(markUnmovedButton);
map.getToolBar().remove(l_objComponent);
map.getToolBar().add(markUnmovedButton, l_i);
break;
}
}
}
}
}
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* Enable the tab/button for each visible perspective
*/
public void enableAllPerspectiveTabs() {
for (int i = 0; i < m_perspectiveToolBar.getComponentCount(); i++) {
m_perspectiveToolBar.getComponent(i).setEnabled(true);
}
}
代码示例来源:origin: com.eas.platypus/platypus-js-forms
@ScriptFunction(jsDoc = CHILD_JSDOC, params = {"index"})
@Override
public JComponent child(int aIndex) {
return (JComponent) super.getComponent(aIndex);
}
代码示例来源:origin: Waikato/weka-trunk
/**
* Enable the tab/button for each visible perspective
*/
public void enableAllPerspectiveTabs() {
for (int i = 0; i < m_perspectiveToolBar.getComponentCount(); i++) {
m_perspectiveToolBar.getComponent(i).setEnabled(true);
}
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* Enable/disable the tab/button for each perspective in the supplied list of
* perspective IDs
*
* @param perspectiveIDs the list of perspective IDs
* @param enabled true or false to enable or disable the perspective buttons
*/
public void setEnablePerspectiveTabs(List<String> perspectiveIDs,
boolean enabled) {
for (int i = 0; i < m_perspectives.size(); i++) {
Perspective p = m_perspectives.get(i);
if (perspectiveIDs.contains(p.getPerspectiveID())) {
m_perspectiveToolBar.getComponent(i).setEnabled(enabled);
}
}
}
代码示例来源:origin: Waikato/weka-trunk
/**
* Disable the tab/button for each visible perspective
*/
public void disableAllPerspectiveTabs() {
for (int i = 0; i < m_perspectiveToolBar.getComponentCount(); i++) {
m_perspectiveToolBar.getComponent(i).setEnabled(false);
}
}
代码示例来源:origin: Waikato/weka-trunk
/**
* Enable/disable the tab/button for each perspective in the supplied list of
* perspective IDs
*
* @param perspectiveIDs the list of perspective IDs
* @param enabled true or false to enable or disable the perspective buttons
*/
public void setEnablePerspectiveTabs(List<String> perspectiveIDs,
boolean enabled) {
for (int i = 0; i < m_perspectives.size(); i++) {
Perspective p = m_perspectives.get(i);
if (perspectiveIDs.contains(p.getPerspectiveID())) {
m_perspectiveToolBar.getComponent(i).setEnabled(enabled);
}
}
}
代码示例来源:origin: Audiveris/audiveris
/**
* Remove any potential orphan separator at the end of the tool bar
*
* @param toolBar the toolBar to purge
*/
public static void purgeSeparator (JToolBar toolBar)
{
int count = toolBar.getComponentCount();
if (toolBar.getComponent(count - 1) instanceof JSeparator) {
toolBar.remove(count - 1);
}
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* Enable/disable a perspective's button/tab
*
* @param perspectiveID the ID of the perspective to enable/disable
* @param enabled true or false to enable or disable
*/
public void setEnablePerspectiveTab(String perspectiveID, boolean enabled) {
for (int i = 0; i < m_perspectives.size(); i++) {
Perspective p = m_perspectives.get(i);
if (p.getPerspectiveID().equals(perspectiveID) && p.okToBeActive()) {
m_perspectiveToolBar.getComponent(i).setEnabled(enabled);
}
}
}
代码示例来源:origin: mucommander/mucommander
@Override
public void componentResized(ComponentEvent e) {
int nbToolbarComponents = toolbar.getComponentCount();
final boolean aFlag = nbToolbarComponents>0 && !isVisible(toolbar.getComponent(nbToolbarComponents-1), null);
setVisible(aFlag);
moreToolbar.setVisible(aFlag);
}
});
代码示例来源:origin: Waikato/weka-trunk
/**
* Enable/disable a perspective's button/tab
*
* @param perspectiveID the ID of the perspective to enable/disable
* @param enabled true or false to enable or disable
*/
public void setEnablePerspectiveTab(String perspectiveID, boolean enabled) {
for (int i = 0; i < m_perspectives.size(); i++) {
Perspective p = m_perspectives.get(i);
if (p.getPerspectiveID().equals(perspectiveID) && p.okToBeActive()) {
m_perspectiveToolBar.getComponent(i).setEnabled(enabled);
}
}
}
代码示例来源:origin: net.sf.doolin/doolin-gui
/**
* Copies items of a tool bar to another tool bar
*
* @param targetBar
* Target tool bar
* @param sourceBar
* Source tool bar
*/
public static void copyToolbar(JToolBar targetBar, JToolBar sourceBar) {
// List of source component
List<Component> sourceComponents = new ArrayList<Component>();
int count = sourceBar.getComponentCount();
for (int i = 0; i < count; i++) {
Component c = sourceBar.getComponent(i);
sourceComponents.add(c);
}
// Clean
targetBar.removeAll();
// Copy
for (Component c : sourceComponents) {
targetBar.add(c);
}
}
代码示例来源:origin: org.activecomponents.jadex/jadex-editor-bpmn
/**
* Adds a separator.
*
* @param row The toolbar row.
*/
protected void addSeparator(int row)
{
JToolBar tb = getToolBar(row);
JScrollPane sp = (JScrollPane) tb.getComponent(0);
JPanel tbpanel = (JPanel) sp.getViewport().getComponent(0);
tbpanel.add(new JToolBar.Separator());
}
代码示例来源:origin: UNIVALI-LITE/Portugol-Studio
public static void configuraWeblaf(JToolBar barraDeFerramentas) {
if (!WeblafUtils.weblafEstaInstalado()) {
return;
}
((WebToolBarUI) barraDeFerramentas.getUI()).setUndecorated(true);
for (int i = 0; i < barraDeFerramentas.getComponentCount(); i++) {
Component componente = barraDeFerramentas.getComponent(i);
if (componente instanceof AbstractButton) {
AbstractButton botao = (AbstractButton) barraDeFerramentas.getComponent(i);
((WebButtonUI) botao.getUI()).setRolloverDecoratedOnly(true);
}
}
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
protected void setActivePerspective(int theIndex) {
if (theIndex < 0 || theIndex > m_perspectives.size() - 1) {
return;
}
KFPerspective current = (KFPerspective) m_perspectiveHolder.getComponent(0);
current.setActive(false);
m_perspectiveHolder.remove(0);
m_perspectiveHolder.add((JComponent) m_perspectives.get(theIndex),
BorderLayout.CENTER);
m_perspectives.get(theIndex).setActive(true);
((JToggleButton) m_perspectiveToolBar.getComponent(theIndex))
.setSelected(true);
// KnowledgeFlowApp.this.invalidate();
KnowledgeFlowApp.this.revalidate();
KnowledgeFlowApp.this.repaint();
notifyIsDirty();
}
代码示例来源:origin: akquinet/jbosscc-as7-examples
/**
* Removes a no longer available <tt>SimpleShape</tt> from the drawing
* frame.
*
* @param name
* The name of the <tt>SimpleShape</tt> to remove.
**/
public void removeShape(String name) {
m_shapes.remove(name);
if ((m_selected != null) && m_selected.equals(name)) {
m_selected = null;
}
for (int i = 0; i < m_toolbar.getComponentCount(); i++) {
JButton sb = (JButton) m_toolbar.getComponent(i);
if (sb.getActionCommand().equals(name)) {
m_toolbar.remove(i);
m_toolbar.invalidate();
validate();
repaint();
break;
}
}
if ((m_selected == null) && (m_toolbar.getComponentCount() > 0)) {
((JButton) m_toolbar.getComponent(0)).doClick();
}
}
代码示例来源:origin: Waikato/weka-trunk
protected void setActivePerspective(int theIndex) {
if (theIndex < 0 || theIndex > m_perspectives.size() - 1) {
return;
}
KFPerspective current = (KFPerspective) m_perspectiveHolder.getComponent(0);
current.setActive(false);
m_perspectiveHolder.remove(0);
m_perspectiveHolder.add((JComponent) m_perspectives.get(theIndex),
BorderLayout.CENTER);
m_perspectives.get(theIndex).setActive(true);
((JToggleButton) m_perspectiveToolBar.getComponent(theIndex))
.setSelected(true);
// KnowledgeFlowApp.this.invalidate();
KnowledgeFlowApp.this.revalidate();
KnowledgeFlowApp.this.repaint();
notifyIsDirty();
}
代码示例来源:origin: com.fifesoft.rtext/fife.common
public int refreshDockableWindowButtons() {
while (toolbar.getComponentCount()>0) {
toolbar.getComponent(0).removeMouseListener(this);
toolbar.remove(0);
}
for (int i=0; i<windowPanel.getDockableWindowCount(); i++) {
DockableWindow dwind = windowPanel.getDockableWindowAt(i);
Icon icon = dwind.getIcon();
JButton b = new JButton(icon);
b.setToolTipText(dwind.getDockableWindowName());
b.setOpaque(false);
b.putClientProperty("DockableWindow", dwind);
final int index = i;
b.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
windowPanel.setActiveDockableWindow(index);
setCollapsed(false);
}
});
b.addMouseListener(this);
toolbar.add(b);
}
WebLookAndFeelUtils.fixToolbar(toolbar, true);
toolbar.revalidate();
return toolbar.getComponentCount();
}
内容来源于网络,如有侵权,请联系作者删除!